From 00672a70e462d63305e2fd7e247c1af4f5d14de5 Mon Sep 17 00:00:00 2001 From: kelly-gao Date: Thu, 12 Feb 2026 20:40:32 -0500 Subject: [PATCH 1/8] Add PriorityClassName to RC types, CustomizePodSpec, and BaseComponent interface Added getter --- api/v1/runtimecomponent_types.go | 8 ++++++++ common/types.go | 1 + utils/utils.go | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 2b889bfc..50b928c6 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -168,6 +168,10 @@ type RuntimeComponentSpec struct { // The list of hostnames and IPs that will be injected into the application pod's hosts file // +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Host Aliases" HostAliases *[]corev1.HostAlias `json:"hostAliases,omitempty"` + + // Name of the PriorityClass for the pod. + // +operator-sdk:csv:customresourcedefinitions:order=31,type=spec,displayName="Priority Class Name" + PriorityClassName *string `json:"priorityClassName,omitempty"` } // Defines the DNS @@ -1107,6 +1111,10 @@ func (cr *RuntimeComponent) GetHostAliases() *[]corev1.HostAlias { return cr.Spec.HostAliases } +func (cr *RuntimeComponent) GetPriorityClassName() *string { + return cr.Spec.PriorityClassName +} + // Initialize the RuntimeComponent instance func (cr *RuntimeComponent) Initialize() { if cr.Spec.PullPolicy == nil { diff --git a/common/types.go b/common/types.go index 350123ab..0417d90f 100644 --- a/common/types.go +++ b/common/types.go @@ -264,4 +264,5 @@ type BaseComponent interface { GetDNS() BaseComponentDNS GetDisableTopologyRouting() *bool GetHostAliases() *[]corev1.HostAlias + GetPriorityClassName() *string } diff --git a/utils/utils.go b/utils/utils.go index e6a0d413..3b44e496 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -767,6 +767,10 @@ func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) { } pts.Spec.Tolerations = ba.GetTolerations() + + if ba.GetPriorityClassName() != nil { + pts.Spec.PriorityClassName = *ba.GetPriorityClassName() + } } // Initialize an empty TopologySpreadConstraints list and optionally prefers scheduling across zones/hosts for pods with podMatchLabels From 71db6f6e2d3895e31640523f74beb61bad8571ba Mon Sep 17 00:00:00 2001 From: kelly-gao Date: Wed, 4 Mar 2026 16:28:50 -0500 Subject: [PATCH 2/8] priortiyClass example added --- examples/priorityclass/01-priorityclass.yaml | 7 ++++ .../priorityclass/02-runtimecomponent.yaml | 42 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 examples/priorityclass/01-priorityclass.yaml create mode 100644 examples/priorityclass/02-runtimecomponent.yaml diff --git a/examples/priorityclass/01-priorityclass.yaml b/examples/priorityclass/01-priorityclass.yaml new file mode 100644 index 00000000..14182cee --- /dev/null +++ b/examples/priorityclass/01-priorityclass.yaml @@ -0,0 +1,7 @@ +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: service-critical +value: 1000000 +globalDefault: false +description: "Reserved for critical workloads. Pods with this class may preempt lower-priority pods during resource contention. Pods are Priority 0 by default." \ No newline at end of file diff --git a/examples/priorityclass/02-runtimecomponent.yaml b/examples/priorityclass/02-runtimecomponent.yaml new file mode 100644 index 00000000..6024ef03 --- /dev/null +++ b/examples/priorityclass/02-runtimecomponent.yaml @@ -0,0 +1,42 @@ +apiVersion: rc.app.stacks/v1 +kind: RuntimeComponent +metadata: + name: payment-service +spec: + applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:80a28b6a71ec02369cc13f621e4 + manageTLS: true + resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 200m + memory: 512Mi + replicas: 2 + priorityClassName: service-critical + service: + port: 9443 + serviceAccount: + mountToken: true + probes: + startup: + failureThreshold: 12 + periodSeconds: 5 + httpGet: + path: /health/started + port: 9443 + readiness: + httpGet: + path: /health/ready + port: 9443 + initialDelaySeconds: 1 + periodSeconds: 5 + failureThreshold: 24 + liveness: + httpGet: + path: /health/live + port: 9443 + initialDelaySeconds: 8 + periodSeconds: 5 + + From 8909626b2ebcf2b403f10baa56801bff4111fb82 Mon Sep 17 00:00:00 2001 From: kelly-gao Date: Thu, 5 Mar 2026 20:09:10 -0500 Subject: [PATCH 3/8] update example sample image --- examples/priorityclass/02-runtimecomponent.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/priorityclass/02-runtimecomponent.yaml b/examples/priorityclass/02-runtimecomponent.yaml index 6024ef03..289cd971 100644 --- a/examples/priorityclass/02-runtimecomponent.yaml +++ b/examples/priorityclass/02-runtimecomponent.yaml @@ -3,7 +3,7 @@ kind: RuntimeComponent metadata: name: payment-service spec: - applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:80a28b6a71ec02369cc13f621e4 + applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:80a28b6a71ec02369cc13f621e4c3cca0d63b1977be76e15dabbfba48411107f manageTLS: true resources: limits: From 709be92eb4bf07a2834339a265a6856b3b2475d5 Mon Sep 17 00:00:00 2001 From: kelly-gao Date: Mon, 9 Mar 2026 11:26:34 -0400 Subject: [PATCH 4/8] Added TestCustomizePodSpecPriorityClassName to unit tests --- utils/utils_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/utils/utils_test.go b/utils/utils_test.go index a3d58bb8..cfb1f762 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -494,6 +494,33 @@ func TestCustomizePodSpecServiceLinks(t *testing.T) { verifyTests(testCPS, t) } +func TestCustomizePodSpecPriorityClassName(t *testing.T) { + logger := zap.New() + logf.SetLogger(logger) + + spec := appstacksv1.RuntimeComponentSpec{ + ApplicationImage: appImage, + Service: service, + } + + pts, runtime := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) + CustomizePodSpec(pts, runtime) + nilResult := pts.Spec.PriorityClassName + + priorityClassName := "high-priority" + spec.PriorityClassName = &priorityClassName + pts, runtime = &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) + CustomizePodSpec(pts, runtime) + setResult := pts.Spec.PriorityClassName + + testCPS := []Test{ + {"Default PriorityClassName", "", nilResult}, + {"Set PriorityClassName", priorityClassName, setResult}, + } + verifyTests(testCPS, t) + +} + func TestCustomizePersistence(t *testing.T) { logger := zap.New() logf.SetLogger(logger) From cb0c1de6d5a4e02a2d03b2e65d934479fde579c1 Mon Sep 17 00:00:00 2001 From: kelly-gao Date: Mon, 9 Mar 2026 13:16:06 -0400 Subject: [PATCH 5/8] Change clearing behaviour --- utils/utils.go | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/utils.go b/utils/utils.go index 3b44e496..750e0721 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -768,6 +768,7 @@ func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) { pts.Spec.Tolerations = ba.GetTolerations() + pts.Spec.PriorityClassName = "" if ba.GetPriorityClassName() != nil { pts.Spec.PriorityClassName = *ba.GetPriorityClassName() } From 8a8861d098d17791acba42277521f9792524ecb8 Mon Sep 17 00:00:00 2001 From: kelly-gao Date: Mon, 9 Mar 2026 13:46:14 -0400 Subject: [PATCH 6/8] Added clearing to unit tets --- utils/utils_test.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/utils/utils_test.go b/utils/utils_test.go index cfb1f762..ade25f0e 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -505,20 +505,27 @@ func TestCustomizePodSpecPriorityClassName(t *testing.T) { pts, runtime := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) CustomizePodSpec(pts, runtime) - nilResult := pts.Spec.PriorityClassName + defaultPriorityClassName := pts.Spec.PriorityClassName priorityClassName := "high-priority" spec.PriorityClassName = &priorityClassName pts, runtime = &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) CustomizePodSpec(pts, runtime) - setResult := pts.Spec.PriorityClassName + setPriorityClassName := pts.Spec.PriorityClassName + + spec.PriorityClassName = nil + pts = &corev1.PodTemplateSpec{} + pts.Spec.PriorityClassName = priorityClassName + runtime = createRuntimeComponent(name, namespace, spec) + CustomizePodSpec(pts, runtime) + clearPriorityClassName := pts.Spec.PriorityClassName testCPS := []Test{ - {"Default PriorityClassName", "", nilResult}, - {"Set PriorityClassName", priorityClassName, setResult}, + {"Default PriorityClassName (not set)", "", defaultPriorityClassName}, + {"Set PriorityClassName", priorityClassName, setPriorityClassName}, + {"Clearing PriorityClassName", "", clearPriorityClassName}, } verifyTests(testCPS, t) - } func TestCustomizePersistence(t *testing.T) { From 835321271b7e67b39a717204cfe9ab542d68eff9 Mon Sep 17 00:00:00 2001 From: miuponn Date: Wed, 18 Mar 2026 08:02:12 -0700 Subject: [PATCH 7/8] Update manifets, crd, bundle etc --- api/v1/zz_generated.deepcopy.go | 5 +++++ bundle/manifests/rc.app.stacks_runtimecomponents.yaml | 3 +++ .../manifests/runtime-component.clusterserviceversion.yaml | 3 +++ config/crd/bases/rc.app.stacks_runtimecomponents.yaml | 3 +++ internal/deploy/kubectl/runtime-component-crd.yaml | 3 +++ .../deploy/kustomize/daily/base/runtime-component-crd.yaml | 3 +++ 6 files changed, 20 insertions(+) diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index ca62123d..69f61cdb 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -697,6 +697,11 @@ func (in *RuntimeComponentSpec) DeepCopyInto(out *RuntimeComponentSpec) { } } } + if in.PriorityClassName != nil { + in, out := &in.PriorityClassName, &out.PriorityClassName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeComponentSpec. diff --git a/bundle/manifests/rc.app.stacks_runtimecomponents.yaml b/bundle/manifests/rc.app.stacks_runtimecomponents.yaml index 1407a9ae..0b3f49bc 100644 --- a/bundle/manifests/rc.app.stacks_runtimecomponents.yaml +++ b/bundle/manifests/rc.app.stacks_runtimecomponents.yaml @@ -4590,6 +4590,9 @@ spec: is allowed from. type: object type: object + priorityClassName: + description: Name of the PriorityClass for the pod. + type: string probes: description: Define health checks on application container to determine whether it is alive or ready to receive traffic diff --git a/bundle/manifests/runtime-component.clusterserviceversion.yaml b/bundle/manifests/runtime-component.clusterserviceversion.yaml index 50695e15..76d8b96e 100644 --- a/bundle/manifests/runtime-component.clusterserviceversion.yaml +++ b/bundle/manifests/runtime-component.clusterserviceversion.yaml @@ -422,6 +422,9 @@ spec: application pod's hosts file displayName: Host Aliases path: hostAliases + - description: Name of the PriorityClass for the pod. + displayName: Priority Class Name + path: priorityClassName - description: Labels to set on ServiceMonitor. displayName: Monitoring Labels path: monitoring.labels diff --git a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml index e2a9489a..1dc093f9 100644 --- a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml +++ b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml @@ -4586,6 +4586,9 @@ spec: is allowed from. type: object type: object + priorityClassName: + description: Name of the PriorityClass for the pod. + type: string probes: description: Define health checks on application container to determine whether it is alive or ready to receive traffic diff --git a/internal/deploy/kubectl/runtime-component-crd.yaml b/internal/deploy/kubectl/runtime-component-crd.yaml index 741c46fa..42636b78 100644 --- a/internal/deploy/kubectl/runtime-component-crd.yaml +++ b/internal/deploy/kubectl/runtime-component-crd.yaml @@ -4589,6 +4589,9 @@ spec: is allowed from. type: object type: object + priorityClassName: + description: Name of the PriorityClass for the pod. + type: string probes: description: Define health checks on application container to determine whether it is alive or ready to receive traffic diff --git a/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml b/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml index 741c46fa..42636b78 100644 --- a/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml +++ b/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml @@ -4589,6 +4589,9 @@ spec: is allowed from. type: object type: object + priorityClassName: + description: Name of the PriorityClass for the pod. + type: string probes: description: Define health checks on application container to determine whether it is alive or ready to receive traffic From 1aef7eb69b58d010792c101d4d17a783518ddfd1 Mon Sep 17 00:00:00 2001 From: miuponn Date: Wed, 18 Mar 2026 13:13:09 -0700 Subject: [PATCH 8/8] Added x-descriptor to csv --- bundle/manifests/runtime-component.clusterserviceversion.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundle/manifests/runtime-component.clusterserviceversion.yaml b/bundle/manifests/runtime-component.clusterserviceversion.yaml index 76d8b96e..d0c01ed1 100644 --- a/bundle/manifests/runtime-component.clusterserviceversion.yaml +++ b/bundle/manifests/runtime-component.clusterserviceversion.yaml @@ -425,6 +425,8 @@ spec: - description: Name of the PriorityClass for the pod. displayName: Priority Class Name path: priorityClassName + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:text - description: Labels to set on ServiceMonitor. displayName: Monitoring Labels path: monitoring.labels