diff --git a/apis/v1alpha1/commons.go b/apis/v1alpha1/commons.go index 1ce75bca0..137e0e258 100644 --- a/apis/v1alpha1/commons.go +++ b/apis/v1alpha1/commons.go @@ -5,7 +5,10 @@ Licensed under the MIT license. package v1alpha1 -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) type ClusterState string @@ -18,15 +21,29 @@ const ( MemberClusterKind = "MemberCluster" MemberClusterResource = "memberclusters" InternalMemberClusterKind = "InternalMemberCluster" - ClusterResourcePlacementKind = "ClusterResourcePlacement" ClusterResourcePlacementResource = "clusterresourceplacements" ) -// AgentType defines agent/binary running in the member cluster. +// ResourceUsage contains the observed resource usage of a member cluster. +type ResourceUsage struct { + // Capacity represents the total resource capacity of all the nodes on a member cluster. + // +optional + Capacity v1.ResourceList `json:"capacity,omitempty"` + + // Allocatable represents the total resources of all the nodes on a member cluster that are available for scheduling. + // +optional + Allocatable v1.ResourceList `json:"allocatable,omitempty"` + + // When the resource usage is observed. + // +optional + ObservationTime metav1.Time `json:"observationTime,omitempty"` +} + +// AgentType defines a type of agent/binary running in a member cluster. type AgentType string const ( - // MemberAgent (core) handles the join/unjoin and work orchestration of the multi-clusters. + // MemberAgent (core) handles member cluster joining/leaving as well as k8s object placement from hub to member clusters. MemberAgent AgentType = "MemberAgent" // MultiClusterServiceAgent (networking) is responsible for exposing multi-cluster services via L4 load // balancer. @@ -35,17 +52,17 @@ const ( ServiceExportImportAgent AgentType = "ServiceExportImportAgent" ) -// AgentStatus contains status information received for the particular agent type. +// AgentStatus defines the observed status of the member agent of the given type. type AgentStatus struct { - // Type of agent type. + // Type of the member agent. // +required Type AgentType `json:"type"` - // Conditions field contains the different condition statuses for this member cluster, eg join and health status. + // Conditions is an array of current observed conditions for the member agent. // +optional Conditions []metav1.Condition `json:"conditions,omitempty"` - // Last time we got the heartbeat. + // Last time we received a heartbeat from the member agent. // +optional LastReceivedHeartbeat metav1.Time `json:"lastReceivedHeartbeat,omitempty"` } @@ -54,10 +71,14 @@ type AgentStatus struct { type AgentConditionType string const ( - // AgentJoined is used to track the join state of the agent. - // Its conditionStatus can be "True" == Joined, "Unknown" == Joining/Leaving, "False" == Left. + // 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 is used to track the Health state of the agent. - // Its conditionStatus can be "True" == Healthy, "False" == UnHealthy. "Unknown" is unused. + // 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 2bb624331..cb9918db3 100644 --- a/apis/v1alpha1/internalmembercluster_types.go +++ b/apis/v1alpha1/internalmembercluster_types.go @@ -6,18 +6,16 @@ Licensed under the MIT license. package v1alpha1 import ( - v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// InternalMemberCluster is used by the hub agent to control the member cluster state. -// Member agent watches this CR and updates its status. - // +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Namespaced,categories={fleet},shortName=internalcluster +// +kubebuilder:resource:scope=Namespaced,categories={fleet},shortName=imc // +kubebuilder:subresource:status // +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date + +// 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. type InternalMemberCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -26,46 +24,34 @@ type InternalMemberCluster struct { Status InternalMemberClusterStatus `json:"status,omitempty"` } -// InternalMemberClusterSpec defines the desired state of InternalMemberCluster for the hub agent. +// InternalMemberClusterSpec defines the desired state of InternalMemberCluster. Set by the hub agent. type InternalMemberClusterSpec struct { - // State indicates the state of the member cluster. - // +kubebuilder:validation:Required,Enum=Join;Leave + + // The desired state of the member cluster. Possible values: Join, Leave. + // +required State ClusterState `json:"state"` - // HeartbeatPeriodSeconds indicates how often (in seconds) for the member cluster to send a heartbeat. Default to 60 seconds. Minimum value is 1. + // +kubebuilder:default=60 + // +kubebuilder:validation:Minimum:1 + // +kubebuilder:validation:Maximum:600 + // How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes. // +optional - // +kubebuilder:default=60 - HeartbeatPeriodSeconds int32 `json:"leaseDurationSeconds,omitempty"` + HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"` } // InternalMemberClusterStatus defines the observed state of InternalMemberCluster. type InternalMemberClusterStatus struct { - // Resource usage collected from member cluster. + // The current observed resource usage of the member cluster. It is populated by the member agent. // +optional ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"` - // AgentStatus field contains the status for each agent running in the member cluster. + // AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster. // +optional AgentStatus []AgentStatus `json:"agentStatus,omitempty"` } -// ResourceUsage represents the resource usage collected from the member cluster and its observation time. -type ResourceUsage struct { - // Capacity represents the total resource capacity from all nodeStatues on the member cluster. - // +optional - Capacity v1.ResourceList `json:"capacity,omitempty"` - - // Allocatable represents the total allocatable resources on the member cluster. - // +optional - Allocatable v1.ResourceList `json:"allocatable,omitempty"` - - // The time we observe the member cluster resource usage, including capacity and allocatable. - // +optional - ObservationTime metav1.Time `json:"observationTime,omitempty"` -} - //+kubebuilder:object:root=true // InternalMemberClusterList contains a list of InternalMemberCluster. diff --git a/apis/v1alpha1/membercluster_types.go b/apis/v1alpha1/membercluster_types.go index fd7efe40e..eecf7997b 100644 --- a/apis/v1alpha1/membercluster_types.go +++ b/apis/v1alpha1/membercluster_types.go @@ -11,14 +11,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// MemberCluster is a resource created in the hub cluster to represent a member cluster within a fleet. - // +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,categories={fleet},shortName=membercluster +// +kubebuilder:resource:scope=Cluster,categories={fleet},shortName=mc // +kubebuilder:subresource:status -// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ConditionTypeMemberClusterJoin")].status`,name="Joined",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Joined")].status`,name="Joined",type=string // +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date -// +kubebuilder:printcolumn:JSONPath=`.metadata.label[fleet.azure.com/clusterHealth]`,name="HealthStatus",type=string + +// MemberCluster is a resource created in the hub cluster to represent a member cluster within a fleet. type MemberCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -29,52 +28,63 @@ type MemberCluster struct { // MemberClusterSpec defines the desired state of MemberCluster. type MemberClusterSpec struct { - // State indicates the desired state of the member cluster. - // +kubebuilder:validation:Required,Enum=Join;Leave - State ClusterState `json:"state"` - // Identity used by the member cluster to contact the hub cluster. - // The hub cluster will create the minimal required permission for this identity. + // The desired state of the member cluster. Possible values: Join, Leave. + // +required + State ClusterState `json:"state"` + // The identity used by the member cluster to access the hub cluster. + // The hub agents deployed on the hub cluster will automatically grant the minimal required permissions to this identity for the member agents deployed on the member cluster to access the hub cluster. // +required Identity rbacv1.Subject `json:"identity"` - // HeartbeatPeriodSeconds indicates how often (in seconds) for the member cluster to send a heartbeat. Default to 60 seconds. Minimum value is 1. - // +kubebuilder:default=60 + // +kubebuilder:validation:Minimum:1 + // +kubebuilder:validation:Maximum:600 + + // How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes. // +optional - HeartbeatPeriodSeconds int32 `json:"leaseDurationSeconds,omitempty"` + HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"` } -// MemberClusterStatus defines the observed state of MemberCluster. +// MemberClusterStatus defines the observed status of MemberCluster. type MemberClusterStatus struct { - // Conditions is an array of current observed conditions for this member cluster. - // +required + // Conditions is an array of current observed conditions for the member cluster. + // +optional Conditions []metav1.Condition `json:"conditions"` - // Resource usage collected from member cluster. + // The current observed resource usage of the member cluster. It is copied from the corresponding InternalMemberCluster object. // +optional ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"` - // AgentStatus field contains the status for each agent running in the member cluster. + // AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster. // +optional AgentStatus []AgentStatus `json:"agentStatus,omitempty"` } +// MemberClusterConditionType defines a specific condition of a member cluster. +type MemberClusterConditionType string + const ( - // ConditionTypeMemberClusterReadyToJoin is used to track the readiness of the hub cluster - // controller to accept the new member cluster. - // its conditionStatus can only be "True" == ReadyToJoin - ConditionTypeMemberClusterReadyToJoin string = "ReadyToJoin" - - // ConditionTypeMemberClusterJoin is used to track the join state of the memberCluster. - // its conditionStatus can be "True" == Joined, "Unknown" == Joining/Leaving, "False" == Left - ConditionTypeMemberClusterJoin string = "Joined" - - // ConditionTypeMemberClusterHealth is used to track the Health state of the MemberCluster. - // its conditionStatus can be "True" == Healthy, "Unknown" == Health degraded, "False" == UnHealthy - ConditionTypeMemberClusterHealth string = "Healthy" + // 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 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. + // NOTE: This condition type is currently unused. + ConditionTypeMemberClusterHealthy MemberClusterConditionType = "Healthy" ) //+kubebuilder:object:root=true diff --git a/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml b/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml index 5490c11d4..b3f7958a6 100644 --- a/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml +++ b/config/crd/bases/fleet.azure.com_clusterresourceplacements.yaml @@ -48,8 +48,8 @@ spec: properties: policy: description: Policy represents the placement policy to select clusters - to place all the selected resources. Default is place to the entire - fleet if this field is omitted. + to place all the selected resources. If unspecified, all the joined + clusters are selected. properties: affinity: description: Affinity represents the selected resources' scheduling @@ -125,9 +125,9 @@ spec: type: object type: object clusterNames: - description: ClusterNames is a request to schedule the selected - resource to a list of member clusters. If exists, we only place - the resources within the clusters in this list. kubebuilder:validation:MaxItems=100 + 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 items: type: string type: array @@ -384,8 +384,8 @@ spec: type: object type: array selectedResources: - description: SelectedResources is a list of the resources the resource - selector selects. + description: SelectedResources contains a list of resources selected + by the resource selector. items: description: ResourceIdentifier points to one resource we selected properties: @@ -411,8 +411,9 @@ spec: type: object type: array targetClusters: - description: TargetClusters is a list of cluster names that this resource - should run on. + description: TargetClusters contains a list of member cluster names + selected by PlacementPolicy. Note that the clusters must be both + joined and meeting PlacementPolicy. items: type: string type: array diff --git a/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml b/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml index c864ff0dd..77560bf49 100644 --- a/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml +++ b/config/crd/bases/fleet.azure.com_internalmemberclusters.yaml @@ -15,7 +15,7 @@ spec: listKind: InternalMemberClusterList plural: internalmemberclusters shortNames: - - internalcluster + - imc singular: internalmembercluster scope: Namespaced versions: @@ -26,6 +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. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -40,14 +43,19 @@ spec: metadata: type: object spec: - description: InternalMemberClusterSpec defines the desired state of InternalMemberCluster - for the hub agent. + description: InternalMemberClusterSpec defines the desired state of InternalMemberCluster. + Set by the hub agent. properties: - leaseDurationSeconds: + heartbeatPeriodSeconds: default: 60 + description: 'How often (in seconds) for the member cluster to send + a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. + Max: 10 minutes.' format: int32 type: integer state: + description: 'The desired state of the member cluster. Possible values: + Join, Leave.' type: string required: - state @@ -57,15 +65,15 @@ spec: InternalMemberCluster. properties: agentStatus: - description: AgentStatus field contains the status for each agent - running in the member cluster. + description: AgentStatus is an array of current observed status, each + corresponding to one member agent running in the member cluster. items: - description: AgentStatus contains status information received for - the particular agent type. + description: AgentStatus defines the observed status of the member + agent of the given type. properties: conditions: - description: Conditions field contains the different condition - statuses for this member cluster, eg join and health status. + description: Conditions is an array of current observed conditions + for the member agent. items: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct @@ -139,18 +147,19 @@ spec: type: object type: array lastReceivedHeartbeat: - description: Last time we got the heartbeat. + description: Last time we received a heartbeat from the member + agent. format: date-time type: string type: - description: Type of agent type. + description: Type of the member agent. type: string required: - type type: object type: array resourceUsage: - description: Resource usage collected from member cluster. + description: The current observed resource usage of the member cluster. properties: allocatable: additionalProperties: @@ -159,8 +168,8 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: Allocatable represents the total allocatable resources - on the member cluster. + description: Allocatable represents the total resources of all + the nodes on a member cluster that are available for scheduling. type: object capacity: additionalProperties: @@ -169,12 +178,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: Capacity represents the total resource capacity from - all nodeStatues on the member cluster. + description: Capacity represents the total resource capacity of + all the nodes on a member cluster. type: object observationTime: - description: The time we observe the member cluster resource usage, - including capacity and allocatable. + description: When the resource usage is observed. format: date-time type: string type: object diff --git a/config/crd/bases/fleet.azure.com_memberclusters.yaml b/config/crd/bases/fleet.azure.com_memberclusters.yaml index 0cf5ba196..84a546d5b 100644 --- a/config/crd/bases/fleet.azure.com_memberclusters.yaml +++ b/config/crd/bases/fleet.azure.com_memberclusters.yaml @@ -15,23 +15,22 @@ spec: listKind: MemberClusterList plural: memberclusters shortNames: - - membercluster + - mc singular: membercluster scope: Cluster versions: - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=="ConditionTypeMemberClusterJoin")].status + - jsonPath: .status.conditions[?(@.type=="Joined")].status name: Joined type: string - jsonPath: .metadata.creationTimestamp name: Age type: date - - jsonPath: .metadata.label[fleet.azure.com/clusterHealth] - name: HealthStatus - type: string name: v1alpha1 schema: openAPIV3Schema: + description: MemberCluster is a resource created in the hub cluster to represent + a member cluster within a fleet. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -48,10 +47,18 @@ spec: spec: description: MemberClusterSpec defines the desired state of MemberCluster. properties: + heartbeatPeriodSeconds: + default: 60 + description: 'How often (in seconds) for the member cluster to send + a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. + Max: 10 minutes.' + format: int32 + type: integer identity: - description: Subject contains a reference to the object or user identities - a role binding applies to. This can either hold a direct API object - reference, or a value for non-objects such as user and group names. + description: The identity used by the member cluster to access the + hub cluster. The hub agents deployed on the hub cluster will automatically + grant the minimal required permissions to this identity for the + member agents deployed on the member cluster to access the hub cluster. properties: apiGroup: description: APIGroup holds the API group of the referenced subject. @@ -76,29 +83,27 @@ spec: - kind - name type: object - leaseDurationSeconds: - default: 60 - format: int32 - type: integer state: + description: 'The desired state of the member cluster. Possible values: + Join, Leave.' type: string required: - identity - state type: object status: - description: MemberClusterStatus defines the observed state of MemberCluster. + description: MemberClusterStatus defines the observed status of MemberCluster. properties: agentStatus: - description: AgentStatus field contains the status for each agent - running in the member cluster. + description: AgentStatus is an array of current observed status, each + corresponding to one member agent running in the member cluster. items: - description: AgentStatus contains status information received for - the particular agent type. + description: AgentStatus defines the observed status of the member + agent of the given type. properties: conditions: - description: Conditions field contains the different condition - statuses for this member cluster, eg join and health status. + description: Conditions is an array of current observed conditions + for the member agent. items: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct @@ -172,11 +177,12 @@ spec: type: object type: array lastReceivedHeartbeat: - description: Last time we got the heartbeat. + description: Last time we received a heartbeat from the member + agent. format: date-time type: string type: - description: Type of agent type. + description: Type of the member agent. type: string required: - type @@ -184,7 +190,7 @@ spec: type: array conditions: description: Conditions is an array of current observed conditions - for this member cluster. + for the member cluster. items: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct @@ -253,7 +259,7 @@ spec: type: object type: array resourceUsage: - description: Resource usage collected from member cluster. + description: The current observed resource usage of the member cluster. properties: allocatable: additionalProperties: @@ -262,8 +268,8 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: Allocatable represents the total allocatable resources - on the member cluster. + description: Allocatable represents the total resources of all + the nodes on a member cluster that are available for scheduling. type: object capacity: additionalProperties: @@ -272,17 +278,14 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: Capacity represents the total resource capacity from - all nodeStatues on the member cluster. + description: Capacity represents the total resource capacity of + all the nodes on a member cluster. type: object observationTime: - description: The time we observe the member cluster resource usage, - including capacity and allocatable. + description: When the resource usage is observed. format: date-time type: string type: object - required: - - conditions type: object required: - spec diff --git a/examples/fleet_v1alpha1_membercluster.yaml b/examples/fleet_v1alpha1_membercluster.yaml index fa17f5c39..2c792a18b 100644 --- a/examples/fleet_v1alpha1_membercluster.yaml +++ b/examples/fleet_v1alpha1_membercluster.yaml @@ -9,4 +9,4 @@ spec: kind: ServiceAccount namespace: fleet-system apiGroup: "" - leaseDurationSeconds: 30 + heartbeatPeriodSeconds: 30 diff --git a/pkg/controllers/clusterresourceplacement/cluster_selector.go b/pkg/controllers/clusterresourceplacement/cluster_selector.go index 853d1896e..53ad51ccd 100644 --- a/pkg/controllers/clusterresourceplacement/cluster_selector.go +++ b/pkg/controllers/clusterresourceplacement/cluster_selector.go @@ -140,6 +140,6 @@ func convertObjToMemberCluster(obj runtime.Object) (*fleetv1alpha1.MemberCluster // isClusterEligible checks whether a member cluster is eligible to be selected in CRP. func isClusterEligible(mc *fleetv1alpha1.MemberCluster) bool { // TODO: check the health condition of the cluster when its aggregated - joinCond := mc.GetCondition(fleetv1alpha1.ConditionTypeMemberClusterJoin) + joinCond := mc.GetCondition(string(fleetv1alpha1.ConditionTypeMemberClusterJoined)) return joinCond != nil && joinCond.Status == metav1.ConditionTrue && joinCond.ObservedGeneration == mc.Generation } diff --git a/pkg/controllers/internalmembercluster/member_controller_test.go b/pkg/controllers/internalmembercluster/member_controller_test.go index 147981092..eb46b6e71 100644 --- a/pkg/controllers/internalmembercluster/member_controller_test.go +++ b/pkg/controllers/internalmembercluster/member_controller_test.go @@ -290,7 +290,7 @@ func TestGetConditionWithType(t *testing.T) { Type: v1alpha1.MemberAgent, Conditions: []metav1.Condition{ { - Type: v1alpha1.ConditionTypeMemberClusterJoin, + Type: string(v1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: eventReasonInternalMemberClusterJoined, }, @@ -301,7 +301,7 @@ func TestGetConditionWithType(t *testing.T) { }, conditionType: string(v1alpha1.AgentJoined), wantedCondition: &metav1.Condition{ - Type: v1alpha1.ConditionTypeMemberClusterJoin, + Type: string(v1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: eventReasonInternalMemberClusterJoined, }, @@ -314,7 +314,7 @@ func TestGetConditionWithType(t *testing.T) { Type: v1alpha1.MemberAgent, Conditions: []metav1.Condition{ { - Type: v1alpha1.ConditionTypeMemberClusterJoin, + Type: string(v1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: eventReasonInternalMemberClusterJoined, }, diff --git a/pkg/controllers/membercluster/membercluster_controller.go b/pkg/controllers/membercluster/membercluster_controller.go index 0af08d9b7..db6af0fb4 100644 --- a/pkg/controllers/membercluster/membercluster_controller.go +++ b/pkg/controllers/membercluster/membercluster_controller.go @@ -338,7 +338,7 @@ func (r *Reconciler) syncInternalMemberClusterStatus(imc *fleetv1alpha1.Internal return } - // TODO: We didn't handle condition type: fleetv1alpha1.ConditionTypeMemberClusterHealth. + // TODO: We didn't handle condition type: fleetv1alpha1.ConditionTypeMemberClusterHealthy. // Copy Agent status. mc.Status.AgentStatus = imc.Status.AgentStatus r.aggregateJoinedCondition(mc) @@ -405,7 +405,7 @@ func (r *Reconciler) aggregateJoinedCondition(mc *fleetv1alpha1.MemberCluster) { func markMemberClusterReadyToJoin(recorder record.EventRecorder, mc apis.ConditionedObj) { klog.V(5).InfoS("markMemberClusterReadyToJoin", "memberCluster", klog.KObj(mc)) newCondition := metav1.Condition{ - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), @@ -425,7 +425,7 @@ func markMemberClusterReadyToJoin(recorder record.EventRecorder, mc apis.Conditi func markMemberClusterJoined(recorder record.EventRecorder, mc apis.ConditionedObj) { klog.V(5).InfoS("markMemberClusterJoined", "memberCluster", klog.KObj(mc)) newCondition := metav1.Condition{ - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: reasonMemberClusterJoined, ObservedGeneration: mc.GetGeneration(), @@ -446,13 +446,13 @@ func markMemberClusterJoined(recorder record.EventRecorder, mc apis.ConditionedO func markMemberClusterLeft(recorder record.EventRecorder, mc apis.ConditionedObj) { klog.V(5).InfoS("markMemberClusterLeft", "memberCluster", klog.KObj(mc)) newCondition := metav1.Condition{ - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionFalse, Reason: reasonMemberClusterLeft, ObservedGeneration: mc.GetGeneration(), } notReadyCondition := metav1.Condition{ - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionFalse, Reason: reasonMemberClusterNotReadyToJoin, ObservedGeneration: mc.GetGeneration(), @@ -473,7 +473,7 @@ func markMemberClusterLeft(recorder record.EventRecorder, mc apis.ConditionedObj func markMemberClusterUnknown(recorder record.EventRecorder, mc apis.ConditionedObj) { klog.V(5).InfoS("markMemberClusterUnknown", "memberCluster", klog.KObj(mc)) newCondition := metav1.Condition{ - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, ObservedGeneration: mc.GetGeneration(), diff --git a/pkg/controllers/membercluster/membercluster_controller_integration_test.go b/pkg/controllers/membercluster/membercluster_controller_integration_test.go index fecceca26..b364e72f1 100644 --- a/pkg/controllers/membercluster/membercluster_controller_integration_test.go +++ b/pkg/controllers/membercluster/membercluster_controller_integration_test.go @@ -94,7 +94,7 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC := fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), @@ -138,7 +138,7 @@ var _ = Describe("Test MemberCluster Controller", func() { var mc fleetv1alpha1.MemberCluster Expect(k8sClient.Get(ctx, memberClusterNamespacedName, &mc)).Should(Succeed()) - joinCondition := mc.GetCondition(fleetv1alpha1.ConditionTypeMemberClusterJoin) + joinCondition := mc.GetCondition(string(fleetv1alpha1.ConditionTypeMemberClusterJoined)) Expect(joinCondition).NotTo(BeNil()) Expect(joinCondition.Status).To(Equal(metav1.ConditionTrue)) Expect(joinCondition.Reason).To(Equal(reasonMemberClusterJoined)) @@ -184,13 +184,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC := fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionFalse, Reason: reasonMemberClusterNotReadyToJoin, ObservedGeneration: mc.GetGeneration(), }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionFalse, Reason: reasonMemberClusterLeft, ObservedGeneration: mc.GetGeneration(), @@ -302,13 +302,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC := fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, ObservedGeneration: mc.GetGeneration(), @@ -345,13 +345,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC = fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, ObservedGeneration: mc.GetGeneration(), @@ -388,13 +388,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC = fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, ObservedGeneration: mc.GetGeneration(), @@ -431,13 +431,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC = fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: reasonMemberClusterJoined, ObservedGeneration: mc.GetGeneration(), @@ -493,13 +493,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC := fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), // should be old observedGeneration }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, ObservedGeneration: mc.GetGeneration(), @@ -535,13 +535,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC = fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionTrue, Reason: reasonMemberClusterReadyToJoin, ObservedGeneration: mc.GetGeneration(), // should be old observedGeneration }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, ObservedGeneration: mc.GetGeneration(), @@ -584,13 +584,13 @@ var _ = Describe("Test MemberCluster Controller", func() { wantMC = fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionFalse, Reason: reasonMemberClusterNotReadyToJoin, ObservedGeneration: mc.GetGeneration(), }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionFalse, Reason: reasonMemberClusterLeft, ObservedGeneration: mc.GetGeneration(), diff --git a/pkg/controllers/membercluster/membercluster_controller_test.go b/pkg/controllers/membercluster/membercluster_controller_test.go index 9b4575acc..1c1b83a01 100644 --- a/pkg/controllers/membercluster/membercluster_controller_test.go +++ b/pkg/controllers/membercluster/membercluster_controller_test.go @@ -618,7 +618,7 @@ func TestMarkMemberClusterJoined(t *testing.T) { // Check expected conditions. expectedConditions := []metav1.Condition{ - {Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, Status: metav1.ConditionTrue, Reason: reasonMemberClusterJoined}, + {Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: reasonMemberClusterJoined}, } for i := range expectedConditions { @@ -685,7 +685,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: reasonMemberClusterJoined, }, @@ -776,12 +776,12 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionFalse, Reason: reasonMemberClusterLeft, }, { - Type: fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterReadyToJoin), Status: metav1.ConditionFalse, Reason: reasonMemberClusterNotReadyToJoin, }, @@ -872,7 +872,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, }, @@ -947,7 +947,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { }, Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, }, @@ -1027,7 +1027,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionTrue, Reason: reasonMemberClusterJoined, }, @@ -1118,7 +1118,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, }, @@ -1191,7 +1191,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, }, @@ -1268,7 +1268,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { Status: fleetv1alpha1.MemberClusterStatus{ Conditions: []metav1.Condition{ { - Type: fleetv1alpha1.ConditionTypeMemberClusterJoin, + Type: string(fleetv1alpha1.ConditionTypeMemberClusterJoined), Status: metav1.ConditionUnknown, Reason: reasonMemberClusterUnknown, }, @@ -1307,7 +1307,7 @@ func TestSyncInternalMemberClusterStatus(t *testing.T) { for testName, tt := range tests { t.Run(testName, func(t *testing.T) { tt.r.syncInternalMemberClusterStatus(tt.internalMemberCluster, tt.memberCluster) - assert.Equal(t, "", cmp.Diff(tt.wantedMemberCluster.GetCondition(fleetv1alpha1.ConditionTypeMemberClusterJoin), tt.memberCluster.GetCondition(fleetv1alpha1.ConditionTypeMemberClusterJoin), cmpopts.IgnoreTypes(time.Time{}))) + assert.Equal(t, "", cmp.Diff(tt.wantedMemberCluster.GetCondition(string(fleetv1alpha1.ConditionTypeMemberClusterJoined)), tt.memberCluster.GetCondition(string(fleetv1alpha1.ConditionTypeMemberClusterJoined)), cmpopts.IgnoreTypes(time.Time{}))) assert.Equal(t, tt.wantedMemberCluster.Status.ResourceUsage, tt.memberCluster.Status.ResourceUsage) assert.Equal(t, tt.wantedMemberCluster.Status.AgentStatus, tt.memberCluster.Status.AgentStatus) }) diff --git a/test/e2e/join_leave_member_test.go b/test/e2e/join_leave_member_test.go index 54f9c45c0..eab4b7b62 100644 --- a/test/e2e/join_leave_member_test.go +++ b/test/e2e/join_leave_member_test.go @@ -64,7 +64,7 @@ var _ = Describe("Join/leave member cluster testing", func() { testutils.WaitConditionInternalMemberCluster(*HubCluster, imc, v1alpha1.AgentJoined, v1.ConditionTrue, 3*testutils.PollTimeout) By("check if member cluster condition is updated to Joined") - testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoin, v1.ConditionTrue, 3*testutils.PollTimeout) + testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoined, v1.ConditionTrue, 3*testutils.PollTimeout) By("update member cluster in the hub cluster") testutils.UpdateMemberClusterState(*HubCluster, mc, v1alpha1.ClusterStateLeave) @@ -76,6 +76,6 @@ var _ = Describe("Join/leave member cluster testing", func() { testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterReadyToJoin, v1.ConditionFalse, 3*testutils.PollTimeout) By("check if member cluster condition is updated to Left") - testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoin, v1.ConditionFalse, 3*testutils.PollTimeout) + testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoined, v1.ConditionFalse, 3*testutils.PollTimeout) }) }) diff --git a/test/e2e/manifests/cluster-kind-member-testing.yaml b/test/e2e/manifests/cluster-kind-member-testing.yaml index 4c7424db1..00d96085b 100644 --- a/test/e2e/manifests/cluster-kind-member-testing.yaml +++ b/test/e2e/manifests/cluster-kind-member-testing.yaml @@ -12,4 +12,4 @@ spec: kind: ServiceAccount namespace: fleet-system apiGroup: "" - leaseDurationSeconds: 30 + heartbeatPeriodSeconds: 30 diff --git a/test/e2e/utils/helper.go b/test/e2e/utils/helper.go index 496466fb3..2b58a9a96 100644 --- a/test/e2e/utils/helper.go +++ b/test/e2e/utils/helper.go @@ -109,12 +109,12 @@ func DeleteMemberCluster(cluster framework.Cluster, mc *v1alpha1.MemberCluster) } // WaitConditionMemberCluster waits for MemberCluster to present on th hub cluster with a specific condition. -func WaitConditionMemberCluster(cluster framework.Cluster, mc *v1alpha1.MemberCluster, conditionName string, status metav1.ConditionStatus, customTimeout time.Duration) { - klog.Infof("Waiting for MemberCluster(%s) condition(%s) status(%s) to be synced", mc.Name, conditionName, status) +func WaitConditionMemberCluster(cluster framework.Cluster, mc *v1alpha1.MemberCluster, conditionType v1alpha1.MemberClusterConditionType, status metav1.ConditionStatus, customTimeout time.Duration) { + klog.Infof("Waiting for MemberCluster(%s) condition(%s) status(%s) to be synced", mc.Name, conditionType, status) gomega.Eventually(func() bool { err := cluster.KubeClient.Get(context.TODO(), types.NamespacedName{Name: mc.Name, Namespace: ""}, mc) gomega.Expect(err).NotTo(gomega.HaveOccurred()) - cond := mc.GetCondition(conditionName) + cond := mc.GetCondition(string(conditionType)) return cond != nil && cond.Status == status }, customTimeout, PollInterval).Should(gomega.Equal(true)) } diff --git a/test/e2e/work_load_test.go b/test/e2e/work_load_test.go index 3e38106e2..a5d482d4d 100644 --- a/test/e2e/work_load_test.go +++ b/test/e2e/work_load_test.go @@ -49,7 +49,7 @@ var _ = Describe("workload orchestration testing", func() { By("check if internal member cluster condition is updated to Joined") testutils.WaitConditionInternalMemberCluster(*HubCluster, imc, v1alpha1.AgentJoined, v1.ConditionTrue, 3*testutils.PollTimeout) By("check if member cluster condition is updated to Joined") - testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoin, v1.ConditionTrue, 3*testutils.PollTimeout) + testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoined, v1.ConditionTrue, 3*testutils.PollTimeout) }) AfterEach(func() { diff --git a/test/integration/manifests/clusters/cluster-a.yaml b/test/integration/manifests/clusters/cluster-a.yaml index 9a5cd7a59..955d23e5c 100644 --- a/test/integration/manifests/clusters/cluster-a.yaml +++ b/test/integration/manifests/clusters/cluster-a.yaml @@ -12,4 +12,4 @@ spec: kind: ServiceAccount namespace: fleet-system apiGroup: "" - leaseDurationSeconds: 30 + heartbeatPeriodSeconds: 30 diff --git a/test/integration/manifests/clusters/cluster-b.yaml b/test/integration/manifests/clusters/cluster-b.yaml index defe94a7a..71aa2d505 100644 --- a/test/integration/manifests/clusters/cluster-b.yaml +++ b/test/integration/manifests/clusters/cluster-b.yaml @@ -12,4 +12,4 @@ spec: kind: ServiceAccount namespace: fleet-system apiGroup: "" - leaseDurationSeconds: 30 \ No newline at end of file + heartbeatPeriodSeconds: 30 \ No newline at end of file diff --git a/test/integration/utils_test.go b/test/integration/utils_test.go index 9ed6a953c..3151f2fcd 100644 --- a/test/integration/utils_test.go +++ b/test/integration/utils_test.go @@ -310,7 +310,7 @@ func markInternalMCLeft(mc fleetv1alpha1.MemberCluster) { By("Marked internal member cluster as Left") Eventually(func() bool { Expect(k8sClient.Get(ctx, types.NamespacedName{Name: mc.Name}, &mc)).Should(Succeed()) - joinCond := mc.GetCondition(fleetv1alpha1.ConditionTypeMemberClusterJoin) + joinCond := mc.GetCondition(string(fleetv1alpha1.ConditionTypeMemberClusterJoined)) By("the MC " + mc.Name + " join condition = " + string(joinCond.Status)) return joinCond.Status == metav1.ConditionFalse }, timeout, interval).Should(BeTrue()) @@ -333,7 +333,7 @@ func markInternalMCJoined(mc fleetv1alpha1.MemberCluster) { By("Marked internal member cluster as joined") Eventually(func() bool { Expect(k8sClient.Get(ctx, types.NamespacedName{Name: mc.Name}, &mc)).Should(Succeed()) - joinCond := mc.GetCondition(fleetv1alpha1.ConditionTypeMemberClusterJoin) + joinCond := mc.GetCondition(string(fleetv1alpha1.ConditionTypeMemberClusterJoined)) if joinCond == nil { return false }