Skip to content

Commit 9ed80e3

Browse files
committed
Change to enum instead ob bool
Signed-off-by: Britania Rodriguez Reyes <[email protected]>
1 parent 3ea9f29 commit 9ed80e3

File tree

3 files changed

+37
-17
lines changed

3 files changed

+37
-17
lines changed

apis/placement/v1beta1/clusterresourceplacement_types.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,14 @@ type PlacementSpec struct {
149149
// +kubebuilder:validation:Optional
150150
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
151151

152-
// CopyStatusToNamespace indicates whether a ClusterResourcePlacementStatus object should be created to mirror the placement status.
153-
// When enabled, a ClusterResourcePlacementStatus object will be created in the same namespace selected by the ResourceSelectors.
152+
// CopyToNamespace indicates whether a ClusterResourcePlacementStatus object should be created to mirror the placement status.
153+
// When set to "Enabled", a ClusterResourcePlacementStatus object will be created in the same namespace selected by the ClusterResourceSelectors.
154154
// This allows namespace-scoped access to the cluster-scoped ClusterResourcePlacement status.
155-
// Defaults to false.
156-
// +kubebuilder:default=false
155+
// Defaults to "Disabled".
156+
// +kubebuilder:default=Disabled
157+
// +kubebuilder:validation:Enum=Disabled;Enabled
157158
// +kubebuilder:validation:Optional
158-
CopyStatusToNamespace bool `json:"copyStatusToNamespace,omitempty"`
159+
CopyToNamespace CopyToNamespaceMode `json:"copyToNamespace,omitempty"`
159160
}
160161

161162
// Tolerations returns tolerations for PlacementSpec to handle nil policy case.
@@ -480,6 +481,19 @@ const (
480481
ScheduleAnyway UnsatisfiableConstraintAction = "ScheduleAnyway"
481482
)
482483

484+
// CopyToNamespaceMode describes whether the ClusterResourcePlacement status should be copied to the namespace-scoped resource ClusterResourcePlacementStatus.
485+
// This enables namespace-scoped access to cluster-scoped placement status information.
486+
// +enum
487+
type CopyToNamespaceMode string
488+
489+
const (
490+
// CopyToNamespaceModeDisabled indicates that no status copying should occur.
491+
CopyToNamespaceModeDisabled CopyToNamespaceMode = "Disabled"
492+
493+
// CopyToNamespaceModeEnabled indicates that ClusterResourcePlacement status should be copied to the corresponding namespace-scoped resource ClusterResourcePlacementStatus.
494+
CopyToNamespaceModeEnabled CopyToNamespaceMode = "Enabled"
495+
)
496+
483497
// RolloutStrategy describes how to roll out a new change in selected resources to target clusters.
484498
type RolloutStrategy struct {
485499
// Type of rollout. The only supported types are "RollingUpdate" and "External".

config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,14 +1144,17 @@ spec:
11441144
spec:
11451145
description: The desired state of ClusterResourcePlacement.
11461146
properties:
1147-
copyStatusToNamespace:
1148-
default: false
1147+
copyToNamespace:
1148+
default: Disabled
11491149
description: |-
1150-
CopyStatusToNamespace indicates whether a ClusterResourcePlacementStatus object should be created to mirror the placement status.
1151-
When enabled, a ClusterResourcePlacementStatus object will be created in the same namespace selected by the ResourceSelectors.
1150+
CopyToNamespace indicates whether a ClusterResourcePlacementStatus object should be created to mirror the placement status.
1151+
When set to "Enabled", a ClusterResourcePlacementStatus object will be created in the same namespace selected by the ClusterResourceSelectors.
11521152
This allows namespace-scoped access to the cluster-scoped ClusterResourcePlacement status.
1153-
Defaults to false.
1154-
type: boolean
1153+
Defaults to "Disabled".
1154+
enum:
1155+
- Disabled
1156+
- Enabled
1157+
type: string
11551158
policy:
11561159
description: |-
11571160
Policy defines how to select member clusters to place the selected resources.

config/crd/bases/placement.kubernetes-fleet.io_resourceplacements.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ spec:
7979
spec:
8080
description: The desired state of ResourcePlacement.
8181
properties:
82-
copyStatusToNamespace:
83-
default: false
82+
copyToNamespace:
83+
default: Disabled
8484
description: |-
85-
CopyStatusToNamespace indicates whether a ClusterResourcePlacementStatus object should be created to mirror the placement status.
86-
When enabled, a ClusterResourcePlacementStatus object will be created in the same namespace selected by the ResourceSelectors.
85+
CopyToNamespace indicates whether a ClusterResourcePlacementStatus object should be created to mirror the placement status.
86+
When set to "Enabled", a ClusterResourcePlacementStatus object will be created in the same namespace selected by the ClusterResourceSelectors.
8787
This allows namespace-scoped access to the cluster-scoped ClusterResourcePlacement status.
88-
Defaults to false.
89-
type: boolean
88+
Defaults to "Disabled".
89+
enum:
90+
- Disabled
91+
- Enabled
92+
type: string
9093
policy:
9194
description: |-
9295
Policy defines how to select member clusters to place the selected resources.

0 commit comments

Comments
 (0)