From 65184f1ed89c59717a0fda94701e88832ca28c06 Mon Sep 17 00:00:00 2001 From: Zane Hala Date: Mon, 27 Mar 2023 18:42:20 -0500 Subject: [PATCH] chart: Allow customization of admission webhook timeout (#2398) Co-authored-by: Yusuke Kuoka --- acceptance/deploy.sh | 3 +++ .../templates/webhook_configs.yaml | 7 +++++++ test/e2e/e2e_test.go | 3 +++ 3 files changed, 13 insertions(+) diff --git a/acceptance/deploy.sh b/acceptance/deploy.sh index 2b076010..3435086a 100755 --- a/acceptance/deploy.sh +++ b/acceptance/deploy.sh @@ -69,6 +69,9 @@ if [ "${tool}" == "helm" ]; then flags+=( --set githubWebhookServer.logFormat=${LOG_FORMAT}) flags+=( --set actionsMetricsServer.logFormat=${LOG_FORMAT}) fi + if [ "${ADMISSION_WEBHOOKS_TIMEOUT}" != "" ]; then + flags+=( --set admissionWebHooks.timeoutSeconds=${ADMISSION_WEBHOOKS_TIMEOUT}) + fi if [ -n "${CREATE_SECRETS_USING_HELM}" ]; then if [ -z "${WEBHOOK_GITHUB_TOKEN}" ]; then echo 'Failed deploying secret "actions-metrics-server" using helm. Set WEBHOOK_GITHUB_TOKEN to deploy.' 1>&2 diff --git a/charts/actions-runner-controller/templates/webhook_configs.yaml b/charts/actions-runner-controller/templates/webhook_configs.yaml index 7a71735d..89cb2736 100644 --- a/charts/actions-runner-controller/templates/webhook_configs.yaml +++ b/charts/actions-runner-controller/templates/webhook_configs.yaml @@ -44,6 +44,7 @@ webhooks: resources: - runners sideEffects: None + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} - admissionReviewVersions: - v1beta1 {{- if .Values.scope.singleNamespace }} @@ -74,6 +75,7 @@ webhooks: resources: - runnerdeployments sideEffects: None + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} - admissionReviewVersions: - v1beta1 {{- if .Values.scope.singleNamespace }} @@ -104,6 +106,7 @@ webhooks: resources: - runnerreplicasets sideEffects: None + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} - admissionReviewVersions: - v1beta1 {{- if .Values.scope.singleNamespace }} @@ -136,6 +139,7 @@ webhooks: objectSelector: matchLabels: "actions-runner-controller/inject-registration-token": "true" + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration @@ -177,6 +181,7 @@ webhooks: resources: - runners sideEffects: None + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} - admissionReviewVersions: - v1beta1 {{- if .Values.scope.singleNamespace }} @@ -207,6 +212,7 @@ webhooks: resources: - runnerdeployments sideEffects: None + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} - admissionReviewVersions: - v1beta1 {{- if .Values.scope.singleNamespace }} @@ -238,6 +244,7 @@ webhooks: - runnerreplicasets sideEffects: None {{ if not (or (hasKey .Values.admissionWebHooks "caBundle") .Values.certManagerEnabled) }} + timeoutSeconds: {{ .Values.admissionWebHooks.timeoutSeconds | default 10}} --- apiVersion: v1 kind: Secret diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 66ac1c03..c7369978 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -413,6 +413,7 @@ type env struct { runnerNamespace string logFormat string remoteKubeconfig string + admissionWebhooksTimeout string imagePullSecretName string imagePullPolicy string @@ -547,6 +548,7 @@ func initTestEnv(t *testing.T, k8sMinorVer string, vars vars) *env { e.runnerNamespace = testing.Getenv(t, "TEST_RUNNER_NAMESPACE", "default") e.logFormat = testing.Getenv(t, "ARC_E2E_LOG_FORMAT", "") e.remoteKubeconfig = testing.Getenv(t, "ARC_E2E_REMOTE_KUBECONFIG", "") + e.admissionWebhooksTimeout = testing.Getenv(t, "ARC_E2E_ADMISSION_WEBHOOKS_TIMEOUT", "") e.imagePullSecretName = testing.Getenv(t, "ARC_E2E_IMAGE_PULL_SECRET_NAME", "") e.vars = vars @@ -724,6 +726,7 @@ func (e *env) installActionsRunnerController(t *testing.T, repo, tag, testID, ch "TEST_ID=" + testID, "NAME=" + repo, "VERSION=" + tag, + "ADMISSION_WEBHOOKS_TIMEOUT=" + e.admissionWebhooksTimeout, "IMAGE_PULL_SECRET=" + e.imagePullSecretName, "IMAGE_PULL_POLICY=" + e.imagePullPolicy, }