From e8aedb258cfa840107b2390a729c330bd1ead6e6 Mon Sep 17 00:00:00 2001 From: dementhorr Date: Sun, 11 Feb 2024 16:29:14 +0100 Subject: [PATCH] Changed actions from StatefulSet to Deployment --- README.md | 64 +++++++++---------- .../gitea/act_runner/config-act-runner.yaml | 6 +- .../{statefulset.yaml => deployment.yaml} | 40 +++++------- unittests/act_runner/config-act-runner.yaml | 2 +- unittests/act_runner/config-scripts.yaml | 2 +- .../{statefulset.yaml => deployment.yaml} | 12 ++-- unittests/act_runner/job.yaml | 2 +- unittests/act_runner/role-job.yaml | 2 +- unittests/act_runner/rolebinding-job.yaml | 2 +- unittests/act_runner/secret-token.yaml | 2 +- unittests/act_runner/serviceaccount-job.yaml | 2 +- values.yaml | 32 +++++----- 12 files changed, 79 insertions(+), 89 deletions(-) rename templates/gitea/act_runner/{statefulset.yaml => deployment.yaml} (67%) rename unittests/act_runner/{statefulset.yaml => deployment.yaml} (55%) diff --git a/README.md b/README.md index 9e5c4d1..bac2ad7 100644 --- a/README.md +++ b/README.md @@ -982,38 +982,38 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo ### GiteaActions -| Name | Description | Value | -| ----------------------------------------------- | --------------------------------------------------------------------------- | ------------------ | -| `actions.statefulset.enabled` | Create an act runner StatefulSet. | `false` | -| `actions.statefulset.annotations` | Act runner annotations | `{}` | -| `actions.statefulset.labels` | Act runner labels | `{}` | -| `actions.statefulset.resources` | Act runner resources | `{}` | -| `actions.statefulset.nodeSelector` | NodeSelector for the statefulset | `{}` | -| `actions.statefulset.tolerations` | Tolerations for the statefulset | `[]` | -| `actions.statefulset.affinity` | Affinity for the statefulset | `{}` | -| `actions.statefulset.config` | Act runner custom configuration. | `""` | -| `actions.statefulset.runnerLabels` | Act runner labels. | `""` | -| `actions.statefulset.actRunnerImage.repository` | The Gitea act runner image | `gitea/act_runner` | -| `actions.statefulset.actRunnerImage.tag` | The Gitea act runner tag | `0.2.6` | -| `actions.statefulset.actRunnerImage.pullPolicy` | The Gitea act runner pullPolicy | `IfNotPresent` | -| `actions.statefulset.dindImage.repository` | The Docker-in-Docker image | `docker` | -| `actions.statefulset.dindImage.tag` | The Docker-in-Docker image tag | `24.0.7-dind` | -| `actions.statefulset.dindImage.pullPolicy` | The Docker-in-Docker pullPolicy | `IfNotPresent` | -| `actions.job.enabled` | Create a job that will create and save the token in a Kubernetes Secret | `false` | -| `actions.job.annotations` | Job's annotations | `{}` | -| `actions.job.labels` | Job's labels | `{}` | -| `actions.job.resources` | Job's resources | `{}` | -| `actions.job.nodeSelector` | NodeSelector for the job | `{}` | -| `actions.job.tolerations` | Tolerations for the job | `[]` | -| `actions.job.affinity` | Affinity for the job | `{}` | -| `actions.job.tokenImage.repository` | The image that can create a token via `gitea actions generate-runner-token` | `gitea/gitea` | -| `actions.job.tokenImage.tag` | The token image tag that can create a token | `""` | -| `actions.job.tokenImage.pullPolicy` | The token image pullPolicy that can create a token | `IfNotPresent` | -| `actions.job.publishImage.repository` | The image that can create the secret via kubectl | `bitnami/kubectl` | -| `actions.job.publishImage.tag` | The publish image tag that can create the secret | `1.29.0` | -| `actions.job.publishImage.pullPolicy` | The publish image pullPolicy that can create the secret | `IfNotPresent` | -| `actions.existingSecret` | Secret that contains the token | `""` | -| `actions.existingSecretKey` | Secret key | `""` | +| Name | Description | Value | +| ---------------------------------------------- | --------------------------------------------------------------------------- | ------------------ | +| `actions.deployment.enabled` | Create an act runner Deployment | `false` | +| `actions.deployment.annotations` | Act runner annotations | `{}` | +| `actions.deployment.labels` | Act runner labels | `{}` | +| `actions.deployment.resources` | Act runner resources | `{}` | +| `actions.deployment.nodeSelector` | NodeSelector for the deployment | `{}` | +| `actions.deployment.tolerations` | Tolerations for the deployment | `[]` | +| `actions.deployment.affinity` | Affinity for the deployment | `{}` | +| `actions.deployment.config` | Act runner custom configuration | `""` | +| `actions.deployment.runnerLabels` | Act runner labels. | `""` | +| `actions.deployment.actRunnerImage.repository` | The Gitea act runner image | `gitea/act_runner` | +| `actions.deployment.actRunnerImage.tag` | The Gitea act runner tag | `0.2.6` | +| `actions.deployment.actRunnerImage.pullPolicy` | The Gitea act runner pullPolicy | `IfNotPresent` | +| `actions.deployment.dindImage.repository` | The Docker-in-Docker image | `docker` | +| `actions.deployment.dindImage.tag` | The Docker-in-Docker image tag | `24.0.7-dind` | +| `actions.deployment.dindImage.pullPolicy` | The Docker-in-Docker pullPolicy | `IfNotPresent` | +| `actions.job.enabled` | Create a job that will create and save the token in a Kubernetes Secret | `false` | +| `actions.job.annotations` | Job's annotations | `{}` | +| `actions.job.labels` | Job's labels | `{}` | +| `actions.job.resources` | Job's resources | `{}` | +| `actions.job.nodeSelector` | NodeSelector for the job | `{}` | +| `actions.job.tolerations` | Tolerations for the job | `[]` | +| `actions.job.affinity` | Affinity for the job | `{}` | +| `actions.job.tokenImage.repository` | The image that can create a token via `gitea actions generate-runner-token` | `gitea/gitea` | +| `actions.job.tokenImage.tag` | The token image tag that can create a token | `""` | +| `actions.job.tokenImage.pullPolicy` | The token image pullPolicy that can create a token | `IfNotPresent` | +| `actions.job.publishImage.repository` | The image that can create the secret via kubectl | `bitnami/kubectl` | +| `actions.job.publishImage.tag` | The publish image tag that can create the secret | `1.29.0` | +| `actions.job.publishImage.pullPolicy` | The publish image pullPolicy that can create the secret | `IfNotPresent` | +| `actions.existingSecret` | Secret that contains the token | `""` | +| `actions.existingSecretKey` | Secret key | `""` | ### Gitea diff --git a/templates/gitea/act_runner/config-act-runner.yaml b/templates/gitea/act_runner/config-act-runner.yaml index 091f200..07647a7 100644 --- a/templates/gitea/act_runner/config-act-runner.yaml +++ b/templates/gitea/act_runner/config-act-runner.yaml @@ -1,4 +1,4 @@ -{{- if and (and .Values.actions.statefulset.enabled .Values.persistence.enabled) .Values.persistence.mount }} +{{- if .Values.actions.deployment.enabled }} --- apiVersion: v1 kind: ConfigMap @@ -7,9 +7,9 @@ metadata: labels: {{- include "gitea.labels" . | nindent 4 }} data: - {{- if .Values.actions.statefulset.config }} + {{- if .Values.actions.deployment.config }} config.yaml: | - {{- with .Values.actions.statefulset.config -}} + {{- with .Values.actions.deployment.config -}} {{ . | nindent 4}} {{- end -}} {{- else }} diff --git a/templates/gitea/act_runner/statefulset.yaml b/templates/gitea/act_runner/deployment.yaml similarity index 67% rename from templates/gitea/act_runner/statefulset.yaml rename to templates/gitea/act_runner/deployment.yaml index b778820..47886d0 100644 --- a/templates/gitea/act_runner/statefulset.yaml +++ b/templates/gitea/act_runner/deployment.yaml @@ -1,16 +1,16 @@ -{{- if and (and .Values.actions.statefulset.enabled .Values.persistence.enabled) .Values.persistence.mount }} +{{- if .Values.actions.deployment.enabled }} {{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }} --- apiVersion: apps/v1 -kind: StatefulSet +kind: Deployment metadata: labels: {{- include "gitea.labels.actRunner" . | nindent 4 }} - {{- with .Values.actions.statefulset.labels }} + {{- with .Values.actions.deployment.labels }} {{- toYaml . | nindent 4 }} {{- end }} annotations: - {{- with .Values.actions.statefulset.annotations }} + {{- with .Values.actions.deployment.annotations }} {{- toYaml . | nindent 4 }} {{- end }} name: {{ include "gitea.fullname" . }}-act-runner @@ -22,7 +22,7 @@ spec: metadata: labels: {{- include "gitea.labels.actRunner" . | nindent 8 }} - {{- with .Values.actions.statefulset.labels }} + {{- with .Values.actions.deployment.labels }} {{- toYaml . | nindent 8 }} {{- end }} spec: @@ -38,8 +38,8 @@ spec: done containers: - name: act-runner - image: "{{ .Values.actions.statefulset.actRunnerImage.repository }}:{{ .Values.actions.statefulset.actRunnerImage.tag }}" - imagePullPolicy: {{ .Values.actions.statefulset.actRunnerImage.pullPolicy }} + image: "{{ .Values.actions.deployment.actRunnerImage.repository }}:{{ .Values.actions.deployment.actRunnerImage.tag }}" + imagePullPolicy: {{ .Values.actions.deployment.actRunnerImage.pullPolicy }} workingDir: /data env: - name: DOCKER_HOST @@ -56,22 +56,20 @@ spec: - name: GITEA_INSTANCE_URL value: "http://{{ include "gitea.fullname" . }}-http:{{ .Values.service.http.port }}" - name: GITEA_RUNNER_LABELS - value: "{{ .Values.actions.statefulset.runnerLabels | default "ubuntu-latest" }}" + value: "{{ .Values.actions.deployment.runnerLabels | default "ubuntu-latest" }}" - name: CONFIG_FILE value: /actrunner/config.yaml resources: - {{- toYaml .Values.actions.statefulset.resources | nindent 12 }} + {{- toYaml .Values.actions.deployment.resources | nindent 12 }} volumeMounts: - mountPath: /actrunner/config.yaml name: act-runner-config subPath: config.yaml - mountPath: /certs/server name: docker-certs - - mountPath: /data - name: data-act-runner - name: dind - image: "{{ .Values.actions.statefulset.dindImage.repository }}:{{ .Values.actions.statefulset.dindImage.tag }}" - imagePullPolicy: {{ .Values.actions.statefulset.dindImage.pullPolicy }} + image: "{{ .Values.actions.deployment.dindImage.repository }}:{{ .Values.actions.deployment.dindImage.tag }}" + imagePullPolicy: {{ .Values.actions.deployment.dindImage.pullPolicy }} env: - name: DOCKER_HOST value: tcp://127.0.0.1:2376 @@ -83,19 +81,19 @@ spec: # allowPrivilegeEscalation: true privileged: true resources: - {{- toYaml .Values.actions.statefulset.resources | nindent 12 }} + {{- toYaml .Values.actions.deployment.resources | nindent 12 }} volumeMounts: - mountPath: /certs/server name: docker-certs - {{- with .Values.actions.statefulset.nodeSelector }} + {{- with .Values.actions.deployment.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.actions.statefulset.affinity }} + {{- with .Values.actions.deployment.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.actions.statefulset.tolerations }} + {{- with .Values.actions.deployment.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} @@ -105,12 +103,4 @@ spec: name: {{ include "gitea.fullname" . }}-act-runner-config - name: docker-certs emptyDir: {} - volumeClaimTemplates: - - metadata: - name: data-act-runner - spec: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 1Mi {{- end }} diff --git a/unittests/act_runner/config-act-runner.yaml b/unittests/act_runner/config-act-runner.yaml index a9a1a85..34c4e47 100644 --- a/unittests/act_runner/config-act-runner.yaml +++ b/unittests/act_runner/config-act-runner.yaml @@ -9,7 +9,7 @@ tests: template: templates/gitea/act_runner/config-act-runner.yaml set: actions: - statefulset: + deployment: enabled: true asserts: - hasDocuments: diff --git a/unittests/act_runner/config-scripts.yaml b/unittests/act_runner/config-scripts.yaml index 93314db..6605c39 100644 --- a/unittests/act_runner/config-scripts.yaml +++ b/unittests/act_runner/config-scripts.yaml @@ -5,7 +5,7 @@ release: templates: - templates/gitea/act_runner/config-scripts.yaml tests: - - it: renders a deployment + - it: renders a ConfigMap template: templates/gitea/act_runner/config-scripts.yaml set: actions: diff --git a/unittests/act_runner/statefulset.yaml b/unittests/act_runner/deployment.yaml similarity index 55% rename from unittests/act_runner/statefulset.yaml rename to unittests/act_runner/deployment.yaml index d94cb4a..cece4d5 100644 --- a/unittests/act_runner/statefulset.yaml +++ b/unittests/act_runner/deployment.yaml @@ -1,20 +1,20 @@ -suite: actions template | statefulset +suite: actions template | deployment release: name: gitea-unittests namespace: testing templates: - - templates/gitea/act_runner/statefulset.yaml + - templates/gitea/act_runner/deployment.yaml tests: - - it: renders a deployment - template: templates/gitea/act_runner/statefulset.yaml + - it: renders a Deployment + template: templates/gitea/act_runner/deployment.yaml set: actions: - statefulset: + deployment: enabled: true asserts: - hasDocuments: count: 1 - containsDocument: - kind: StatefulSet + kind: Deployment apiVersion: apps/v1 name: gitea-unittests-act-runner diff --git a/unittests/act_runner/job.yaml b/unittests/act_runner/job.yaml index 6ba7e7f..55f195c 100644 --- a/unittests/act_runner/job.yaml +++ b/unittests/act_runner/job.yaml @@ -5,7 +5,7 @@ release: templates: - templates/gitea/act_runner/job.yaml tests: - - it: renders a deployment + - it: renders a Job template: templates/gitea/act_runner/job.yaml set: actions: diff --git a/unittests/act_runner/role-job.yaml b/unittests/act_runner/role-job.yaml index 217f45a..9c04ba4 100644 --- a/unittests/act_runner/role-job.yaml +++ b/unittests/act_runner/role-job.yaml @@ -5,7 +5,7 @@ release: templates: - templates/gitea/act_runner/role-job.yaml tests: - - it: renders a role + - it: renders a Role template: templates/gitea/act_runner/role-job.yaml set: actions: diff --git a/unittests/act_runner/rolebinding-job.yaml b/unittests/act_runner/rolebinding-job.yaml index 7c9d416..871364c 100644 --- a/unittests/act_runner/rolebinding-job.yaml +++ b/unittests/act_runner/rolebinding-job.yaml @@ -5,7 +5,7 @@ release: templates: - templates/gitea/act_runner/rolebinding-job.yaml tests: - - it: renders a deployment + - it: renders a RoleBinding template: templates/gitea/act_runner/rolebinding-job.yaml set: actions: diff --git a/unittests/act_runner/secret-token.yaml b/unittests/act_runner/secret-token.yaml index 9cae9b6..41458d9 100644 --- a/unittests/act_runner/secret-token.yaml +++ b/unittests/act_runner/secret-token.yaml @@ -5,7 +5,7 @@ release: templates: - templates/gitea/act_runner/secret-token.yaml tests: - - it: renders a deployment + - it: renders a Secret template: templates/gitea/act_runner/secret-token.yaml set: actions: diff --git a/unittests/act_runner/serviceaccount-job.yaml b/unittests/act_runner/serviceaccount-job.yaml index f0f82a9..753a421 100644 --- a/unittests/act_runner/serviceaccount-job.yaml +++ b/unittests/act_runner/serviceaccount-job.yaml @@ -5,7 +5,7 @@ release: templates: - templates/gitea/act_runner/serviceaccount-job.yaml tests: - - it: renders a deployment + - it: renders a ServiceAccount template: templates/gitea/act_runner/serviceaccount-job.yaml set: actions: diff --git a/values.yaml b/values.yaml index b44a91c..bfc9e9c 100644 --- a/values.yaml +++ b/values.yaml @@ -336,21 +336,21 @@ signing: # - must define deployment.env.GITEA__ACTIONS__ENABLED and GITEA__SERVER__LOCAL_ROOT_URL ## @section GiteaActions # -## @param actions.statefulset.enabled Create an act runner StatefulSet. -## @param actions.statefulset.annotations Act runner annotations -## @param actions.statefulset.labels Act runner labels -## @param actions.statefulset.resources Act runner resources -## @param actions.statefulset.nodeSelector NodeSelector for the statefulset -## @param actions.statefulset.tolerations Tolerations for the statefulset -## @param actions.statefulset.affinity Affinity for the statefulset -## @param actions.statefulset.config Act runner custom configuration. -## @param actions.statefulset.runnerLabels Act runner labels. -## @param actions.statefulset.actRunnerImage.repository The Gitea act runner image -## @param actions.statefulset.actRunnerImage.tag The Gitea act runner tag -## @param actions.statefulset.actRunnerImage.pullPolicy The Gitea act runner pullPolicy -## @param actions.statefulset.dindImage.repository The Docker-in-Docker image -## @param actions.statefulset.dindImage.tag The Docker-in-Docker image tag -## @param actions.statefulset.dindImage.pullPolicy The Docker-in-Docker pullPolicy +## @param actions.deployment.enabled Create an act runner Deployment +## @param actions.deployment.annotations Act runner annotations +## @param actions.deployment.labels Act runner labels +## @param actions.deployment.resources Act runner resources +## @param actions.deployment.nodeSelector NodeSelector for the deployment +## @param actions.deployment.tolerations Tolerations for the deployment +## @param actions.deployment.affinity Affinity for the deployment +## @param actions.deployment.config Act runner custom configuration +## @param actions.deployment.runnerLabels Act runner labels. +## @param actions.deployment.actRunnerImage.repository The Gitea act runner image +## @param actions.deployment.actRunnerImage.tag The Gitea act runner tag +## @param actions.deployment.actRunnerImage.pullPolicy The Gitea act runner pullPolicy +## @param actions.deployment.dindImage.repository The Docker-in-Docker image +## @param actions.deployment.dindImage.tag The Docker-in-Docker image tag +## @param actions.deployment.dindImage.pullPolicy The Docker-in-Docker pullPolicy ## @param actions.job.enabled Create a job that will create and save the token in a Kubernetes Secret ## @param actions.job.annotations Job's annotations ## @param actions.job.labels Job's labels @@ -367,7 +367,7 @@ signing: ## @param actions.existingSecret Secret that contains the token ## @param actions.existingSecretKey Secret key actions: - statefulset: + deployment: enabled: false annotations: {}