Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiying-lin committed Dec 3, 2024
1 parent 683fa05 commit 508a080
Show file tree
Hide file tree
Showing 10 changed files with 2,186 additions and 24 deletions.
30 changes: 16 additions & 14 deletions apis/placement/v1alpha1/override_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

// +genclient
// +genclient:nonNamespaced
// +kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope="Cluster",categories={fleet,fleet-placement}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -34,6 +35,13 @@ type ClusterResourceOverride struct {
// If the resource is selected by both ClusterResourceOverride and ResourceOverride, ResourceOverride will win when resolving
// conflicts.
type ClusterResourceOverrideSpec struct {
// Placement defines whether the override is applied to a specific placement or not.
// If so, the override will trigger the placement rollout immediately when the rollout strategy type is RollingUpdate.
// Otherwise, it will be applied to the next rollout.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec.placement is immutable"
// +optional
Placement *PlacementRef `json:"placement,omitempty"`

// ClusterResourceSelectors is an array of selectors used to select cluster scoped resources. The selectors are `ORed`.
// If a namespace is selected, ALL the resources under the namespace are selected automatically.
// LabelSelector is not supported.
Expand All @@ -48,13 +56,6 @@ type ClusterResourceOverrideSpec struct {
// Policy defines how to override the selected resources on the target clusters.
// +required
Policy *OverridePolicy `json:"policy"`

// Placement defines whether the override is applied to a specific placement or not.
// If so, the override will trigger the placement rollout immediately when the rollout strategy type is RollingUpdate.
// Otherwise, it will be applied to the next rollout.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec.placement is immutable"
// +optional
Placement *PlacementRef `json:"placement,omitempty"`
}

// PlacementRef is the reference to a placement.
Expand Down Expand Up @@ -117,6 +118,7 @@ const (

// +genclient
// +genclient:Namespaced
// +kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope="Namespaced",categories={fleet,fleet-placement}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -137,6 +139,13 @@ type ResourceOverride struct {
// If the resource is selected by both ClusterResourceOverride and ResourceOverride, ResourceOverride will win when resolving
// conflicts.
type ResourceOverrideSpec struct {
// Placement defines whether the override is applied to a specific placement or not.
// If so, the override will trigger the placement rollout immediately when the rollout strategy type is RollingUpdate.
// Otherwise, it will be applied to the next rollout.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec.placement is immutable"
// +optional
Placement *PlacementRef `json:"placement,omitempty"`

// ResourceSelectors is an array of selectors used to select namespace scoped resources. The selectors are `ORed`.
// You can have 1-20 selectors.
// +kubebuilder:validation:Required
Expand All @@ -148,13 +157,6 @@ type ResourceOverrideSpec struct {
// Policy defines how to override the selected resources on the target clusters.
// +required
Policy *OverridePolicy `json:"policy"`

// Placement defines whether the override is applied to a specific placement or not.
// If so, the override will trigger the placement rollout immediately when the rollout strategy type is RollingUpdate.
// Otherwise, it will be applied to the next rollout.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec.placement is immutable"
// +optional
Placement *PlacementRef `json:"placement,omitempty"`
}

// ResourceSelector is used to select namespace scoped resources as the target resources to be placed.
Expand Down
2 changes: 2 additions & 0 deletions apis/placement/v1alpha1/overridesnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (

// +genclient
// +genclient:nonNamespaced
// +kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope="Cluster",categories={fleet,fleet-placement}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -60,6 +61,7 @@ type ClusterResourceOverrideSnapshotSpec struct {

// +genclient
// +genclient:Namespaced
// +kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope="Namespaced",categories={fleet,fleet-placement}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
20 changes: 10 additions & 10 deletions apis/placement/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 508a080

Please sign in to comment.