Revert "Changed actions from StatefulSet to Deployment"

This reverts commit e8aedb258cfa840107b2390a729c330bd1ead6e6.
This commit is contained in:
dementhorr 2024-02-14 19:14:28 +01:00 committed by Vince Montalbano
parent 4f00ac1456
commit 5456b1b76e
12 changed files with 89 additions and 79 deletions

View File

@ -1001,38 +1001,38 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
### GiteaActions
| 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 | `""` |
| 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 | `""` |
### 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
kind: ConfigMap
@ -7,9 +7,9 @@ metadata:
labels:
{{- include "gitea.labels" . | nindent 4 }}
data:
{{- if .Values.actions.deployment.config }}
{{- if .Values.actions.statefulset.config }}
config.yaml: |
{{- with .Values.actions.deployment.config -}}
{{- with .Values.actions.statefulset.config -}}
{{ . | nindent 4}}
{{- end -}}
{{- 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") }}
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
labels:
{{- include "gitea.labels.actRunner" . | nindent 4 }}
{{- with .Values.actions.deployment.labels }}
{{- with .Values.actions.statefulset.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.actions.deployment.annotations }}
{{- with .Values.actions.statefulset.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.deployment.labels }}
{{- with .Values.actions.statefulset.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
@ -38,8 +38,8 @@ spec:
done
containers:
- name: act-runner
image: "{{ .Values.actions.deployment.actRunnerImage.repository }}:{{ .Values.actions.deployment.actRunnerImage.tag }}"
imagePullPolicy: {{ .Values.actions.deployment.actRunnerImage.pullPolicy }}
image: "{{ .Values.actions.statefulset.actRunnerImage.repository }}:{{ .Values.actions.statefulset.actRunnerImage.tag }}"
imagePullPolicy: {{ .Values.actions.statefulset.actRunnerImage.pullPolicy }}
workingDir: /data
env:
- name: DOCKER_HOST
@ -56,20 +56,22 @@ spec:
- name: GITEA_INSTANCE_URL
value: "http://{{ include "gitea.fullname" . }}-http:{{ .Values.service.http.port }}"
- name: GITEA_RUNNER_LABELS
value: "{{ .Values.actions.deployment.runnerLabels | default "ubuntu-latest" }}"
value: "{{ .Values.actions.statefulset.runnerLabels | default "ubuntu-latest" }}"
- name: CONFIG_FILE
value: /actrunner/config.yaml
resources:
{{- toYaml .Values.actions.deployment.resources | nindent 12 }}
{{- toYaml .Values.actions.statefulset.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.deployment.dindImage.repository }}:{{ .Values.actions.deployment.dindImage.tag }}"
imagePullPolicy: {{ .Values.actions.deployment.dindImage.pullPolicy }}
image: "{{ .Values.actions.statefulset.dindImage.repository }}:{{ .Values.actions.statefulset.dindImage.tag }}"
imagePullPolicy: {{ .Values.actions.statefulset.dindImage.pullPolicy }}
env:
- name: DOCKER_HOST
value: tcp://127.0.0.1:2376
@ -81,19 +83,19 @@ spec:
# allowPrivilegeEscalation: true
privileged: true
resources:
{{- toYaml .Values.actions.deployment.resources | nindent 12 }}
{{- toYaml .Values.actions.statefulset.resources | nindent 12 }}
volumeMounts:
- mountPath: /certs/server
name: docker-certs
{{- with .Values.actions.deployment.nodeSelector }}
{{- with .Values.actions.statefulset.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.actions.deployment.affinity }}
{{- with .Values.actions.statefulset.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.actions.deployment.tolerations }}
{{- with .Values.actions.statefulset.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
@ -103,4 +105,12 @@ 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 }}

View File

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

View File

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

View File

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

View File

@ -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:

View File

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

View File

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

View File

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

View File

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

View File

@ -344,21 +344,21 @@ signing:
# - must define deployment.env.GITEA__ACTIONS__ENABLED and GITEA__SERVER__LOCAL_ROOT_URL
## @section GiteaActions
#
## @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.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.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
@ -375,7 +375,7 @@ signing:
## @param actions.existingSecret Secret that contains the token
## @param actions.existingSecretKey Secret key
actions:
deployment:
statefulset:
enabled: false
annotations: {}