Skip to content

Commit bba128d

Browse files
authored
fix: update lease duration and renew deadline for unbounded CNI controller (#33)
feat: add rollout wait for unbounded CNI controller deployment
1 parent 64f8674 commit bba128d

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

cli/internal/aks/deploy/unboundedcni/assets/unbounded-cni-0.5.2/01-configmap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ data:
2020
registerAggregatedAPIServer: true
2121
leaderElection:
2222
enabled: true
23-
leaseDuration: "15s"
24-
renewDeadline: "30s"
23+
leaseDuration: "30s"
24+
renewDeadline: "15s"
2525
retryPeriod: "10s"
2626
resourceNamespace: unbounded-cni
2727
resourceName: "unbounded-cni-controller"

cli/internal/aks/deploy/unboundedcni/unboundedcni.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func Deploy(
5757
}
5858
}
5959

60+
// wait for the controller (webhook) to be ready before applying AKS resources
61+
if err := kubectlRolloutWait(ctx, kubeconfigFile, "unbounded-cni", "deployment/unbounded-cni-controller"); err != nil {
62+
return fmt.Errorf("failed waiting for unbounded CNI controller to be ready: %w", err)
63+
}
64+
6065
// deploy the AKS site and gateway pool resources
6166
aksDir := filepath.Join(tempDir, "aks")
6267
if err := kubectlApply(ctx, kubeconfigFile, aksDir); err != nil {
@@ -66,6 +71,18 @@ func Deploy(
6671
return nil
6772
}
6873

74+
// kubectlRolloutWait runs kubectl rollout status for the given resource in the
75+
// given namespace, blocking until the rollout is complete.
76+
func kubectlRolloutWait(ctx context.Context, kubeconfigFile, namespace, resource string) error {
77+
cmd := exec.CommandContext(ctx, "kubectl", "rollout", "status", resource, "-n", namespace)
78+
cmd.Stdout = os.Stdout
79+
cmd.Stderr = os.Stderr
80+
cmd.Env = append(cmd.Environ(),
81+
"KUBECONFIG="+kubeconfigFile,
82+
)
83+
return cmd.Run()
84+
}
85+
6986
// kubectlApply runs kubectl apply -f against the given path (file or directory)
7087
// using the provided kubeconfig.
7188
func kubectlApply(ctx context.Context, kubeconfigFile, path string) error {

karpenter/charts/karpenter/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ controller:
9696
# -- Tag of the controller image.
9797
tag: main
9898
# -- SHA256 digest of the controller image.
99-
digest: sha256:3625d2a19298da105cfc24f6f0694cbd9dc1d5443ba10b6d9043d0ed1902d470
99+
digest: sha256:e1157f380a4f04ec2fa1657f950c259c34562a365305af7d3f0b2ccef6d87e56
100100
# -- Optional Nebius credentials secret mount. The secret must be created by
101101
# the user separately (not managed by this chart). When enabled, the secret is
102102
# mounted as a file and passed via the -flex-nebius.credentials-file flag.

0 commit comments

Comments
 (0)