Changed actions from StatefulSet to Deployment

This commit is contained in:
dementhorr 2024-02-11 16:29:14 +01:00
parent 50f607cdba
commit e8aedb258c
12 changed files with 79 additions and 89 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 deployment
- it: renders a RoleBinding
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 deployment
- it: renders a Secret
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 deployment
- it: renders a ServiceAccount
template: templates/gitea/act_runner/serviceaccount-job.yaml
set:
actions:

View File

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