Revert "Changed actions from StatefulSet to Deployment"

This reverts commit e8aedb258c.
This commit is contained in:
dementhorr 2024-02-14 19:14:28 +01:00
parent e8aedb258c
commit 32cd9a846a
12 changed files with 89 additions and 79 deletions

View file

@ -982,38 +982,38 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
### GiteaActions ### GiteaActions
| Name | Description | Value | | Name | Description | Value |
| ---------------------------------------------- | --------------------------------------------------------------------------- | ------------------ | | ----------------------------------------------- | --------------------------------------------------------------------------- | ------------------ |
| `actions.deployment.enabled` | Create an act runner Deployment | `false` | | `actions.statefulset.enabled` | Create an act runner StatefulSet. | `false` |
| `actions.deployment.annotations` | Act runner annotations | `{}` | | `actions.statefulset.annotations` | Act runner annotations | `{}` |
| `actions.deployment.labels` | Act runner labels | `{}` | | `actions.statefulset.labels` | Act runner labels | `{}` |
| `actions.deployment.resources` | Act runner resources | `{}` | | `actions.statefulset.resources` | Act runner resources | `{}` |
| `actions.deployment.nodeSelector` | NodeSelector for the deployment | `{}` | | `actions.statefulset.nodeSelector` | NodeSelector for the statefulset | `{}` |
| `actions.deployment.tolerations` | Tolerations for the deployment | `[]` | | `actions.statefulset.tolerations` | Tolerations for the statefulset | `[]` |
| `actions.deployment.affinity` | Affinity for the deployment | `{}` | | `actions.statefulset.affinity` | Affinity for the statefulset | `{}` |
| `actions.deployment.config` | Act runner custom configuration | `""` | | `actions.statefulset.config` | Act runner custom configuration. | `""` |
| `actions.deployment.runnerLabels` | Act runner labels. | `""` | | `actions.statefulset.runnerLabels` | Act runner labels. | `""` |
| `actions.deployment.actRunnerImage.repository` | The Gitea act runner image | `gitea/act_runner` | | `actions.statefulset.actRunnerImage.repository` | The Gitea act runner image | `gitea/act_runner` |
| `actions.deployment.actRunnerImage.tag` | The Gitea act runner tag | `0.2.6` | | `actions.statefulset.actRunnerImage.tag` | The Gitea act runner tag | `0.2.6` |
| `actions.deployment.actRunnerImage.pullPolicy` | The Gitea act runner pullPolicy | `IfNotPresent` | | `actions.statefulset.actRunnerImage.pullPolicy` | The Gitea act runner pullPolicy | `IfNotPresent` |
| `actions.deployment.dindImage.repository` | The Docker-in-Docker image | `docker` | | `actions.statefulset.dindImage.repository` | The Docker-in-Docker image | `docker` |
| `actions.deployment.dindImage.tag` | The Docker-in-Docker image tag | `24.0.7-dind` | | `actions.statefulset.dindImage.tag` | The Docker-in-Docker image tag | `24.0.7-dind` |
| `actions.deployment.dindImage.pullPolicy` | The Docker-in-Docker pullPolicy | `IfNotPresent` | | `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.enabled` | Create a job that will create and save the token in a Kubernetes Secret | `false` |
| `actions.job.annotations` | Job's annotations | `{}` | | `actions.job.annotations` | Job's annotations | `{}` |
| `actions.job.labels` | Job's labels | `{}` | | `actions.job.labels` | Job's labels | `{}` |
| `actions.job.resources` | Job's resources | `{}` | | `actions.job.resources` | Job's resources | `{}` |
| `actions.job.nodeSelector` | NodeSelector for the job | `{}` | | `actions.job.nodeSelector` | NodeSelector for the job | `{}` |
| `actions.job.tolerations` | Tolerations for the job | `[]` | | `actions.job.tolerations` | Tolerations for the job | `[]` |
| `actions.job.affinity` | Affinity 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.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.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.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.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.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.job.publishImage.pullPolicy` | The publish image pullPolicy that can create the secret | `IfNotPresent` |
| `actions.existingSecret` | Secret that contains the token | `""` | | `actions.existingSecret` | Secret that contains the token | `""` |
| `actions.existingSecretKey` | Secret key | `""` | | `actions.existingSecretKey` | Secret key | `""` |
### Gitea ### Gitea

View file

@ -1,4 +1,4 @@
{{- if .Values.actions.deployment.enabled }} {{- if and (and .Values.actions.statefulset.enabled .Values.persistence.enabled) .Values.persistence.mount }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -7,9 +7,9 @@ metadata:
labels: labels:
{{- include "gitea.labels" . | nindent 4 }} {{- include "gitea.labels" . | nindent 4 }}
data: data:
{{- if .Values.actions.deployment.config }} {{- if .Values.actions.statefulset.config }}
config.yaml: | config.yaml: |
{{- with .Values.actions.deployment.config -}} {{- with .Values.actions.statefulset.config -}}
{{ . | nindent 4}} {{ . | nindent 4}}
{{- end -}} {{- end -}}
{{- else }} {{- else }}

View file

@ -1,16 +1,16 @@
{{- if .Values.actions.deployment.enabled }} {{- if and (and .Values.actions.statefulset.enabled .Values.persistence.enabled) .Values.persistence.mount }}
{{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }} {{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }}
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: StatefulSet
metadata: metadata:
labels: labels:
{{- include "gitea.labels.actRunner" . | nindent 4 }} {{- include "gitea.labels.actRunner" . | nindent 4 }}
{{- with .Values.actions.deployment.labels }} {{- with .Values.actions.statefulset.labels }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
annotations: annotations:
{{- with .Values.actions.deployment.annotations }} {{- with .Values.actions.statefulset.annotations }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
name: {{ include "gitea.fullname" . }}-act-runner name: {{ include "gitea.fullname" . }}-act-runner
@ -22,7 +22,7 @@ spec:
metadata: metadata:
labels: labels:
{{- include "gitea.labels.actRunner" . | nindent 8 }} {{- include "gitea.labels.actRunner" . | nindent 8 }}
{{- with .Values.actions.deployment.labels }} {{- with .Values.actions.statefulset.labels }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
@ -38,8 +38,8 @@ spec:
done done
containers: containers:
- name: act-runner - name: act-runner
image: "{{ .Values.actions.deployment.actRunnerImage.repository }}:{{ .Values.actions.deployment.actRunnerImage.tag }}" image: "{{ .Values.actions.statefulset.actRunnerImage.repository }}:{{ .Values.actions.statefulset.actRunnerImage.tag }}"
imagePullPolicy: {{ .Values.actions.deployment.actRunnerImage.pullPolicy }} imagePullPolicy: {{ .Values.actions.statefulset.actRunnerImage.pullPolicy }}
workingDir: /data workingDir: /data
env: env:
- name: DOCKER_HOST - name: DOCKER_HOST
@ -56,20 +56,22 @@ spec:
- name: GITEA_INSTANCE_URL - name: GITEA_INSTANCE_URL
value: "http://{{ include "gitea.fullname" . }}-http:{{ .Values.service.http.port }}" value: "http://{{ include "gitea.fullname" . }}-http:{{ .Values.service.http.port }}"
- name: GITEA_RUNNER_LABELS - name: GITEA_RUNNER_LABELS
value: "{{ .Values.actions.deployment.runnerLabels | default "ubuntu-latest" }}" value: "{{ .Values.actions.statefulset.runnerLabels | default "ubuntu-latest" }}"
- name: CONFIG_FILE - name: CONFIG_FILE
value: /actrunner/config.yaml value: /actrunner/config.yaml
resources: resources:
{{- toYaml .Values.actions.deployment.resources | nindent 12 }} {{- toYaml .Values.actions.statefulset.resources | nindent 12 }}
volumeMounts: volumeMounts:
- mountPath: /actrunner/config.yaml - mountPath: /actrunner/config.yaml
name: act-runner-config name: act-runner-config
subPath: config.yaml subPath: config.yaml
- mountPath: /certs/server - mountPath: /certs/server
name: docker-certs name: docker-certs
- mountPath: /data
name: data-act-runner
- name: dind - name: dind
image: "{{ .Values.actions.deployment.dindImage.repository }}:{{ .Values.actions.deployment.dindImage.tag }}" image: "{{ .Values.actions.statefulset.dindImage.repository }}:{{ .Values.actions.statefulset.dindImage.tag }}"
imagePullPolicy: {{ .Values.actions.deployment.dindImage.pullPolicy }} imagePullPolicy: {{ .Values.actions.statefulset.dindImage.pullPolicy }}
env: env:
- name: DOCKER_HOST - name: DOCKER_HOST
value: tcp://127.0.0.1:2376 value: tcp://127.0.0.1:2376
@ -81,19 +83,19 @@ spec:
# allowPrivilegeEscalation: true # allowPrivilegeEscalation: true
privileged: true privileged: true
resources: resources:
{{- toYaml .Values.actions.deployment.resources | nindent 12 }} {{- toYaml .Values.actions.statefulset.resources | nindent 12 }}
volumeMounts: volumeMounts:
- mountPath: /certs/server - mountPath: /certs/server
name: docker-certs name: docker-certs
{{- with .Values.actions.deployment.nodeSelector }} {{- with .Values.actions.statefulset.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.actions.deployment.affinity }} {{- with .Values.actions.statefulset.affinity }}
affinity: affinity:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.actions.deployment.tolerations }} {{- with .Values.actions.statefulset.tolerations }}
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
@ -103,4 +105,12 @@ spec:
name: {{ include "gitea.fullname" . }}-act-runner-config name: {{ include "gitea.fullname" . }}-act-runner-config
- name: docker-certs - name: docker-certs
emptyDir: {} emptyDir: {}
volumeClaimTemplates:
- metadata:
name: data-act-runner
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Mi
{{- end }} {{- end }}

View file

@ -9,7 +9,7 @@ tests:
template: templates/gitea/act_runner/config-act-runner.yaml template: templates/gitea/act_runner/config-act-runner.yaml
set: set:
actions: actions:
deployment: statefulset:
enabled: true enabled: true
asserts: asserts:
- hasDocuments: - hasDocuments:

View file

@ -5,7 +5,7 @@ release:
templates: templates:
- templates/gitea/act_runner/config-scripts.yaml - templates/gitea/act_runner/config-scripts.yaml
tests: tests:
- it: renders a ConfigMap - it: renders a deployment
template: templates/gitea/act_runner/config-scripts.yaml template: templates/gitea/act_runner/config-scripts.yaml
set: set:
actions: actions:

View file

@ -5,7 +5,7 @@ release:
templates: templates:
- templates/gitea/act_runner/job.yaml - templates/gitea/act_runner/job.yaml
tests: tests:
- it: renders a Job - it: renders a deployment
template: templates/gitea/act_runner/job.yaml template: templates/gitea/act_runner/job.yaml
set: set:
actions: actions:

View file

@ -5,7 +5,7 @@ release:
templates: templates:
- templates/gitea/act_runner/role-job.yaml - templates/gitea/act_runner/role-job.yaml
tests: tests:
- it: renders a Role - it: renders a role
template: templates/gitea/act_runner/role-job.yaml template: templates/gitea/act_runner/role-job.yaml
set: set:
actions: actions:

View file

@ -5,7 +5,7 @@ release:
templates: templates:
- templates/gitea/act_runner/rolebinding-job.yaml - templates/gitea/act_runner/rolebinding-job.yaml
tests: tests:
- it: renders a RoleBinding - it: renders a deployment
template: templates/gitea/act_runner/rolebinding-job.yaml template: templates/gitea/act_runner/rolebinding-job.yaml
set: set:
actions: actions:

View file

@ -5,7 +5,7 @@ release:
templates: templates:
- templates/gitea/act_runner/secret-token.yaml - templates/gitea/act_runner/secret-token.yaml
tests: tests:
- it: renders a Secret - it: renders a deployment
template: templates/gitea/act_runner/secret-token.yaml template: templates/gitea/act_runner/secret-token.yaml
set: set:
actions: actions:

View file

@ -5,7 +5,7 @@ release:
templates: templates:
- templates/gitea/act_runner/serviceaccount-job.yaml - templates/gitea/act_runner/serviceaccount-job.yaml
tests: tests:
- it: renders a ServiceAccount - it: renders a deployment
template: templates/gitea/act_runner/serviceaccount-job.yaml template: templates/gitea/act_runner/serviceaccount-job.yaml
set: set:
actions: actions:

View file

@ -1,20 +1,20 @@
suite: actions template | deployment suite: actions template | statefulset
release: release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
templates: templates:
- templates/gitea/act_runner/deployment.yaml - templates/gitea/act_runner/statefulset.yaml
tests: tests:
- it: renders a Deployment - it: renders a deployment
template: templates/gitea/act_runner/deployment.yaml template: templates/gitea/act_runner/statefulset.yaml
set: set:
actions: actions:
deployment: statefulset:
enabled: true enabled: true
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 1 count: 1
- containsDocument: - containsDocument:
kind: Deployment kind: StatefulSet
apiVersion: apps/v1 apiVersion: apps/v1
name: gitea-unittests-act-runner name: gitea-unittests-act-runner

View file

@ -336,21 +336,21 @@ signing:
# - must define deployment.env.GITEA__ACTIONS__ENABLED and GITEA__SERVER__LOCAL_ROOT_URL # - must define deployment.env.GITEA__ACTIONS__ENABLED and GITEA__SERVER__LOCAL_ROOT_URL
## @section GiteaActions ## @section GiteaActions
# #
## @param actions.deployment.enabled Create an act runner Deployment ## @param actions.statefulset.enabled Create an act runner StatefulSet.
## @param actions.deployment.annotations Act runner annotations ## @param actions.statefulset.annotations Act runner annotations
## @param actions.deployment.labels Act runner labels ## @param actions.statefulset.labels Act runner labels
## @param actions.deployment.resources Act runner resources ## @param actions.statefulset.resources Act runner resources
## @param actions.deployment.nodeSelector NodeSelector for the deployment ## @param actions.statefulset.nodeSelector NodeSelector for the statefulset
## @param actions.deployment.tolerations Tolerations for the deployment ## @param actions.statefulset.tolerations Tolerations for the statefulset
## @param actions.deployment.affinity Affinity for the deployment ## @param actions.statefulset.affinity Affinity for the statefulset
## @param actions.deployment.config Act runner custom configuration ## @param actions.statefulset.config Act runner custom configuration.
## @param actions.deployment.runnerLabels Act runner labels. ## @param actions.statefulset.runnerLabels Act runner labels.
## @param actions.deployment.actRunnerImage.repository The Gitea act runner image ## @param actions.statefulset.actRunnerImage.repository The Gitea act runner image
## @param actions.deployment.actRunnerImage.tag The Gitea act runner tag ## @param actions.statefulset.actRunnerImage.tag The Gitea act runner tag
## @param actions.deployment.actRunnerImage.pullPolicy The Gitea act runner pullPolicy ## @param actions.statefulset.actRunnerImage.pullPolicy The Gitea act runner pullPolicy
## @param actions.deployment.dindImage.repository The Docker-in-Docker image ## @param actions.statefulset.dindImage.repository The Docker-in-Docker image
## @param actions.deployment.dindImage.tag The Docker-in-Docker image tag ## @param actions.statefulset.dindImage.tag The Docker-in-Docker image tag
## @param actions.deployment.dindImage.pullPolicy The Docker-in-Docker pullPolicy ## @param actions.statefulset.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.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.annotations Job's annotations
## @param actions.job.labels Job's labels ## @param actions.job.labels Job's labels
@ -367,7 +367,7 @@ signing:
## @param actions.existingSecret Secret that contains the token ## @param actions.existingSecret Secret that contains the token
## @param actions.existingSecretKey Secret key ## @param actions.existingSecretKey Secret key
actions: actions:
deployment: statefulset:
enabled: false enabled: false
annotations: {} annotations: {}