diff --git a/api/telemetry/v1alpha1/collector_types.go b/api/telemetry/v1alpha1/collector_types.go index 8ea02ad..33aef2c 100644 --- a/api/telemetry/v1alpha1/collector_types.go +++ b/api/telemetry/v1alpha1/collector_types.go @@ -52,6 +52,9 @@ type CollectorSpec struct { // TenantSelector is used to select tenants for which the collector should collect data. TenantSelector metav1.LabelSelector `json:"tenantSelector,omitempty"` + // +kubebuilder:validation:Required + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable, please recreate the resource" + // Namespace where the Otel collector DaemonSet is deployed. ControlNamespace string `json:"controlNamespace"` diff --git a/charts/telemetry-controller/crds/telemetry.kube-logging.dev_collectors.yaml b/charts/telemetry-controller/crds/telemetry.kube-logging.dev_collectors.yaml index 1264e87..7abefac 100644 --- a/charts/telemetry-controller/crds/telemetry.kube-logging.dev_collectors.yaml +++ b/charts/telemetry-controller/crds/telemetry.kube-logging.dev_collectors.yaml @@ -51,6 +51,9 @@ spec: controlNamespace: description: Namespace where the Otel collector DaemonSet is deployed. type: string + x-kubernetes-validations: + - message: Value is immutable, please recreate the resource + rule: self == oldSelf daemonSet: description: DaemonSetOverrides is used to override the default DaemonSet configuration. diff --git a/config/crd/bases/telemetry.kube-logging.dev_collectors.yaml b/config/crd/bases/telemetry.kube-logging.dev_collectors.yaml index 1264e87..7abefac 100644 --- a/config/crd/bases/telemetry.kube-logging.dev_collectors.yaml +++ b/config/crd/bases/telemetry.kube-logging.dev_collectors.yaml @@ -51,6 +51,9 @@ spec: controlNamespace: description: Namespace where the Otel collector DaemonSet is deployed. type: string + x-kubernetes-validations: + - message: Value is immutable, please recreate the resource + rule: self == oldSelf daemonSet: description: DaemonSetOverrides is used to override the default DaemonSet configuration.