From c9391b6b2a3b5cbe480f42eec3e05e684c0eb526 Mon Sep 17 00:00:00 2001 From: Dominika Vagnerova Date: Thu, 2 Nov 2023 17:29:37 +0100 Subject: [PATCH] priorityClass docs #1881 --- .../stories/assembly_creating_services.adoc | 1 + .../attributes/community-attributes.adoc | 3 +- .../attributes/downstream-attributes.adoc | 1 + .../topics/proc_setting_priority.adoc | 56 +++++++++++++++++++ .../asciidoc/topics/yaml/priority_class.yaml | 7 +++ .../topics/yaml/priority_class_CR.yaml | 8 +++ 6 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 documentation/asciidoc/topics/proc_setting_priority.adoc create mode 100644 documentation/asciidoc/topics/yaml/priority_class.yaml create mode 100644 documentation/asciidoc/topics/yaml/priority_class_CR.yaml diff --git a/documentation/asciidoc/stories/assembly_creating_services.adoc b/documentation/asciidoc/stories/assembly_creating_services.adoc index a1a4547e8..7eaaf2c2b 100644 --- a/documentation/asciidoc/stories/assembly_creating_services.adoc +++ b/documentation/asciidoc/stories/assembly_creating_services.adoc @@ -17,6 +17,7 @@ include::{topics}/proc_allocating_storage.adoc[leveloffset=+1] include::{topics}/ref_persistent_cache_store.adoc[leveloffset=+2] include::{topics}/proc_allocating_cpu_memory.adoc[leveloffset=+1] include::{topics}/proc_setting_jvm_options.adoc[leveloffset=+1] +include::{topics}/proc_setting_priority.adoc[leveloffset=+1] // Downstream content ifdef::downstream[] diff --git a/documentation/asciidoc/topics/attributes/community-attributes.adoc b/documentation/asciidoc/topics/attributes/community-attributes.adoc index 265753ed8..a7e866b18 100644 --- a/documentation/asciidoc/topics/attributes/community-attributes.adoc +++ b/documentation/asciidoc/topics/attributes/community-attributes.adoc @@ -86,4 +86,5 @@ :helm_chart_docs: https://infinispan.org/docs/helm-chart/main/helm-chart.html :cryostat_installation: https://cryostat.io/get-started/#installing-cryostat-operator[Installing Cryostat Operator] -:cryostat_security_configuration: https://cryostat.io/guides/#store-credentials[Configuring Cryostat Credentials] \ No newline at end of file +:cryostat_security_configuration: https://cryostat.io/guides/#store-credentials[Configuring Cryostat Credentials] +:pod_priority_reference: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/[Kubernetes: Pod Priority and Preemption] \ No newline at end of file diff --git a/documentation/asciidoc/topics/attributes/downstream-attributes.adoc b/documentation/asciidoc/topics/attributes/downstream-attributes.adoc index 84ebea28d..3c5c40413 100644 --- a/documentation/asciidoc/topics/attributes/downstream-attributes.adoc +++ b/documentation/asciidoc/topics/attributes/downstream-attributes.adoc @@ -32,3 +32,4 @@ // :cryostat_installation: https://access.redhat.com/documentation/en-us/red_hat_build_of_cryostat/2/html/installing_cryostat/index[Installing Cryostat] :cryostat_security_configuration: https://access.redhat.com/documentation/en-us/red_hat_build_of_cryostat/2/html-single/using_cryostat_to_manage_a_jfr_recording/index#proc_storing-managing-jmx-credentials_assembly_security-options[Configuring Cryostat Credentials] +:pod_priority_reference: https://docs.openshift.com/container-platform/4.14/nodes/pods/nodes-pods-priority.html[Including pod priority in pod scheduling decisions] \ No newline at end of file diff --git a/documentation/asciidoc/topics/proc_setting_priority.adoc b/documentation/asciidoc/topics/proc_setting_priority.adoc new file mode 100644 index 000000000..41439312e --- /dev/null +++ b/documentation/asciidoc/topics/proc_setting_priority.adoc @@ -0,0 +1,56 @@ +[id='setting-priority_{context}'] += Configuring pod priority + +[role="_abstract"] +Create one or more priority classes to indicate the importance of a pod relative to other pods. +Pods with higher priority are scheduled ahead of pods with lower priority, ensuring prioritization of pods running critical workloads, especially when resources become constrained. + +.Prerequisites +* Have `cluster-admin` access to {k8s}. + +.Procedure +. Define a `PriorityClass` object by specifying its name and value. ++ + +.high-priority.yaml +[source,yaml] +---- +include::yaml/priority_class.yaml[] +---- +. Create the priority class. ++ +[source,options="nowrap",subs=attributes+] +---- +{oc_create} -f high-priority.yaml +---- + +. Reference the priority class name in the pod configuration. ++ +.Infinispan CR +[source,yaml] +---- +include::yaml/priority_class_CR.yaml[] +---- ++ +You must reference an existing priority class name, otherwise the pod is rejected. + +. Apply the changes. + +.PriorityClass fields +[%header,cols=2*] +|=== +| Field | Description + +| `PriorityClassName` +| The name of the priority class. + +| `PriorityClassValue` +| An integer indicating the priority level. The higher the value, the higher the priority. + +| `PriorityClassDescription` +| An optional field for providing context about the priority class. +|=== + +[role="_additional-resources"] +.Additional resources +* link:{pod_priority_reference} diff --git a/documentation/asciidoc/topics/yaml/priority_class.yaml b/documentation/asciidoc/topics/yaml/priority_class.yaml new file mode 100644 index 000000000..eef97d7b8 --- /dev/null +++ b/documentation/asciidoc/topics/yaml/priority_class.yaml @@ -0,0 +1,7 @@ +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: high-priority +value: 1000000 +globalDefault: false +description: "Use this priority class for high priority service pods only." \ No newline at end of file diff --git a/documentation/asciidoc/topics/yaml/priority_class_CR.yaml b/documentation/asciidoc/topics/yaml/priority_class_CR.yaml new file mode 100644 index 000000000..df98dc1c8 --- /dev/null +++ b/documentation/asciidoc/topics/yaml/priority_class_CR.yaml @@ -0,0 +1,8 @@ +kind: Infinispan +... +spec: + scheduling: + affinity: + ... + priorityClassName: "high-priority" + ... \ No newline at end of file