Skip to content

Conversation

michaelawyu
Copy link
Member

Description of your changes

This PR adds some experimental API changes that allow status back-reporting.

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

N/A

Special notes for your reviewer

N/A

Signed-off-by: michaelawyu <[email protected]>
@michaelawyu michaelawyu changed the title api: experimental: status back-reporting apis: experimental: status back-reporting Sep 23, 2025
@michaelawyu michaelawyu changed the title apis: experimental: status back-reporting interface: experimental: status back-reporting Sep 23, 2025
Copy link

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: michaelawyu <[email protected]>
Signed-off-by: michaelawyu <[email protected]>
Signed-off-by: michaelawyu <[email protected]>
Copy link
Contributor

@ryanzhang-oss ryanzhang-oss left a comment

Choose a reason for hiding this comment

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

btw, it occurred to me that although we don't use v1 work, it's better to copy all the fields there

Comment on lines 1487 to 1531
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 the corresponding objects 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). If multiple member clusters
// are selected, KubeFleet will fall back to the ReplicatePerCluster strategy, as described below.
ReportBackStrategyTypeMirror ReportBackStrategyType = "Mirror"

// ReportBackStrategyTypeReplicatePerCluster enables status back-reporting by copying
// the status fields 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.
ReportBackStrategyTypeReplicatePerCluster ReportBackStrategyType = "ReplicatePerCluster"
)

// 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
// the corresponding objects 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). If multiple member clusters are selected, KubeFleet will
// fall back to the ReplicatePerCluster strategy.
//
// * ReplicatePerCluster: status back-reporting is enabled by copying the status fields 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.
//
// +kubebuilder:default=Disabled
// +kubebuilder:validation:Enum=Disabled;Mirror;ReplicatePerCluster
// +kubebuilder:validation:Required
Type ReportBackStrategyType `json:"type"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be spread out in a different way

const (

// ReportBackStrategyTypeDisabled disables status back-reporting from the member clusters.
ReportBackStrategyTypeDisabled ReportBackType = "Disabled"

// will copy the status back
ReportBackStrategyTypeMirror ReportBackType = "Copy"

)

(

// Propagate to the original resource
ReportBackPropagateTypeOriginal ReportBackPropagateType = "Original"

// Propagate to work only
ReportBackPropagateTypeWork ReportBackPropagateType = "Work"

)

// ReportBackStrategy describes how to report back the resource status from member clusters.
type ReportBackStrategy struct {

 // Type dictates the type of the report back type to use.
Type ReportBackType `json:"type"`

// Type dictates the type of the report back strategy to use.
Type ReportBackPropagateType `json:"type"`

}

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that sounds great; let me make the edits

Signed-off-by: michaelawyu <[email protected]>
Signed-off-by: michaelawyu <[email protected]>
Signed-off-by: michaelawyu <[email protected]>
// 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
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the default if user doesn't set it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Ryan! I changed it to a pointer field so that when the Type is Disabled, the Destination part does not need to be set. We could add a CEL expression on the topper level to make sure that Destination cannot be empty when Type is Mirror -> would this be alright?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or we could use a default value here but then Destination would be set even if Type is Disabled -> it should be just an appearance thing though, the actual behavior would be fine as I understand

Copy link
Contributor

Choose a reason for hiding this comment

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

CEL sounds better

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, let me add the CEL expression

Copy link
Member Author

Choose a reason for hiding this comment

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

Added.

Signed-off-by: michaelawyu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants