Skip to content

Commit 0f128a1

Browse files
committed
review fixes
1 parent 0dacccf commit 0f128a1

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

apis/v1beta1/vsphereclusteridentity_types.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ const (
2828
VSphereClusterIdentityFinalizer = "vsphereclusteridentity/infrastructure.cluster.x-k8s.io"
2929
)
3030

31-
// VSphereClusterIdentity's CredentialsAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
31+
// VSphereClusterIdentity's Available condition and corresponding reasons that will be used in v1Beta2 API version.
3232
const (
33-
// VSphereClusterIdentityCredentialsAvailableV1Beta2Condition documents the status of the credentials for a VSphereClusterIdentity.
34-
VSphereClusterIdentityCredentialsAvailableV1Beta2Condition = "CredentialsAvailable"
33+
// VSphereClusterIdentityAvailableV1Beta2Condition documents the availability for a VSphereClusterIdentity.
34+
VSphereClusterIdentityAvailableV1Beta2Condition = clusterv1.AvailableV1Beta2Condition
3535

36-
// VSphereClusterIdentityCredentialsAvailableV1Beta2Reason surfaces when the VSphereClusterIdentity credentials are available.
37-
VSphereClusterIdentityCredentialsAvailableV1Beta2Reason = clusterv1.AvailableV1Beta2Reason
36+
// VSphereClusterIdentityAvailableV1Beta2Reason surfaces when the VSphereClusterIdentity is available.
37+
VSphereClusterIdentityAvailableV1Beta2Reason = clusterv1.AvailableV1Beta2Reason
3838

39-
// VSphereClusterIdentityCredentialsSecretNotAvailableV1Beta2Reason surfaces when the VSphereClusterIdentity secret is not available.
40-
VSphereClusterIdentityCredentialsSecretNotAvailableV1Beta2Reason = "SecretNotAvailable"
39+
// VSphereClusterIdentitySecretNotAvailableV1Beta2Reason surfaces when the VSphereClusterIdentity secret is not available.
40+
VSphereClusterIdentitySecretNotAvailableV1Beta2Reason = "SecretNotAvailable"
4141

42-
// VSphereClusterIdentityCredentialsSecretAlreadyInUseV1Beta2Reason surfaces when the VSphereClusterIdentity secret is already in use.
43-
VSphereClusterIdentityCredentialsSecretAlreadyInUseV1Beta2Reason = "SecretAlreadyInUse"
42+
// VSphereClusterIdentitySecretAlreadyInUseV1Beta2Reason surfaces when the VSphereClusterIdentity secret is already in use.
43+
VSphereClusterIdentitySecretAlreadyInUseV1Beta2Reason = "SecretAlreadyInUse"
4444

45-
// VSphereClusterIdentityCredentialsSettingSecretOwnerReferenceFailedV1Beta2Reason surfaces when setting the owner reference on the VSphereClusterIdentity secret failed.
46-
VSphereClusterIdentityCredentialsSettingSecretOwnerReferenceFailedV1Beta2Reason = "SettingSecretOwnerReferenceFailed"
45+
// VSphereClusterIdentitySettingSecretOwnerReferenceFailedV1Beta2Reason surfaces when setting the owner reference on the VSphereClusterIdentity secret failed.
46+
VSphereClusterIdentitySettingSecretOwnerReferenceFailedV1Beta2Reason = "SettingSecretOwnerReferenceFailed"
4747

48-
// VSphereClusterIdentityCredentialsDeletingV1Beta2Reason surfaces when the credentials for a VSphereClusterIdentity are being deleted.
49-
VSphereClusterIdentityCredentialsDeletingV1Beta2Reason = clusterv1.DeletingV1Beta2Reason
48+
// VSphereClusterIdentityDeletingV1Beta2Reason surfaces when the VSphereClusterIdentity is being deleted.
49+
VSphereClusterIdentityDeletingV1Beta2Reason = clusterv1.DeletingV1Beta2Reason
5050
)
5151

5252
// VSphereClusterIdentitySpec contains a secret reference and a group of allowed namespaces.
@@ -80,7 +80,7 @@ type VSphereClusterIdentityStatus struct {
8080
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
8181
type VSphereClusterIdentityV1Beta2Status struct {
8282
// conditions represents the observations of a VSphereClusterIdentity's current state.
83-
// Known condition types are CredentialsAvailable and Paused.
83+
// Known condition types are Available and Paused.
8484
// +optional
8585
// +listType=map
8686
// +listMapKey=type

apis/v1beta1/vspheredeploymentzone_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ const (
9898
// VSphereDeploymentZoneFailureDomainHostsMisconfiguredV1Beta2Reason surfaces when the failure domain's hosts for a VSphereDeploymentZone are misconfigured.
9999
VSphereDeploymentZoneFailureDomainHostsMisconfiguredV1Beta2Reason = "HostsMisconfigured"
100100

101-
// VSphereDeploymentZoneFailureDomainHostsAffinityMisconfiguredV1Beta2Reason surfaces when the failure domain's hosts for a VSphereDeploymentZone are misconfigured.
102-
VSphereDeploymentZoneFailureDomainHostsAffinityMisconfiguredV1Beta2Reason = "HostsAffinityMisconfigured"
103-
104101
// VSphereDeploymentZoneFailureDomainDatastoreNotFoundV1Beta2Reason surfaces when the failure domain's datastore for a VSphereDeploymentZone is not found.
105102
VSphereDeploymentZoneFailureDomainDatastoreNotFoundV1Beta2Reason = "DatastoreNotFound"
106103

config/default/crd/bases/infrastructure.cluster.x-k8s.io_vsphereclusteridentities.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ spec:
451451
conditions:
452452
description: |-
453453
conditions represents the observations of a VSphereClusterIdentity's current state.
454-
Known condition types are Paused.
454+
Known condition types are Available and Paused.
455455
items:
456456
description: Condition contains details for one aspect of the
457457
current state of this API Resource.

controllers/vsphereclusteridentity_controller.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (r clusterIdentityReconciler) Reconcile(ctx context.Context, req reconcile.
103103

104104
if err := patchHelper.Patch(ctx, identity, patch.WithOwnedV1Beta2Conditions{Conditions: []string{
105105
clusterv1.PausedV1Beta2Condition,
106-
infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Condition,
106+
infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
107107
}}); err != nil {
108108
reterr = kerrors.NewAggregate([]error{reterr, err})
109109
}
@@ -122,9 +122,9 @@ func (r clusterIdentityReconciler) Reconcile(ctx context.Context, req reconcile.
122122
if err := r.Client.Get(ctx, secretKey, secret); err != nil {
123123
conditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretNotAvailableReason, clusterv1.ConditionSeverityWarning, err.Error())
124124
v1beta2conditions.Set(identity, metav1.Condition{
125-
Type: infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Condition,
125+
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
126126
Status: metav1.ConditionFalse,
127-
Reason: infrav1.VSphereClusterIdentityCredentialsSecretNotAvailableV1Beta2Reason,
127+
Reason: infrav1.VSphereClusterIdentitySecretNotAvailableV1Beta2Reason,
128128
Message: err.Error(),
129129
})
130130
return reconcile.Result{}, errors.Wrapf(err, "failed to get Secret %s", klog.KRef(secretKey.Namespace, secretKey.Name))
@@ -134,9 +134,9 @@ func (r clusterIdentityReconciler) Reconcile(ctx context.Context, req reconcile.
134134
if !clusterutilv1.IsOwnedByObject(secret, identity) && pkgidentity.IsOwnedByIdentityOrCluster(secret.GetOwnerReferences()) {
135135
conditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretAlreadyInUseReason, clusterv1.ConditionSeverityError, "secret being used by another Cluster/VSphereIdentity")
136136
v1beta2conditions.Set(identity, metav1.Condition{
137-
Type: infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Condition,
137+
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
138138
Status: metav1.ConditionFalse,
139-
Reason: infrav1.VSphereClusterIdentityCredentialsSecretAlreadyInUseV1Beta2Reason,
139+
Reason: infrav1.VSphereClusterIdentitySecretAlreadyInUseV1Beta2Reason,
140140
Message: "secret being used by another Cluster/VSphereIdentity",
141141
})
142142
identity.Status.Ready = false
@@ -160,19 +160,19 @@ func (r clusterIdentityReconciler) Reconcile(ctx context.Context, req reconcile.
160160
if err != nil {
161161
conditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretOwnerReferenceFailedReason, clusterv1.ConditionSeverityWarning, err.Error())
162162
v1beta2conditions.Set(identity, metav1.Condition{
163-
Type: infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Condition,
163+
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
164164
Status: metav1.ConditionFalse,
165-
Reason: infrav1.VSphereClusterIdentityCredentialsSettingSecretOwnerReferenceFailedV1Beta2Reason,
165+
Reason: infrav1.VSphereClusterIdentitySettingSecretOwnerReferenceFailedV1Beta2Reason,
166166
Message: err.Error(),
167167
})
168168
return reconcile.Result{}, err
169169
}
170170

171171
conditions.MarkTrue(identity, infrav1.CredentialsAvailableCondidtion)
172172
v1beta2conditions.Set(identity, metav1.Condition{
173-
Type: infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Condition,
173+
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
174174
Status: metav1.ConditionTrue,
175-
Reason: infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Reason,
175+
Reason: infrav1.VSphereClusterIdentityAvailableV1Beta2Reason,
176176
})
177177

178178
identity.Status.Ready = true
@@ -188,9 +188,9 @@ func (r clusterIdentityReconciler) reconcileDelete(ctx context.Context, identity
188188
}
189189

190190
v1beta2conditions.Set(identity, metav1.Condition{
191-
Type: infrav1.VSphereClusterIdentityCredentialsAvailableV1Beta2Condition,
191+
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
192192
Status: metav1.ConditionFalse,
193-
Reason: infrav1.VSphereClusterIdentityCredentialsDeletingV1Beta2Reason,
193+
Reason: infrav1.VSphereClusterIdentityDeletingV1Beta2Reason,
194194
})
195195

196196
err := r.Client.Get(ctx, secretKey, secret)

0 commit comments

Comments
 (0)