Skip to content

Commit 59b4a97

Browse files
committed
change name and make it an enum
Signed-off-by: Britania Rodriguez Reyes <[email protected]>
1 parent 9ed80e3 commit 59b4a97

File tree

3 files changed

+43
-36
lines changed

3 files changed

+43
-36
lines changed

apis/placement/v1beta1/clusterresourceplacement_types.go

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

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.
154-
// This allows namespace-scoped access to the cluster-scoped ClusterResourcePlacement status.
155-
// Defaults to "Disabled".
156-
// +kubebuilder:default=Disabled
157-
// +kubebuilder:validation:Enum=Disabled;Enabled
152+
// StatusReportingScope controls where ClusterResourcePlacement status information is made available.
153+
// When set to "ClusterScope", status is accessible only through the cluster-scoped ClusterResourcePlacement object.
154+
// When set to "NamespaceScope", a ClusterResourcePlacementStatus object is created in the target namespace,
155+
// providing namespace-scoped access to the placement status alongside the cluster-scoped status.
156+
// Defaults to "ClusterScope".
157+
// +kubebuilder:default=ClusterScope
158+
// +kubebuilder:validation:Enum=ClusterScope;NamespaceScope
158159
// +kubebuilder:validation:Optional
159-
CopyToNamespace CopyToNamespaceMode `json:"copyToNamespace,omitempty"`
160+
StatusReportingScope StatusReportingScope `json:"statusReportingScope,omitempty"`
160161
}
161162

162163
// Tolerations returns tolerations for PlacementSpec to handle nil policy case.
@@ -481,17 +482,21 @@ const (
481482
ScheduleAnyway UnsatisfiableConstraintAction = "ScheduleAnyway"
482483
)
483484

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.
485+
// StatusReportingScope defines where ClusterResourcePlacement status information is made available.
486+
// This enables different levels of access to placement status across cluster and namespace scopes.
486487
// +enum
487-
type CopyToNamespaceMode string
488+
type StatusReportingScope string
488489

489490
const (
490-
// CopyToNamespaceModeDisabled indicates that no status copying should occur.
491-
CopyToNamespaceModeDisabled CopyToNamespaceMode = "Disabled"
492491

493-
// CopyToNamespaceModeEnabled indicates that ClusterResourcePlacement status should be copied to the corresponding namespace-scoped resource ClusterResourcePlacementStatus.
494-
CopyToNamespaceModeEnabled CopyToNamespaceMode = "Enabled"
492+
// ClusterScope makes status available only through the cluster-scoped ClusterResourcePlacement object.
493+
// This is the default behavior where status information is accessible only to users with cluster-level permissions.
494+
ClusterScope StatusReportingScope = "ClusterScope"
495+
496+
// NamespaceScope makes status available in both cluster and namespace scopes.
497+
// In addition to the default cluster-scoped status, a ClusterResourcePlacementStatus object is created
498+
// in the target namespace, enabling namespace-scoped users to access placement status information.
499+
NamespaceScope StatusReportingScope = "NamespaceScope"
495500
)
496501

497502
// RolloutStrategy describes how to roll out a new change in selected resources to target clusters.

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,17 +1144,6 @@ spec:
11441144
spec:
11451145
description: The desired state of ClusterResourcePlacement.
11461146
properties:
1147-
copyToNamespace:
1148-
default: Disabled
1149-
description: |-
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.
1152-
This allows namespace-scoped access to the cluster-scoped ClusterResourcePlacement status.
1153-
Defaults to "Disabled".
1154-
enum:
1155-
- Disabled
1156-
- Enabled
1157-
type: string
11581147
policy:
11591148
description: |-
11601149
Policy defines how to select member clusters to place the selected resources.
@@ -1685,6 +1674,18 @@ spec:
16851674
maximum: 1000
16861675
minimum: 1
16871676
type: integer
1677+
statusReportingScope:
1678+
default: ClusterScope
1679+
description: |-
1680+
StatusReportingScope controls where ClusterResourcePlacement status information is made available.
1681+
When set to "ClusterScope", status is accessible only through the cluster-scoped ClusterResourcePlacement object.
1682+
When set to "NamespaceScope", a ClusterResourcePlacementStatus object is created in the target namespace,
1683+
providing namespace-scoped access to the placement status alongside the cluster-scoped status.
1684+
Defaults to "ClusterScope".
1685+
enum:
1686+
- ClusterScope
1687+
- NamespaceScope
1688+
type: string
16881689
strategy:
16891690
description: The rollout strategy to use to replace existing placement
16901691
with new ones.

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,6 @@ spec:
7979
spec:
8080
description: The desired state of ResourcePlacement.
8181
properties:
82-
copyToNamespace:
83-
default: Disabled
84-
description: |-
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.
87-
This allows namespace-scoped access to the cluster-scoped ClusterResourcePlacement status.
88-
Defaults to "Disabled".
89-
enum:
90-
- Disabled
91-
- Enabled
92-
type: string
9382
policy:
9483
description: |-
9584
Policy defines how to select member clusters to place the selected resources.
@@ -620,6 +609,18 @@ spec:
620609
maximum: 1000
621610
minimum: 1
622611
type: integer
612+
statusReportingScope:
613+
default: ClusterScope
614+
description: |-
615+
StatusReportingScope controls where ClusterResourcePlacement status information is made available.
616+
When set to "ClusterScope", status is accessible only through the cluster-scoped ClusterResourcePlacement object.
617+
When set to "NamespaceScope", a ClusterResourcePlacementStatus object is created in the target namespace,
618+
providing namespace-scoped access to the placement status alongside the cluster-scoped status.
619+
Defaults to "ClusterScope".
620+
enum:
621+
- ClusterScope
622+
- NamespaceScope
623+
type: string
623624
strategy:
624625
description: The rollout strategy to use to replace existing placement
625626
with new ones.

0 commit comments

Comments
 (0)