diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 9c875478..21990399 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -317,6 +317,10 @@ type RuntimeComponentService struct { // Configure service session affinity. // +operator-sdk:csv:customresourcedefinitions:order=19,type=spec SessionAffinity *RuntimeComponentServiceSessionAffinity `json:"sessionAffinity,omitempty"` + + // Disables topology aware annotations from being added to the Service. Defaults to false. + // +operator-sdk:csv:customresourcedefinitions:order=20,type=spec,displayName="Disable Topology",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch" + DisableTopology *bool `json:"disableTopology,omitempty"` } // Configure service session affinity @@ -765,6 +769,13 @@ func (cr *RuntimeComponent) GetManageTLS() *bool { return cr.Spec.ManageTLS } +func (cr *RuntimeComponent) GetDisableTopology() *bool { + if cr.Spec.Service != nil { + return cr.Spec.Service.DisableTopology + } + return nil +} + // GetDeployment returns deployment settings func (cr *RuntimeComponent) GetDeployment() common.BaseComponentDeployment { if cr.Spec.Deployment == nil { diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index b29eed28..ba7f0109 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -457,6 +457,11 @@ func (in *RuntimeComponentService) DeepCopyInto(out *RuntimeComponentService) { *out = new(RuntimeComponentServiceSessionAffinity) (*in).DeepCopyInto(*out) } + if in.DisableTopology != nil { + in, out := &in.DisableTopology, &out.DisableTopology + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeComponentService. diff --git a/bundle/manifests/rc.app.stacks_runtimecomponents.yaml b/bundle/manifests/rc.app.stacks_runtimecomponents.yaml index 35d6d5fe..b71c635d 100644 --- a/bundle/manifests/rc.app.stacks_runtimecomponents.yaml +++ b/bundle/manifests/rc.app.stacks_runtimecomponents.yaml @@ -5168,6 +5168,10 @@ spec: certificate and CA to be mounted in the pod. The following keys are valid in the secret: ca.crt, tls.crt, and tls.key.' type: string + disableTopology: + description: Disables topology aware annotations from being added + to the Service. Defaults to false. + type: boolean nodePort: description: Node proxies this port into your service. format: int32 diff --git a/bundle/manifests/runtime-component.clusterserviceversion.yaml b/bundle/manifests/runtime-component.clusterserviceversion.yaml index e75f09e8..593e3a29 100644 --- a/bundle/manifests/runtime-component.clusterserviceversion.yaml +++ b/bundle/manifests/runtime-component.clusterserviceversion.yaml @@ -71,7 +71,7 @@ metadata: categories: Application Runtime certified: "true" containerImage: icr.io/appcafe/runtime-component-operator:daily - createdAt: "2025-12-08T16:01:38Z" + createdAt: "2026-01-20T21:22:29Z" description: Deploys any runtime component with dynamic and auto-tuning configuration features.operators.openshift.io/disconnected: "true" features.operators.openshift.io/fips-compliant: "true" @@ -339,6 +339,12 @@ spec: - description: Configure service session affinity. displayName: Session Affinity path: service.sessionAffinity + - description: Disables topology aware annotations from being added to the Service. + Defaults to false. + displayName: Disable Topology + path: service.disableTopology + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - description: Setting to maintain session affinity. Must be ClientIP or None. Defaults to None. displayName: Session Affinity Type diff --git a/common/types.go b/common/types.go index c9232ad6..6b174b55 100644 --- a/common/types.go +++ b/common/types.go @@ -260,4 +260,5 @@ type BaseComponent interface { GetDisableServiceLinks() *bool GetTolerations() []corev1.Toleration GetDNS() BaseComponentDNS + GetDisableTopology() *bool } diff --git a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml index 2a0b5f72..c1d74ca1 100644 --- a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml +++ b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml @@ -5164,6 +5164,10 @@ spec: certificate and CA to be mounted in the pod. The following keys are valid in the secret: ca.crt, tls.crt, and tls.key.' type: string + disableTopology: + description: Disables topology aware annotations from being added + to the Service. Defaults to false. + type: boolean nodePort: description: Node proxies this port into your service. format: int32 diff --git a/config/manifests/bases/runtime-component.clusterserviceversion.yaml b/config/manifests/bases/runtime-component.clusterserviceversion.yaml index d147ca9a..b4e79aac 100644 --- a/config/manifests/bases/runtime-component.clusterserviceversion.yaml +++ b/config/manifests/bases/runtime-component.clusterserviceversion.yaml @@ -273,6 +273,12 @@ spec: - description: Configure service session affinity. displayName: Session Affinity path: service.sessionAffinity + - description: Disables topology aware annotations from being added to the Service. + Defaults to false. + displayName: Disable Topology + path: service.disableTopology + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - description: Setting to maintain session affinity. Must be ClientIP or None. Defaults to None. displayName: Session Affinity Type diff --git a/internal/deploy/kubectl/runtime-component-crd.yaml b/internal/deploy/kubectl/runtime-component-crd.yaml index 5eadacb5..7aa487e4 100644 --- a/internal/deploy/kubectl/runtime-component-crd.yaml +++ b/internal/deploy/kubectl/runtime-component-crd.yaml @@ -5167,6 +5167,10 @@ spec: certificate and CA to be mounted in the pod. The following keys are valid in the secret: ca.crt, tls.crt, and tls.key.' type: string + disableTopology: + description: Disables topology aware annotations from being added + to the Service. Defaults to false. + type: boolean nodePort: description: Node proxies this port into your service. format: int32 diff --git a/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml b/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml index 5eadacb5..7aa487e4 100644 --- a/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml +++ b/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml @@ -5167,6 +5167,10 @@ spec: certificate and CA to be mounted in the pod. The following keys are valid in the secret: ca.crt, tls.crt, and tls.key.' type: string + disableTopology: + description: Disables topology aware annotations from being added + to the Service. Defaults to false. + type: boolean nodePort: description: Node proxies this port into your service. format: int32 diff --git a/utils/utils.go b/utils/utils.go index 3d016372..711d1bbb 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -198,7 +198,7 @@ func ErrorIsNoMatchesForKind(err error, kind string, version string) bool { func CustomizeService(svc *corev1.Service, ba common.BaseComponent) { obj := ba.(metav1.Object) svc.Labels = ba.GetLabels() - CustomizeServiceAnnotations(svc) + CustomizeServiceAnnotations(svc, ba.GetDisableTopology()) svc.Annotations = MergeMaps(svc.Annotations, ba.GetAnnotations()) if len(svc.Spec.Ports) == 0 { @@ -280,12 +280,15 @@ func CustomizeService(svc *corev1.Service, ba common.BaseComponent) { } } -func CustomizeServiceAnnotations(svc *corev1.Service) { - // Enable topology aware hints/routing - serviceAnnotations := make(map[string]string) - serviceAnnotations["service.kubernetes.io/topology-aware-hints"] = "Auto" // Topology Aware Hints (< k8s version 1.27) - serviceAnnotations["service.kubernetes.io/topology-mode"] = "Auto" // Topology Aware Routing (>= k8s version 1.27) - svc.Annotations = MergeMaps(svc.Annotations, serviceAnnotations) +func CustomizeServiceAnnotations(svc *corev1.Service, disableTopology *bool) { + if disableTopology != nil && *disableTopology { + delete(svc.Annotations, "service.kubernetes.io/topology-aware-hints") + delete(svc.Annotations, "service.kubernetes.io/topology-mode") + } else { + serviceAnnotations := make(map[string]string) + serviceAnnotations["service.kubernetes.io/topology-mode"] = "Auto" // Topology Aware Routing (>= k8s version 1.27) + svc.Annotations = MergeMaps(svc.Annotations, serviceAnnotations) + } } func CustomizeProbes(container *corev1.Container, ba common.BaseComponent) {