1919
2020 # Kubernetes & Kind configuration
2121 KUBECTL_BIN : kubectl
22- KIND_CLUSTER_NAME : kind
22+ KIND_CLUSTER_NAME : aiven-operator
2323 KIND_NODE_IMAGE : kindest/node:v1.26.6
2424 KIND_WAIT_DURATION : 5m
25- KUBECTL_CONTEXT : kind-{{.KIND_CLUSTER_NAME}}
2625 ENVTEST_K8S_VERSION : 1.26.*
2726
2827 # Tool versions
@@ -309,14 +308,16 @@ tasks:
309308 echo "🔐 Creating Aiven token secret..."
310309 kubectl create secret generic aiven-token \
311310 --from-literal=token=${AIVEN_TOKEN} \
312- --dry-run=client -o yaml | kubectl apply -f -
311+ --context {{.KIND_KUBECTL_CONTEXT}} \
312+ --dry-run=client -o yaml | kubectl apply --context {{.KIND_KUBECTL_CONTEXT}} -f -
313313
314314 echo "Installing operator CRDs..."
315315 if [ ! -d "charts/aiven-operator-crds" ]; then
316316 echo "❌ CRDs chart not found at charts/aiven-operator-crds"
317317 exit 1
318318 fi
319319 helm upgrade --install aiven-operator-crds charts/aiven-operator-crds \
320+ --kube-context {{.KIND_KUBECTL_CONTEXT}} \
320321 --wait --timeout 3m
321322
322323 echo "Installing operator with image: {{.OPERATOR_IMAGE_NAME}}:{{.OPERATOR_IMAGE_TAG}}..."
@@ -325,6 +326,7 @@ tasks:
325326 exit 1
326327 fi
327328 helm upgrade --install aiven-operator charts/aiven-operator \
329+ --kube-context {{.KIND_KUBECTL_CONTEXT}} \
328330 --set defaultTokenSecret.name=aiven-token \
329331 --set defaultTokenSecret.key=token \
330332 --set leaderElect=true \
@@ -347,6 +349,7 @@ tasks:
347349 helm repo add jetstack https://charts.jetstack.io --force-update >/dev/null
348350 helm repo update >/dev/null
349351 helm upgrade --install cert-manager jetstack/cert-manager \
352+ --kube-context {{.KIND_KUBECTL_CONTEXT}} \
350353 --namespace cert-manager \
351354 --create-namespace \
352355 --version {{.CERT_MANAGER_TAG}} \
@@ -377,14 +380,16 @@ tasks:
377380 echo "Creating Aiven token secret..."
378381 kubectl create secret generic aiven-token \
379382 --from-literal=token=${AIVEN_TOKEN} \
380- --dry-run=client -o yaml | kubectl apply -f -
383+ --context {{.KIND_KUBECTL_CONTEXT}} \
384+ --dry-run=client -o yaml | kubectl apply --context {{.KIND_KUBECTL_CONTEXT}} -f -
381385
382386 echo "Installing operator CRDs..."
383387 if [ ! -d "charts/aiven-operator-crds" ]; then
384388 echo "❌ CRDs chart not found at charts/aiven-operator-crds"
385389 exit 1
386390 fi
387391 helm upgrade --install aiven-operator-crds charts/aiven-operator-crds \
392+ --kube-context {{.KIND_KUBECTL_CONTEXT}} \
388393 --wait --timeout 3m
389394
390395 echo "🎯 Installing operator..."
@@ -393,6 +398,7 @@ tasks:
393398 exit 1
394399 fi
395400 helm upgrade --install aiven-operator charts/aiven-operator \
401+ --kube-context {{.KIND_KUBECTL_CONTEXT}} \
396402 --set defaultTokenSecret.name=aiven-token \
397403 --set defaultTokenSecret.key=token \
398404 --set leaderElect=true \
@@ -413,18 +419,18 @@ tasks:
413419 echo "🔍 Verifying setup..."
414420
415421 # Check CRDs
416- if kubectl get crd kafkas.aiven.io >/dev/null 2>&1; then
422+ if kubectl get crd kafkas.aiven.io --context {{.KIND_KUBECTL_CONTEXT}} >/dev/null 2>&1; then
417423 echo "✅ CRDs are installed"
418424 else
419425 echo "⚠️ CRDs not found"
420426 fi
421427
422428 # Check operator pods
423- POD_NAME=$(kubectl get pods -l app.kubernetes.io/instance=aiven-operator -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || \
424- kubectl get pods -l app=aiven-operator -o jsonpath='{.items[0].metadata.name}' 2>/dev/null)
429+ POD_NAME=$(kubectl get pods -l app.kubernetes.io/instance=aiven-operator --context {{.KIND_KUBECTL_CONTEXT}} - o jsonpath='{.items[0].metadata.name}' 2>/dev/null || \
430+ kubectl get pods -l app=aiven-operator --context {{.KIND_KUBECTL_CONTEXT}} - o jsonpath='{.items[0].metadata.name}' 2>/dev/null)
425431
426432 if [ -n "$POD_NAME" ]; then
427- STATUS=$(kubectl get pod $POD_NAME -o jsonpath='{.status.phase}')
433+ STATUS=$(kubectl get pod $POD_NAME --context {{.KIND_KUBECTL_CONTEXT}} - o jsonpath='{.status.phase}')
428434 echo "✅ Operator pod '$POD_NAME' is $STATUS"
429435 else
430436 echo "⚠️ Operator pod not found"
0 commit comments