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: 1 addition & 1 deletion apis/cluster/v1beta1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion apis/placement/v1alpha1/zz_generated.deepcopy.go

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

65 changes: 65 additions & 0 deletions apis/placement/v1beta1/clusterresourceplacement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ type RolloutStrategy struct {
// DeleteStrategy configures the deletion behavior when the ClusterResourcePlacement is deleted.
// +kubebuilder:validation:Optional
DeleteStrategy *DeleteStrategy `json:"deleteStrategy,omitempty"`

// ReportBackStrategy describes how to report back the status of applied resources on the member cluster.
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="(self == null) || (self.type == 'Mirror' ? size(self.destination) != 0 : true)",message="when reportBackStrategy.type is 'Mirror', a destination must be specified"
ReportBackStrategy *ReportBackStrategy `json:"reportBackStrategy,omitempty"`
}

// ApplyStrategy describes when and how to apply the selected resource to the target cluster.
Expand Down Expand Up @@ -1480,6 +1485,66 @@ const (
DeletePropagationPolicyDelete DeletePropagationPolicy = "Delete"
)

type ReportBackStrategyType string

const (
// ReportBackStrategyTypeDisabled disables status back-reporting from the member clusters.
ReportBackStrategyTypeDisabled ReportBackStrategyType = "Disabled"

// ReportBackStrategyTypeMirror enables status back-reporting by
// copying the status fields verbatim to some destination on the hub cluster side.
ReportBackStrategyTypeMirror ReportBackStrategyType = "Mirror"
)

type ReportBackDestination string

const (
// ReportBackDestinationOriginalResource implies the status fields will be copied verbatim to the
// the original resource on the hub cluster side. This is only performed when the placement object has a
// scheduling policy that selects exactly one member cluster (i.e., a pickFixed scheduling policy with
// exactly one cluster name, or a pickN scheduling policy with the numberOfClusters field set to 1).
ReportBackDestinationOriginalResource ReportBackDestination = "OriginalResource"

// ReportBackDestinationWorkAPI implies the status fields will be copied verbatim via the Work API
// on the hub cluster side. Users may look up the status of a specific resource applied to a specific
// member cluster by inspecting the corresponding Work object on the hub cluster side.
ReportBackDestinationWorkAPI ReportBackDestination = "WorkAPI"
)

// ReportBackStrategy describes how to report back the resource status from member clusters.
type ReportBackStrategy struct {
// Type dictates the type of the report back strategy to use.
//
// Available options include:
//
// * Disabled: status back-reporting is disabled. This is the default behavior.
//
// * Mirror: status back-reporting is enabled by copying the status fields verbatim to
// a destination on the hub cluster side; see the Destination field for more information.
//
// +kubebuilder:default=Disabled
// +kubebuilder:validation:Enum=Disabled;Mirror
// +kubebuilder:validation:Required
Type ReportBackStrategyType `json:"type"`

// Destination dictates where to copy the status fields to when the report back strategy type is Mirror.
//
// Available options include:
//
// * OriginalResource: the status fields will be copied verbatim to the original resource on the hub cluster side.
// This is only performed when the placement object has a scheduling policy that selects exactly one member cluster
// (i.e., a pickFixed scheduling policy with exactly one cluster name, or a pickN scheduling policy with the numberOfClusters
// field set to 1).
//
// * WorkAPI: the status fields will be copied verbatim via the Work API on the hub cluster side. Users may look up
// the status of a specific resource applied to a specific member cluster by inspecting the corresponding Work object
// on the hub cluster side. This is the default behavior.
//
// +kubebuilder:validation:Enum=OriginalResource;WorkAPI
// +kubebuilder:validation:Optional
Destination *ReportBackDestination `json:"destination,omitempty"`
}

// ClusterResourcePlacementList contains a list of ClusterResourcePlacement.
// +kubebuilder:resource:scope="Cluster"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
26 changes: 24 additions & 2 deletions apis/placement/v1beta1/work_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type WorkSpec struct {
// and is owned by other appliers.
// +optional
ApplyStrategy *ApplyStrategy `json:"applyStrategy,omitempty"`

// ReportBackStrategy describes how to report back the status of applied resources on the member cluster.
// +optional
ReportBackStrategy *ReportBackStrategy `json:"reportBackStrategy,omitempty"`
}

// WorkloadTemplate represents the manifest workload to be deployed on spoke cluster
Expand Down Expand Up @@ -142,7 +146,7 @@ type DriftDetails struct {
// +kubebuilder:validation:Required
ObservedInMemberClusterGeneration int64 `json:"observedInMemberClusterGeneration"`

// FirsftDriftedObservedTime is the timestamp when the drift was first detected.
// FirstDriftedObservedTime is the timestamp when the drift was first detected.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
Expand Down Expand Up @@ -176,7 +180,7 @@ type DiffDetails struct {
// +kubebuilder:validation:Optional
ObservedInMemberClusterGeneration *int64 `json:"observedInMemberClusterGeneration"`

// FirsftDiffedObservedTime is the timestamp when the configuration difference
// FirstDiffedObservedTime is the timestamp when the configuration difference
// was first detected.
//
// +kubebuilder:validation:Required
Expand All @@ -196,6 +200,19 @@ type DiffDetails struct {
ObservedDiffs []PatchDetail `json:"observedDiffs,omitempty"`
}

type BackReportedStatus struct {
// +kubebuilder:validation:EmbeddedResource
// +kubebuilder:pruning:PreserveUnknownFields
ObservedStatus runtime.RawExtension `json:"observedStatus,omitempty"`

// ObservationTime is the timestamp when the status was last back reported.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=date-time
ObservationTime metav1.Time `json:"observationTime"`
}

// ManifestCondition represents the conditions of the resources deployed on
// spoke cluster.
type ManifestCondition struct {
Expand Down Expand Up @@ -228,6 +245,11 @@ type ManifestCondition struct {
//
// +kubebuilder:validation:Optional
DiffDetails *DiffDetails `json:"diffDetails,omitempty"`

// BackReportedStatus is the status reported back from the member cluster (if applicable).
//
// +kubebuilder:validation:Optional
BackReportedStatus *BackReportedStatus `json:"backReportedStatus,omitempty"`
}

// +genclient
Expand Down
54 changes: 53 additions & 1 deletion apis/placement/v1beta1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,51 @@ spec:
- Delete
type: string
type: object
reportBackStrategy:
description: ReportBackStrategy describes how to report back the
status of applied resources on the member cluster.
properties:
destination:
description: |-
Destination dictates where to copy the status fields to when the report back strategy type is Mirror.

Available options include:

* OriginalResource: the status fields will be copied verbatim to the original resource on the hub cluster side.
This is only performed when the placement object has a scheduling policy that selects exactly one member cluster
(i.e., a pickFixed scheduling policy with exactly one cluster name, or a pickN scheduling policy with the numberOfClusters
field set to 1).

* WorkAPI: the status fields will be copied verbatim via the Work API on the hub cluster side. Users may look up
the status of a specific resource applied to a specific member cluster by inspecting the corresponding Work object
on the hub cluster side. This is the default behavior.
enum:
- OriginalResource
- WorkAPI
type: string
type:
default: Disabled
description: |-
Type dictates the type of the report back strategy to use.

Available options include:

* Disabled: status back-reporting is disabled. This is the default behavior.

* Mirror: status back-reporting is enabled by copying the status fields verbatim to
a destination on the hub cluster side; see the Destination field for more information.
enum:
- Disabled
- Mirror
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: when reportBackStrategy.type is 'Mirror', a destination
must be specified
rule: '(self == null) || (self.type == ''Mirror'' ? size(self.destination)
!= 0 : true)'
rollingUpdate:
description: Rolling update config params. Present only if RolloutStrategyType
= RollingUpdate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,51 @@ spec:
- Delete
type: string
type: object
reportBackStrategy:
description: ReportBackStrategy describes how to report back the
status of applied resources on the member cluster.
properties:
destination:
description: |-
Destination dictates where to copy the status fields to when the report back strategy type is Mirror.

Available options include:

* OriginalResource: the status fields will be copied verbatim to the original resource on the hub cluster side.
This is only performed when the placement object has a scheduling policy that selects exactly one member cluster
(i.e., a pickFixed scheduling policy with exactly one cluster name, or a pickN scheduling policy with the numberOfClusters
field set to 1).

* WorkAPI: the status fields will be copied verbatim via the Work API on the hub cluster side. Users may look up
the status of a specific resource applied to a specific member cluster by inspecting the corresponding Work object
on the hub cluster side. This is the default behavior.
enum:
- OriginalResource
- WorkAPI
type: string
type:
default: Disabled
description: |-
Type dictates the type of the report back strategy to use.

Available options include:

* Disabled: status back-reporting is disabled. This is the default behavior.

* Mirror: status back-reporting is enabled by copying the status fields verbatim to
a destination on the hub cluster side; see the Destination field for more information.
enum:
- Disabled
- Mirror
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: when reportBackStrategy.type is 'Mirror', a destination
must be specified
rule: '(self == null) || (self.type == ''Mirror'' ? size(self.destination)
!= 0 : true)'
rollingUpdate:
description: Rolling update config params. Present only if RolloutStrategyType
= RollingUpdate.
Expand Down
Loading
Loading