Skip to content

Commit

Permalink
feat: make control namespace field immutable
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <[email protected]>
  • Loading branch information
csatib02 committed Dec 6, 2024
1 parent 0afa5e5 commit a67a9a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/telemetry/v1alpha1/collector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ type MemoryLimiter struct {
// CollectorSpec defines the desired state of Collector
type CollectorSpec struct {
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 OTel collector DaemonSet is deployed
ControlNamespace string `json:"controlNamespace"`
// Enables debug logging for the collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ spec:
controlNamespace:
description: Namespace where OTel collector DaemonSet is deployed
type: string
x-kubernetes-validations:
- message: Value is immutable, please recreate the resource
rule: self == oldSelf
daemonSet:
description: DaemonSet is a subset of [DaemonSet in k8s.io/api/apps/v1](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#daemonset-v1-apps),
with [DaemonSetSpec replaced by the local variant](#daemonset-spec).
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/telemetry.kube-logging.dev_collectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ spec:
controlNamespace:
description: Namespace where OTel collector DaemonSet is deployed
type: string
x-kubernetes-validations:
- message: Value is immutable, please recreate the resource
rule: self == oldSelf
daemonSet:
description: DaemonSet is a subset of [DaemonSet in k8s.io/api/apps/v1](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#daemonset-v1-apps),
with [DaemonSetSpec replaced by the local variant](#daemonset-spec).
Expand Down

0 comments on commit a67a9a3

Please sign in to comment.