diff --git a/apis/v1alpha1/clusterresourceplacement_types.go b/apis/v1alpha1/clusterresourceplacement_types.go index 1ea7acd74..53fe714cc 100644 --- a/apis/v1alpha1/clusterresourceplacement_types.go +++ b/apis/v1alpha1/clusterresourceplacement_types.go @@ -15,132 +15,149 @@ import ( // +kubebuilder:object:root=true // +kubebuilder:resource:scope="Cluster",shortName=crp,categories={fleet-workload} // +kubebuilder:subresource:status +// +kubebuilder:printcolumn:JSONPath=`.metadata.generation`,name="Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Scheduled")].status`,name="Scheduled",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Scheduled")].observedGeneration`,name="ScheduledGen",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Applied")].status`,name="Applied",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Applied")].observedGeneration`,name="AppliedGen",type=string // +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// ClusterResourcePlacement is used to place cluster scoped resources or ALL the resources in a namespace -// onto one or more member clusters in a fleet. Users cannot select resources in a system reserved namespace. -// System reserved namespaces are: kube-system, fleet-system, fleet-work-*. +// ClusterResourcePlacement is used to select cluster scoped resources, including built-in resources and custom resources, and placement them onto selected member clusters in a fleet. +// If a namespace is selected, ALL the resources under the namespace are placed to the target clusters. +// Note that you can't select the following resources: +// - reserved namespaces including: default, kube-* (reserved for Kubernetes system namespaces), fleet-* (reserved for fleet system namespaces). +// - reserved fleet resource types including: MemberCluster, InternalMemberCluster, ClusterResourcePlacement, MultiClusterService, ServiceImport, etc. type ClusterResourcePlacement struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // Spec represents the desired behavior of ClusterResourcePlacement. + // The desired state of ClusterResourcePlacement. // +required Spec ClusterResourcePlacementSpec `json:"spec"` - // Most recently observed status of the ClusterResourcePlacement. + // The observed status of ClusterResourcePlacement. // +optional Status ClusterResourcePlacementStatus `json:"status,omitempty"` } -// ClusterResourcePlacementSpec represents the desired behavior of a ClusterResourcePlacement object. +// ClusterResourcePlacementSpec defines the desired state of ClusterResourcePlacement. type ClusterResourcePlacementSpec struct { - // ResourceSelectors is used to select cluster scoped resources. The selectors are `ORed`. - // kubebuilder:validation:MaxItems=100 + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + + // ResourceSelectors is an array of selectors used to select cluster scoped resources. The selectors are `ORed`. + // You can have 1-100 selectors. // +required ResourceSelectors []ClusterResourceSelector `json:"resourceSelectors"` - // Policy represents the placement policy to select clusters to place all the selected resources. - // If unspecified, all the joined clusters are selected. + // Policy defines how to select member clusters to place the selected resources. + // If unspecified, all the joined member clusters are selected. // +optional Policy *PlacementPolicy `json:"policy,omitempty"` } -// ClusterResourceSelector is used to specify cluster scoped resources to be selected. -// Note: When the cluster resource is of type `namespace`, ALL the resources in this namespace are selected. -// All the fields present in this structure are `ANDed`. +// ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. +// If a namespace is selected, ALL the resources under the namespace are selected automatically. +// All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. type ClusterResourceSelector struct { - // Group is the group name of the target resource. + // Group name of the cluster-scoped resource. + // Use an empty string to select resources under the core API group (e.g., namespaces). // +required Group string `json:"group"` - // Version is the version of the target resource. + // Version of the cluster-scoped resource. // +required Version string `json:"version"` - // Kind is the kind of the target resources. - // Note: When the `kind` field is `namespace` then all the resources inside that namespace is selected. + // Kind of the cluster-scoped resource. + // Note: When `Kind` is `namespace`, ALL the resources under the selected namespaces are selected. // +required Kind string `json:"kind"` - // Name is the name of the target resource. - // Default is empty, which means selecting all resources. - // This field is mutually exclusive with the `labelSelector` field. + // You can only specify at most one of the following two fields: Name and LabelSelector. + // If none is specified, all the cluster-scoped resources with the given group, version and kind are selected. + + // Name of the cluster-scoped resource. // +optional Name string `json:"name,omitempty"` - // labelSelector spells out a label query over a set of resources. - // This field is mutually exclusive with the `name` field. + // A label query over all the cluster-scoped resources. Resources matching the query are selected. + // Note that namespace-scoped resources can't be selected even if they match the query. // +optional LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` } -// PlacementPolicy contains the rules to select member clusters to place the selected resources to. +// PlacementPolicy contains the rules to select target member clusters to place the selected resources. // Note that only clusters that are both joined and satisfying the rules will be selected. -// You should only specify at most one of the two fields: ClusterNames and Affinity. +// +// You can only specify at most one of the two fields: ClusterNames and Affinity. // If none is specified, all the joined clusters are selected. type PlacementPolicy struct { - // ClusterNames contains a list of names of MemberCluster to place the selected resources to. + // +kubebuilder:validation:MaxItems=100 + + // ClusterNames contains a list of names of MemberCluster to place the selected resources. // If the list is not empty, Affinity is ignored. - // kubebuilder:validation:MaxItems=100 // +optional ClusterNames []string `json:"clusterNames,omitempty"` - // Affinity represents the selected resources' scheduling constraints. - // If not set, the entire fleet can be scheduling candidate. + // Affinity contains cluster affinity scheduling rules. Defines which member clusters to place the selected resources. // +optional Affinity *Affinity `json:"affinity,omitempty"` } -// Affinity represents the filter to select clusters. -// The selectors in this struct are `ANDed`. +// Affinity is a group of cluster affinity scheduling rules. More to be added. type Affinity struct { - // ClusterAffinity describes cluster affinity scheduling rules for the resources. + // ClusterAffinity contains cluster affinity scheduling rules for the selected resources. // +optional ClusterAffinity *ClusterAffinity `json:"clusterAffinity,omitempty"` } -// ClusterAffinity represents the filter to select clusters. +// ClusterAffinity contains cluster affinity scheduling rules for the selected resources. type ClusterAffinity struct { + // +kubebuilder:validation:MaxItems=10 + // ClusterSelectorTerms is a list of cluster selector terms. The terms are `ORed`. - // kubebuilder:validation:MaxItems=10 // +optional ClusterSelectorTerms []ClusterSelectorTerm `json:"clusterSelectorTerms,omitempty"` } -// ClusterSelectorTerm represents the requirements to selected clusters. +// ClusterSelectorTerm contains the requirements to select clusters. type ClusterSelectorTerm struct { - // LabelSelector is a label query over the clusters. + // LabelSelector is a label query over all the joined member clusters. Clusters matching the query are selected. // +required LabelSelector metav1.LabelSelector `json:"labelSelector"` } // ClusterResourcePlacementStatus defines the observed state of resource. type ClusterResourcePlacementStatus struct { - // Conditions field contains the overall condition statuses for this resource. // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type + + // Conditions is an array of current observed conditions for ClusterResourcePlacement. + // +optional Conditions []metav1.Condition `json:"conditions"` - // SelectedResources contains a list of resources selected by the resource selector. + // SelectedResources contains a list of resources selected by ResourceSelectors. // +optional SelectedResources []ResourceIdentifier `json:"selectedResources,omitempty"` - // TargetClusters contains a list of member cluster names selected by PlacementPolicy. + // TargetClusters contains a list of names of member clusters selected by PlacementPolicy. // Note that the clusters must be both joined and meeting PlacementPolicy. // +optional TargetClusters []string `json:"targetClusters,omitempty"` - // FailedResourcePlacements is a list of all failed to place resources status. - // kubebuilder:validation:MaxItems=1000 + // +kubebuilder:validation:MaxItems=1000 + + // FailedResourcePlacements is a list of all the resources failed to be placed to the given clusters. + // Note that we only include 1000 failed resource placements even if there are more than 1000. // +optional FailedResourcePlacements []FailedResourcePlacement `json:"failedPlacements,omitempty"` } -// ResourceIdentifier points to one resource we selected +// ResourceIdentifier identifies one Kubernetes resource. type ResourceIdentifier struct { // Group is the group name of the selected resource. // +required @@ -158,35 +175,42 @@ type ResourceIdentifier struct { // +required Name string `json:"name"` - // Namespace is the namespace of the resource, the resource is cluster scoped if the value is empty. + // Namespace is the namespace of the resource. Empty if the resource is cluster scoped. // +optional Namespace string `json:"namespace,omitempty"` } -// FailedResourcePlacement shows the failure details of a failed resource placement. +// FailedResourcePlacement contains the failure details of a failed resource placement. type FailedResourcePlacement struct { + // The resource failed to be placed. + // +required ResourceIdentifier `json:",inline"` - // ClusterName is the name of the cluster that this resource is placed on. + // Name of the member cluster that the resource is placed to. // +required ClusterName string `json:"clusterName"` - // Condition contains the failed condition status for this failed to place resource. + // The failed condition status. // +required Condition metav1.Condition `json:"condition"` } -// ResourcePlacementConditionType identifies a specific condition on a workload. +// ResourcePlacementConditionType defines a specific condition of a resource placement. type ResourcePlacementConditionType string const ( - // ResourcePlacementConditionTypeScheduled indicates if we have successfully identified the set of clusters on which - // the selected resources should run and created work CRs in the per-cluster namespace. - // its conditionStatus can be "True" == Scheduled, "False" == Failed to Schedule + // ResourcePlacementConditionTypeScheduled indicates whether we have selected at least one resource to be placed to at least one member cluster and created work CRs under the corresponding per-cluster namespaces (i.e., fleet-member-). + // Its condition status can be one of the following: + // - "True" means we have selected at least one resource, targeted at least one member cluster and created the work CRs. + // - "False" means we have selected zero resources, zero target clusters, or failed to create the work CRs. + // - "Unknown" otherwise. ResourcePlacementConditionTypeScheduled ResourcePlacementConditionType = "Scheduled" - // ResourcePlacementStatusConditionTypeApplied indicates if the referenced workload is applied on the selected member cluster. - // its conditionStatus can be "True" == All referenced workloads are applied, "False" == Not all are applied + // ResourcePlacementStatusConditionTypeApplied indicates whether the selected member clusters have received the work CRs and applied the selected resources locally. + // Its condition status can be one of the following: + // - "True" means all the selected resources are successfully applied to all the target clusters. + // - "False" means some of them have failed. + // - "Unknown" otherwise. ResourcePlacementStatusConditionTypeApplied ResourcePlacementConditionType = "Applied" ) diff --git a/apis/v1alpha1/commons.go b/apis/v1alpha1/commons.go index 137e0e258..7e75411ea 100644 --- a/apis/v1alpha1/commons.go +++ b/apis/v1alpha1/commons.go @@ -58,6 +58,11 @@ type AgentStatus struct { // +required Type AgentType `json:"type"` + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // Conditions is an array of current observed conditions for the member agent. // +optional Conditions []metav1.Condition `json:"conditions,omitempty"` @@ -71,14 +76,16 @@ type AgentStatus struct { type AgentConditionType string const ( - // AgentJoined indicates the join condition of the given member agent. Its condition status can be one of the following: - // "True" means the member agent has joined. - // "False" means the member agent has left. - // "Unknown" means the member agent is joining or leaving or in an unknown status. + // AgentJoined indicates the join condition of the given member agent. + // Its condition status can be one of the following: + // - "True" means the member agent has joined. + // - "False" means the member agent has left. + // - "Unknown" means the member agent is joining or leaving or in an unknown status. AgentJoined AgentConditionType = "Joined" - // AgentHealthy indicates the health condition of the given member agent. Its condition status can be one of the following: - // "True" means the member agent is healthy. - // "False" means the member agent is unhealthy. - // "Unknown" means the member agent has an unknown health status. + // AgentHealthy indicates the health condition of the given member agent. + // Its condition status can be one of the following: + // - "True" means the member agent is healthy. + // - "False" means the member agent is unhealthy. + // - "Unknown" means the member agent has an unknown health status. AgentHealthy AgentConditionType = "Healthy" ) diff --git a/apis/v1alpha1/internalmembercluster_types.go b/apis/v1alpha1/internalmembercluster_types.go index cb9918db3..2ef806454 100644 --- a/apis/v1alpha1/internalmembercluster_types.go +++ b/apis/v1alpha1/internalmembercluster_types.go @@ -20,7 +20,12 @@ type InternalMemberCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec InternalMemberClusterSpec `json:"spec"` + // The desired state of InternalMemberCluster. + // +required + Spec InternalMemberClusterSpec `json:"spec"` + + // The observed status of InternalMemberCluster. + // +optional Status InternalMemberClusterStatus `json:"status,omitempty"` } diff --git a/apis/v1alpha1/membercluster_types.go b/apis/v1alpha1/membercluster_types.go index eecf7997b..cd493190b 100644 --- a/apis/v1alpha1/membercluster_types.go +++ b/apis/v1alpha1/membercluster_types.go @@ -22,7 +22,12 @@ type MemberCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec MemberClusterSpec `json:"spec"` + // The desired state of MemberCluster. + // +required + Spec MemberClusterSpec `json:"spec"` + + // The observed status of MemberCluster. + // +optional Status MemberClusterStatus `json:"status,omitempty"` } @@ -50,6 +55,11 @@ type MemberClusterSpec struct { // MemberClusterStatus defines the observed status of MemberCluster. type MemberClusterStatus struct { + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // Conditions is an array of current observed conditions for the member cluster. // +optional Conditions []metav1.Condition `json:"conditions"` @@ -67,22 +77,25 @@ type MemberClusterStatus struct { type MemberClusterConditionType string const ( - // ConditionTypeMemberClusterReadyToJoin indicates the readiness condition of the given member cluster for joining the hub cluster. Its condition status can be one of the following: - // "True" means the hub cluster is ready for the member cluster to join. - // "False" means the hub cluster is not ready for the member cluster to join. - // "Unknown" means it is unknown whether the hub cluster is ready for the member cluster to join. + // ConditionTypeMemberClusterReadyToJoin indicates the readiness condition of the given member cluster for joining the hub cluster. + // Its condition status can be one of the following: + // - "True" means the hub cluster is ready for the member cluster to join. + // - "False" means the hub cluster is not ready for the member cluster to join. + // - "Unknown" means it is unknown whether the hub cluster is ready for the member cluster to join. ConditionTypeMemberClusterReadyToJoin MemberClusterConditionType = "ReadyToJoin" - // ConditionTypeMemberClusterJoined indicates the join condition of the given member cluster. Its condition status can be one of the following: - // "True" means all the agents on the member cluster have joined. - // "False" means all the agents on the member cluster have left. - // "Unknown" means not all the agents have joined or left. + // ConditionTypeMemberClusterJoined indicates the join condition of the given member cluster. + // Its condition status can be one of the following: + // - "True" means all the agents on the member cluster have joined. + // - "False" means all the agents on the member cluster have left. + // - "Unknown" means not all the agents have joined or left. ConditionTypeMemberClusterJoined MemberClusterConditionType = "Joined" - // ConditionTypeMemberClusterHealthy indicates the health condition of the given member cluster. Its condition status can be one of the following: - // "True" means the member cluster is healthy. - // "False" means the member cluster is unhealthy. - // "Unknown" means the member cluster has an unknown health status. + // ConditionTypeMemberClusterHealthy indicates the health condition of the given member cluster. + // Its condition status can be one of the following: + // - "True" means the member cluster is healthy. + // - "False" means the member cluster is unhealthy. + // - "Unknown" means the member cluster has an unknown health status. // NOTE: This condition type is currently unused. ConditionTypeMemberClusterHealthy MemberClusterConditionType = "Healthy" ) diff --git a/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml b/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml index b3f7958a6..33cee1548 100644 --- a/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml +++ b/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml @@ -20,16 +20,36 @@ spec: scope: Cluster versions: - additionalPrinterColumns: + - jsonPath: .metadata.generation + name: Gen + type: string + - jsonPath: .status.conditions[?(@.type=="Scheduled")].status + name: Scheduled + type: string + - jsonPath: .status.conditions[?(@.type=="Scheduled")].observedGeneration + name: ScheduledGen + type: string + - jsonPath: .status.conditions[?(@.type=="Applied")].status + name: Applied + type: string + - jsonPath: .status.conditions[?(@.type=="Applied")].observedGeneration + name: AppliedGen + type: string - jsonPath: .metadata.creationTimestamp name: Age type: date name: v1alpha1 schema: openAPIV3Schema: - description: 'ClusterResourcePlacement is used to place cluster scoped resources - or ALL the resources in a namespace onto one or more member clusters in - a fleet. Users cannot select resources in a system reserved namespace. System - reserved namespaces are: kube-system, fleet-system, fleet-work-*.' + description: 'ClusterResourcePlacement is used to select cluster scoped resources, + including built-in resources and custom resources, and placement them onto + selected member clusters in a fleet. If a namespace is selected, ALL the + resources under the namespace are placed to the target clusters. Note that + you can''t select the following resources: - reserved namespaces including: + default, kube-* (reserved for Kubernetes system namespaces), fleet-* (reserved + for fleet system namespaces). - reserved fleet resource types including: + MemberCluster, InternalMemberCluster, ClusterResourcePlacement, MultiClusterService, + ServiceImport, etc.' properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -44,32 +64,32 @@ spec: metadata: type: object spec: - description: Spec represents the desired behavior of ClusterResourcePlacement. + description: The desired state of ClusterResourcePlacement. properties: policy: - description: Policy represents the placement policy to select clusters - to place all the selected resources. If unspecified, all the joined - clusters are selected. + description: Policy defines how to select member clusters to place + the selected resources. If unspecified, all the joined member clusters + are selected. properties: affinity: - description: Affinity represents the selected resources' scheduling - constraints. If not set, the entire fleet can be scheduling - candidate. + description: Affinity contains cluster affinity scheduling rules. + Defines which member clusters to place the selected resources. properties: clusterAffinity: - description: ClusterAffinity describes cluster affinity scheduling - rules for the resources. + description: ClusterAffinity contains cluster affinity scheduling + rules for the selected resources. properties: clusterSelectorTerms: description: ClusterSelectorTerms is a list of cluster - selector terms. The terms are `ORed`. kubebuilder:validation:MaxItems=10 + selector terms. The terms are `ORed`. items: - description: ClusterSelectorTerm represents the requirements - to selected clusters. + description: ClusterSelectorTerm contains the requirements + to select clusters. properties: labelSelector: description: LabelSelector is a label query over - the clusters. + all the joined member clusters. Clusters matching + the query are selected. properties: matchExpressions: description: matchExpressions is a list of label @@ -121,38 +141,44 @@ spec: required: - labelSelector type: object + maxItems: 10 type: array type: object type: object clusterNames: description: ClusterNames contains a list of names of MemberCluster - to place the selected resources to. If the list is not empty, - Affinity is ignored. kubebuilder:validation:MaxItems=100 + to place the selected resources. If the list is not empty, Affinity + is ignored. items: type: string + maxItems: 100 type: array type: object resourceSelectors: - description: ResourceSelectors is used to select cluster scoped resources. - The selectors are `ORed`. kubebuilder:validation:MaxItems=100 + description: ResourceSelectors is an array of selectors used to select + cluster scoped resources. The selectors are `ORed`. You can have + 1-100 selectors. items: - description: 'ClusterResourceSelector is used to specify cluster - scoped resources to be selected. Note: When the cluster resource - is of type `namespace`, ALL the resources in this namespace are - selected. All the fields present in this structure are `ANDed`.' + description: ClusterResourceSelector is used to select cluster scoped + resources as the target resources to be placed. If a namespace + is selected, ALL the resources under the namespace are selected + automatically. All the fields are `ANDed`. In other words, a resource + must match all the fields to be selected. properties: group: - description: Group is the group name of the target resource. + description: Group name of the cluster-scoped resource. Use + an empty string to select resources under the core API group + (e.g., namespaces). type: string kind: - description: 'Kind is the kind of the target resources. Note: - When the `kind` field is `namespace` then all the resources - inside that namespace is selected.' + description: 'Kind of the cluster-scoped resource. Note: When + `Kind` is `namespace`, ALL the resources under the selected + namespaces are selected.' type: string labelSelector: - description: labelSelector spells out a label query over a set - of resources. This field is mutually exclusive with the `name` - field. + description: A label query over all the cluster-scoped resources. + Resources matching the query are selected. Note that namespace-scoped + resources can't be selected even if they match the query. properties: matchExpressions: description: matchExpressions is a list of label selector @@ -196,28 +222,28 @@ spec: type: object type: object name: - description: Name is the name of the target resource. Default - is empty, which means selecting all resources. This field - is mutually exclusive with the `labelSelector` field. + description: Name of the cluster-scoped resource. type: string version: - description: Version is the version of the target resource. + description: Version of the cluster-scoped resource. type: string required: - group - kind - version type: object + maxItems: 100 + minItems: 1 type: array required: - resourceSelectors type: object status: - description: Most recently observed status of the ClusterResourcePlacement. + description: The observed status of ClusterResourcePlacement. properties: conditions: - description: Conditions field contains the overall condition statuses - for this resource. + description: Conditions is an array of current observed conditions + for ClusterResourcePlacement. items: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct @@ -289,19 +315,19 @@ spec: - type x-kubernetes-list-type: map failedPlacements: - description: FailedResourcePlacements is a list of all failed to place - resources status. kubebuilder:validation:MaxItems=1000 + description: FailedResourcePlacements is a list of all the resources + failed to be placed to the given clusters. Note that we only include + 1000 failed resource placements even if there are more than 1000. items: - description: FailedResourcePlacement shows the failure details of - a failed resource placement. + description: FailedResourcePlacement contains the failure details + of a failed resource placement. properties: clusterName: - description: ClusterName is the name of the cluster that this - resource is placed on. + description: Name of the member cluster that the resource is + placed to. type: string condition: - description: Condition contains the failed condition status - for this failed to place resource. + description: The failed condition status. properties: lastTransitionTime: description: lastTransitionTime is the last time the condition @@ -370,8 +396,8 @@ spec: description: Name of the target resource. type: string namespace: - description: Namespace is the namespace of the resource, the - resource is cluster scoped if the value is empty. + description: Namespace is the namespace of the resource. Empty + if the resource is cluster scoped. type: string version: description: Version is the version of the selected resource. @@ -382,12 +408,13 @@ spec: - kind - name type: object + maxItems: 1000 type: array selectedResources: description: SelectedResources contains a list of resources selected - by the resource selector. + by ResourceSelectors. items: - description: ResourceIdentifier points to one resource we selected + description: ResourceIdentifier identifies one Kubernetes resource. properties: group: description: Group is the group name of the selected resource. @@ -399,8 +426,8 @@ spec: description: Name of the target resource. type: string namespace: - description: Namespace is the namespace of the resource, the - resource is cluster scoped if the value is empty. + description: Namespace is the namespace of the resource. Empty + if the resource is cluster scoped. type: string version: description: Version is the version of the selected resource. @@ -411,14 +438,12 @@ spec: type: object type: array targetClusters: - description: TargetClusters contains a list of member cluster names + description: TargetClusters contains a list of names of member clusters selected by PlacementPolicy. Note that the clusters must be both joined and meeting PlacementPolicy. items: type: string type: array - required: - - conditions type: object required: - spec diff --git a/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml b/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml index 77560bf49..2660cad5e 100644 --- a/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml +++ b/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml @@ -26,9 +26,9 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: InternalMemberCluster is used by the hub agent to control the - state of the member agents, and used by the member agents to report their - status. + description: InternalMemberCluster is used by hub agent to notify the member + agents about the member cluster state changes, and is used by the member + agents to report their status. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -43,8 +43,7 @@ spec: metadata: type: object spec: - description: InternalMemberClusterSpec defines the desired state of InternalMemberCluster. - Set by the hub agent. + description: The desired state of InternalMemberCluster. properties: heartbeatPeriodSeconds: default: 60 @@ -61,8 +60,7 @@ spec: - state type: object status: - description: InternalMemberClusterStatus defines the observed state of - InternalMemberCluster. + description: The observed status of InternalMemberCluster. properties: agentStatus: description: AgentStatus is an array of current observed status, each @@ -146,6 +144,9 @@ spec: - type type: object type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map lastReceivedHeartbeat: description: Last time we received a heartbeat from the member agent. @@ -160,6 +161,7 @@ spec: type: array resourceUsage: description: The current observed resource usage of the member cluster. + It is populated by the member agent. properties: allocatable: additionalProperties: diff --git a/config/crd/bases/fleet.azure.com_memberclusters.yaml b/config/crd/bases/fleet.azure.com_memberclusters.yaml index 84a546d5b..f57dcfb56 100644 --- a/config/crd/bases/fleet.azure.com_memberclusters.yaml +++ b/config/crd/bases/fleet.azure.com_memberclusters.yaml @@ -45,7 +45,7 @@ spec: metadata: type: object spec: - description: MemberClusterSpec defines the desired state of MemberCluster. + description: The desired state of MemberCluster. properties: heartbeatPeriodSeconds: default: 60 @@ -92,7 +92,7 @@ spec: - state type: object status: - description: MemberClusterStatus defines the observed status of MemberCluster. + description: The observed status of MemberCluster. properties: agentStatus: description: AgentStatus is an array of current observed status, each @@ -176,6 +176,9 @@ spec: - type type: object type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map lastReceivedHeartbeat: description: Last time we received a heartbeat from the member agent. @@ -258,8 +261,12 @@ spec: - type type: object type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map resourceUsage: description: The current observed resource usage of the member cluster. + It is copied from the corresponding InternalMemberCluster object. properties: allocatable: additionalProperties: