Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ type EtcdSpec struct {
type ManagedEtcdSpec struct {
// storage specifies how etcd data is persisted.
// +required
// +kubebuilder:validation:XValidation:rule="has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)",message="restoreSnapshotURL cannot be added or removed after creation"
Storage ManagedEtcdStorageSpec `json:"storage"`

@muraee muraee Apr 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is difficult to read and reason about. Here I would just add:

// +kubebuilder:validation:XValidation:rule="has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)",message="restoreSnapshotURL cannot be added or removed after creation"
Storage ManagedEtcdStorageSpec `json:"storage"`

and add the equality check back ontop of restoreSnapshotUR field directly

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="restoreSnapshotURL is immutable"
RestoreSnapshotURL []string `json:"restoreSnapshotURL,omitempty"`


// backup defines the backup configuration for managed etcd, including
Expand Down Expand Up @@ -1952,6 +1953,7 @@ type ManagedEtcdStorageSpec struct {
// +kubebuilder:validation:MaxItems=1
// +kubebuilder:validation:items:MaxLength=1024
// +kubebuilder:validation:XValidation:rule="self.size() <= 1", message="RestoreSnapshotURL shouldn't contain more than 1 entry"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="restoreSnapshotURL is immutable"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please update the gdoc to reflect clearly this is only settable on creation

RestoreSnapshotURL []string `json:"restoreSnapshotURL,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2527,6 +2527,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2537,6 +2539,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2654,6 +2654,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2664,6 +2666,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2528,6 +2530,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2528,6 +2530,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2861,6 +2863,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2991,6 +2991,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -3001,6 +3003,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2972,6 +2972,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2982,6 +2984,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2528,6 +2530,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2583,6 +2583,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2593,6 +2595,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2540,6 +2540,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2550,6 +2552,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2536,6 +2536,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2546,6 +2548,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2594,6 +2594,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2604,6 +2606,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2528,6 +2530,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2454,6 +2456,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2583,6 +2585,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2445,6 +2447,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2445,6 +2447,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2768,6 +2768,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2778,6 +2780,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,8 @@ spec:
- message: RestoreSnapshotURL shouldn't contain more than
1 entry
rule: self.size() <= 1
- message: restoreSnapshotURL is immutable
rule: self == oldSelf
type:
description: |-
type is the kind of persistent storage implementation to use for etcd.
Expand All @@ -2918,6 +2920,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: restoreSnapshotURL cannot be added or removed after
creation
rule: has(self.restoreSnapshotURL) == has(oldSelf.restoreSnapshotURL)
required:
- storage
type: object
Expand Down
Loading
Loading