Skip to content

Commit d6234f2

Browse files
authored
Deploying HPC webhook to the cluster (#540)
1 parent aee4150 commit d6234f2

File tree

8 files changed

+68
-200
lines changed

8 files changed

+68
-200
lines changed

.markdownlinignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
helpers/README.md
2+
README.md

capz/run-capz-e2e.sh

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ main() {
7676
return ${exit_code}
7777
fi
7878

79+
apply_hpc_webhook
7980
run_e2e_test
8081
}
8182

@@ -265,7 +266,7 @@ create_cluster(){
265266
log "Install cluster api azure onto management cluster"
266267
"$TOOLS_BIN_DIR"/clusterctl init --infrastructure azure
267268
log "wait for core CRDs to be installed"
268-
kubectl wait --for=condition=ready pod --all -n capz-system --timeout -300s
269+
kubectl wait --for=condition=ready pod --all -n capz-system --timeout=300s
269270
# Wait for the core CRD resources to be "installed" onto the mgmt cluster before returning control
270271
timeout --foreground 300 bash -c "until kubectl get clusters -A > /dev/null 2>&1; do sleep 3; done"
271272
timeout --foreground 300 bash -c "until kubectl get azureclusters -A > /dev/null 2>&1; do sleep 3; done"
@@ -433,6 +434,47 @@ apply_cloud_provider_azure() {
433434
"$TOOLS_BIN_DIR"/helm upgrade cloud-provider-azure --install --namespace kube-system --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure "${CCM_IMG_ARGS[@]}"
434435
}
435436

437+
apply_hpc_webhook(){
438+
log "applying configuration for HPC webhook"
439+
440+
# ensure cert-manager and webhook pods land on Linux nodes
441+
log "untainting control-plane nodes"
442+
mapfile -t cp_nodes < <(kubectl get nodes | grep control-plane | awk '{print $1}')
443+
kubectl taint nodes "${cp_nodes[@]}" node-role.kubernetes.io/control-plane:NoSchedule- || true
444+
445+
log "tainting windows nodes"
446+
mapfile -t windows_nodes < <(kubectl get nodes -o wide | grep Windows | awk '{print $1}')
447+
kubectl taint nodes "${windows_nodes[@]}" os=windows:NoSchedule
448+
449+
log "installing cert-manager via helm"
450+
"$TOOLS_BIN_DIR"/helm install \
451+
--repo https://charts.jetstack.io \
452+
--namespace cert-manager \
453+
--create-namespace \
454+
--set crds.enabled=true \
455+
--wait \
456+
cert-manager cert-manager
457+
458+
log "wait for cert-manager pods to start"
459+
timeout 5m kubectl wait --for=condition=ready pod --all -n cert-manager --timeout -1s
460+
461+
log "installing HPC mutating webhook via helm"
462+
"$TOOLS_BIN_DIR"/helm install hpc-webhook "${SCRIPT_ROOT}/../helpers/helm" \
463+
-f "${SCRIPT_ROOT}/../helpers/helm/values-hpc.yaml" \
464+
--create-namespace
465+
466+
log "wait for HPC webhook pods to start"
467+
timeout 5m kubectl wait --for=condition=ready pod --all -n hpc-webhook --timeout -1s
468+
469+
log "untainting Windows agent nodes"
470+
kubectl taint nodes "${windows_nodes[@]}" os=windows:NoSchedule-
471+
472+
log "tainting control-plane nodes again"
473+
kubectl taint nodes "${cp_nodes[@]}" node-role.kubernetes.io/control-plane:NoSchedule || true
474+
475+
log "done configuring HPC webhook"
476+
}
477+
436478
apply_hyperv_configuration(){
437479
set -x
438480
log "applying configuration for testing hyperv isolated containers"
@@ -458,13 +500,13 @@ apply_hyperv_configuration(){
458500
log "installing admission controller webhook"
459501
kubectl apply -f "${SCRIPT_ROOT}/../helpers/hyper-v-mutating-webhook/deployment.yaml"
460502

461-
log "wait for webhook pods to go start"
503+
log "wait for webhook pods to start"
462504
timeout 5m kubectl wait --for=condition=ready pod --all -n hyperv-webhook-system --timeout -1s
463505

464506
log "untainting Windows agent nodes"
465507
kubectl taint nodes "${windows_nodes[@]}" os=windows:NoSchedule-
466508

467-
log "tainting master nodes again"
509+
log "tainting control-plane nodes again"
468510
kubectl taint nodes "${cp_nodes[@]}" node-role.kubernetes.io/control-plane:NoSchedule || true
469511

470512
log "done configuring testing for hyperv isolated containers"

helpers/README.md

Lines changed: 0 additions & 161 deletions
This file was deleted.

helpers/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: capz-mutating-webhook
33
description: A Helm chart for Windows mutating webhooks (Hyper-V and HPC)
44
type: application
55
version: 0.1.0
6-
appVersion: "1.0"
6+
appVersion: "latest"
77
keywords:
88
- windows
99
- hyperv

helpers/helm/values-hpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ webhookType: hpc
1010

1111
deployment:
1212
image:
13-
# Uses default registry from values.yaml: ghcr.io/kubernetes-sigs/windows-testing
13+
# Uses default registry from values.yaml: sigwindowstools
1414
# Override with: --set deployment.image.registry=myregistry.io/myorg
1515
tag: "" # Uses chart appVersion by default, override with --set deployment.image.tag=$VERSION
1616

helpers/helm/values-hyperv.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ webhookType: hyperv
1010

1111
deployment:
1212
image:
13-
# Uses default registry from values.yaml: ghcr.io/kubernetes-sigs/windows-testing
13+
# Uses default registry from values.yaml: sigwindowstools
1414
# Override with: --set deployment.image.registry=myregistry.io/myorg
1515
tag: "" # Uses chart appVersion by default, override with --set deployment.image.tag=$VERSION
1616

helpers/helm/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ deployment:
2121
strategy: {}
2222

2323
image:
24-
# Image registry (set via Makefile's REGISTRY variable)
25-
registry: "ghcr.io/kubernetes-sigs/windows-testing"
24+
# Image registry (default matches Makefile's REGISTRY variable)
25+
registry: "sigwindowstools"
2626

2727
# Full repository path - if set, overrides registry + auto-generated name
2828
repository: ""

0 commit comments

Comments
 (0)