diff --git a/plugins/scheduler-k3s/templates/helm-config/ingress-nginx.yaml b/plugins/scheduler-k3s/templates/helm-config/ingress-nginx.yaml index 8263f6d4215..fd60488cd44 100644 --- a/plugins/scheduler-k3s/templates/helm-config/ingress-nginx.yaml +++ b/plugins/scheduler-k3s/templates/helm-config/ingress-nginx.yaml @@ -55,3 +55,26 @@ controller: operator: Exists effect: NoSchedule priorityClassName: system-cluster-critical + + admissionWebhooks: + patch: + tolerations: + - key: CriticalAddonsOnly + operator: Exists + - key: node-role.kubernetes.io/control-plane + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule + +defaultBackend: + tolerations: + - key: CriticalAddonsOnly + operator: Exists + - key: node-role.kubernetes.io/control-plane + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule \ No newline at end of file diff --git a/tests/unit/scheduler-k3s.bats b/tests/unit/scheduler-k3s.bats index 182f489e716..6b0c9b8c195 100644 --- a/tests/unit/scheduler-k3s.bats +++ b/tests/unit/scheduler-k3s.bats @@ -50,10 +50,17 @@ install_k3s() { assert_output_contains "Login Succeeded" INGRESS_CLASS="${INGRESS_CLASS:-traefik}" - run /bin/bash -c "dokku scheduler-k3s:initialize --ingress-class $INGRESS_CLASS" - echo "output: $output" - echo "status: $status" - assert_success + if [[ "$TAINT_SCHEDULING" == "true" ]]; then + run /bin/bash -c "dokku scheduler-k3s:initialize --ingress-class $INGRESS_CLASS --taint-scheduling" + echo "output: $output" + echo "status: $status" + assert_success + else + run /bin/bash -c "dokku scheduler-k3s:initialize --ingress-class $INGRESS_CLASS" + echo "output: $output" + echo "status: $status" + assert_success + fi } uninstall_k3s() { @@ -63,7 +70,7 @@ uninstall_k3s() { assert_success } -@test "(scheduler-k3s) install" { +@test "(scheduler-k3s) install traefik" { if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN" fi @@ -71,6 +78,30 @@ uninstall_k3s() { install_k3s } +@test "(scheduler-k3s) install nginx" { + if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then + skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN" + fi + + INGRESS_CLASS=nginx install_k3s +} + +@test "(scheduler-k3s) install traefik with taint" { + if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then + skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN" + fi + + TAINT_SCHEDULING=true install_k3s +} + +@test "(scheduler-k3s) install nginx with taint" { + if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then + skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN" + fi + + INGRESS_CLASS=nginx TAINT_SCHEDULING=true install_k3s +} + @test "(scheduler-k3s) deploy traefik" { if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"