Skip to content

Commit ef92b3e

Browse files
feat: pre commit fixes
1 parent 0a9d85d commit ef92b3e

File tree

9 files changed

+56
-29
lines changed

9 files changed

+56
-29
lines changed

api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ spec:
260260
default: HelmAddon
261261
description: Addon strategy used to deploy the Nutanix konnector-agent to the k8s cluster.
262262
enum:
263-
- ClusterResourceSet
264263
- HelmAddon
265264
type: string
266265
type: object

examples/capi-quick-start/nutanix-cluster-calico-crs.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ spec:
9090
strategy: HelmAddon
9191
snapshotController:
9292
strategy: HelmAddon
93-
konnectorAgent: {}
93+
konnectorAgent:
94+
credentials:
95+
secretRef:
96+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
97+
strategy: HelmAddon
9498
nfd:
9599
strategy: ClusterResourceSet
96100
serviceLoadBalancer:

examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ spec:
8888
strategy: HelmAddon
8989
snapshotController:
9090
strategy: HelmAddon
91-
konnectorAgent: {}
91+
konnectorAgent:
92+
credentials:
93+
secretRef:
94+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
95+
strategy: HelmAddon
9296
nfd: {}
9397
serviceLoadBalancer:
9498
configuration:

examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ spec:
9090
strategy: HelmAddon
9191
snapshotController:
9292
strategy: HelmAddon
93-
konnectorAgent: {}
93+
konnectorAgent:
94+
credentials:
95+
secretRef:
96+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
97+
strategy: HelmAddon
9498
nfd:
9599
strategy: ClusterResourceSet
96100
serviceLoadBalancer:

examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ spec:
8888
strategy: HelmAddon
8989
snapshotController:
9090
strategy: HelmAddon
91-
konnectorAgent: {}
91+
konnectorAgent:
92+
credentials:
93+
secretRef:
94+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
95+
strategy: HelmAddon
9296
nfd: {}
9397
serviceLoadBalancer:
9498
configuration:

examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ spec:
126126
strategy: HelmAddon
127127
snapshotController:
128128
strategy: HelmAddon
129-
konnectorAgent: {}
129+
konnectorAgent:
130+
credentials:
131+
secretRef:
132+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
133+
strategy: HelmAddon
130134
nfd:
131135
strategy: ClusterResourceSet
132136
serviceLoadBalancer:

examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ spec:
124124
strategy: HelmAddon
125125
snapshotController:
126126
strategy: HelmAddon
127-
konnectorAgent: {}
127+
konnectorAgent:
128+
credentials:
129+
secretRef:
130+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
131+
strategy: HelmAddon
128132
nfd: {}
129133
serviceLoadBalancer:
130134
configuration:

hack/examples/patches/nutanix/konnector-agent.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33

44
- op: "add"
55
path: "/spec/topology/variables/0/value/addons/konnectorAgent"
6-
value: {}
6+
value:
7+
credentials:
8+
secretRef:
9+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
10+
strategy: HelmAddon

pkg/handlers/lifecycle/konnectoragent/handler.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,18 @@ func (n *DefaultKonnectorAgent) apply(
142142
if variables.IsNotFoundError(err) {
143143
log.
144144
Info(
145-
"Skipping K8s Registration Agent handler," +
146-
"cluster does not specify request K8s Registration Agent addon deployment",
145+
"Skipping Konnector Agent handler," +
146+
"cluster does not specify request Konnector Agent addon deployment",
147147
)
148148
return
149149
}
150150
log.Error(
151151
err,
152-
"failed to read K8s Registration Agent variable from cluster definition",
152+
"failed to read Konnector Agent variable from cluster definition",
153153
)
154154
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
155155
resp.SetMessage(
156-
fmt.Sprintf("failed to read K8s Registration agent variable from cluster definition: %v",
156+
fmt.Sprintf("failed to read Konnector Agent variable from cluster definition: %v",
157157
err,
158158
),
159159
)
@@ -250,19 +250,19 @@ func (n *DefaultKonnectorAgent) apply(
250250
).WithValueTemplater(templateValuesFunc(clusterConfigVar.Nutanix, cluster))
251251
case "":
252252
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
253-
resp.SetMessage("strategy not provided for K8s Registration Agent")
253+
resp.SetMessage("strategy not provided for Konnector Agent")
254254
return
255255
default:
256256
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
257257
resp.SetMessage(
258-
fmt.Sprintf("unknown K8s registration agent addon deployment strategy %q", k8sAgentVar.Strategy),
258+
fmt.Sprintf("unknown Konnector Agent addon deployment strategy %q", k8sAgentVar.Strategy),
259259
)
260260
return
261261
}
262262

263263
if err := strategy.Apply(ctx, cluster, n.config.DefaultsNamespace(), log); err != nil {
264264
log.Error(err, "Helm strategy Apply failed")
265-
err = fmt.Errorf("failed to apply K8s Registration Agent addon: %w", err)
265+
err = fmt.Errorf("failed to apply Konnector Agent addon: %w", err)
266266
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
267267
resp.SetMessage(err.Error())
268268
return
@@ -340,18 +340,18 @@ func (n *DefaultKonnectorAgent) BeforeClusterDelete(
340340
if err != nil {
341341
if variables.IsNotFoundError(err) {
342342
log.Info(
343-
"Skipping K8s Registration Agent cleanup, addon not specified in cluster definition",
343+
"Skipping Konnector Agent cleanup, addon not specified in cluster definition",
344344
)
345345
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
346346
return
347347
}
348348
log.Error(
349349
err,
350-
"failed to read K8s Registration Agent variable from cluster definition",
350+
"failed to read Konnector Agent variable from cluster definition",
351351
)
352352
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
353353
resp.SetMessage(
354-
fmt.Sprintf("failed to read K8s Registration Agent variable from cluster definition: %v",
354+
fmt.Sprintf("failed to read Konnector Agent variable from cluster definition: %v",
355355
err,
356356
),
357357
)
@@ -372,20 +372,20 @@ func (n *DefaultKonnectorAgent) BeforeClusterDelete(
372372

373373
switch cleanupStatus {
374374
case cleanupStatusCompleted:
375-
log.Info("K8s Registration Agent cleanup already completed")
375+
log.Info("Konnector Agent cleanup already completed")
376376
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
377377
return
378378
case cleanupStatusInProgress:
379-
log.Info("K8s Registration Agent cleanup in progress, requesting retry")
379+
log.Info("Konnector Agent cleanup in progress, requesting retry")
380380
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
381381
resp.SetRetryAfterSeconds(10) // Retry after 10 seconds
382382
return
383383
case cleanupStatusNotStarted:
384-
log.Info("Starting K8s Registration Agent cleanup")
384+
log.Info("Starting Konnector Agent cleanup")
385385
// Proceed with cleanup below
386386
}
387387

388-
err = n.deleteHelmChart(ctx, cluster, log)
388+
err = n.deleteHelmChartProxy(ctx, cluster, log)
389389
if err != nil {
390390
log.Error(err, "Failed to delete helm chart")
391391
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
@@ -394,7 +394,7 @@ func (n *DefaultKonnectorAgent) BeforeClusterDelete(
394394
}
395395

396396
// After initiating cleanup, request a retry to monitor completion
397-
log.Info("K8s Registration Agent cleanup initiated, will monitor progress")
397+
log.Info("Konnector Agent cleanup initiated, will monitor progress")
398398
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
399399
resp.SetRetryAfterSeconds(5) // Quick retry to start monitoring
400400

@@ -403,7 +403,7 @@ func (n *DefaultKonnectorAgent) BeforeClusterDelete(
403403
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
404404
default:
405405
log.Info(
406-
"Unknown K8s Registration Agent strategy, skipping cleanup",
406+
"Unknown Konnector Agent strategy, skipping cleanup",
407407
"strategy", k8sAgentVar.Strategy,
408408
)
409409
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
@@ -432,7 +432,7 @@ func (n *DefaultKonnectorAgent) deleteHelmChartProxy(
432432
}
433433

434434
// First, try to gracefully trigger helm uninstall while cluster is still accessible
435-
log.Info("Initiating graceful deletion of K8s Registration Agent", "name", hcp.Name, "namespace", hcp.Namespace)
435+
log.Info("Initiating graceful deletion of Konnector Agent", "name", hcp.Name, "namespace", hcp.Namespace)
436436

437437
// Get the current HCP to check if it exists and get its current state
438438
currentHCP := &caaphv1.HelmChartProxy{}
@@ -459,14 +459,14 @@ func (n *DefaultKonnectorAgent) deleteHelmChartProxy(
459459
}
460460

461461
// Now delete the HelmChartProxy - CAAPH will handle the helm uninstall
462-
log.Info("Deleting K8s Registration Agent HelmChartProxy", "name", hcp.Name, "namespace", hcp.Namespace)
462+
log.Info("Deleting Konnector Agent HelmChartProxy", "name", hcp.Name, "namespace", hcp.Namespace)
463463
if err := n.client.Delete(ctx, currentHCP); err != nil {
464464
if ctrlclient.IgnoreNotFound(err) == nil {
465-
log.Info("K8s Registration Agent HelmChartProxy already deleted", "name", hcp.Name)
465+
log.Info("Konnector Agent HelmChartProxy already deleted", "name", hcp.Name)
466466
return nil
467467
}
468468
return fmt.Errorf(
469-
"failed to delete K8s Registration Agent HelmChartProxy %q: %w",
469+
"failed to delete Konnector Agent HelmChartProxy %q: %w",
470470
ctrlclient.ObjectKeyFromObject(hcp),
471471
err,
472472
)
@@ -487,7 +487,7 @@ func (n *DefaultKonnectorAgent) deleteHelmChartProxy(
487487
return nil
488488
}
489489

490-
// checkCleanupStatus checks the current status of K8s Registration Agent cleanup.
490+
// checkCleanupStatus checks the current status of Konnector Agent cleanup.
491491
// Returns: "completed", "in-progress", or "not-started".
492492
func (n *DefaultKonnectorAgent) checkCleanupStatus(
493493
ctx context.Context,

0 commit comments

Comments
 (0)