Skip to content

Commit 89e03c5

Browse files
feat: gitea app operator (#1624)
Co-authored-by: Jehoszafat Zimnowoda <[email protected]>
1 parent d8648fd commit 89e03c5

19 files changed

+149
-147
lines changed
File renamed without changes.

charts/gitea-operator/Chart.yaml charts/apl-gitea-operator/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
name: gitea-operator
2+
name: apl-gitea-operator
33
description: A Helm chart for Kubernetes
44

55
# A chart can be either an 'application' or a 'library' chart.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The apl-gitea-operator has been deployed.

charts/gitea-operator/templates/_helpers.tpl charts/apl-gitea-operator/templates/_helpers.tpl

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{/*
22
Expand the name of the chart.
33
*/}}
4-
{{- define "gitea-operator.name" -}}
4+
{{- define "apl-gitea-operator.name" -}}
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

@@ -10,7 +10,7 @@ Create a default fully qualified app name.
1010
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1111
If release name contains chart name it will be used as a full name.
1212
*/}}
13-
{{- define "gitea-operator.fullname" -}}
13+
{{- define "apl-gitea-operator.fullname" -}}
1414
{{- if .Values.fullnameOverride }}
1515
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1616
{{- else }}
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
2626
{{/*
2727
Create chart name and version as used by the chart label.
2828
*/}}
29-
{{- define "gitea-operator.chart" -}}
29+
{{- define "apl-gitea-operator.chart" -}}
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

3333
{{/*
3434
Common labels
3535
*/}}
36-
{{- define "gitea-operator.labels" -}}
37-
helm.sh/chart: {{ include "gitea-operator.chart" . }}
38-
{{ include "gitea-operator.selectorLabels" . }}
36+
{{- define "apl-gitea-operator.labels" -}}
37+
helm.sh/chart: {{ include "apl-gitea-operator.chart" . }}
38+
{{ include "apl-gitea-operator.selectorLabels" . }}
3939
{{- if .Chart.AppVersion }}
4040
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4141
{{- end }}
@@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
4545
{{/*
4646
Selector labels
4747
*/}}
48-
{{- define "gitea-operator.selectorLabels" -}}
49-
app.kubernetes.io/name: {{ include "gitea-operator.name" . }}
48+
{{- define "apl-gitea-operator.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "apl-gitea-operator.name" . }}
5050
app.kubernetes.io/instance: {{ .Release.Name }}
5151
{{- end }}
5252

5353
{{/*
5454
Create the name of the service account to use
5555
*/}}
56-
{{- define "gitea-operator.serviceAccountName" -}}
56+
{{- define "apl-gitea-operator.serviceAccountName" -}}
5757
{{- if .Values.serviceAccount.create }}
58-
{{- default (include "gitea-operator.fullname" .) .Values.serviceAccount.name }}
58+
{{- default (include "apl-gitea-operator.fullname" .) .Values.serviceAccount.name }}
5959
{{- else }}
6060
{{- .Values.serviceAccount.name }}
6161
{{- end }}

charts/gitea-operator/templates/deployment.yaml charts/apl-gitea-operator/templates/deployment.yaml

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "gitea-operator.fullname" . }}
4+
name: {{ include "apl-gitea-operator.fullname" . }}
55
labels:
6-
{{- include "gitea-operator.labels" . | nindent 4 }}
6+
{{- include "apl-gitea-operator.labels" . | nindent 4 }}
77
spec:
88
replicas: {{ .Values.replicaCount }}
99
selector:
1010
matchLabels:
11-
{{- include "gitea-operator.selectorLabels" . | nindent 6 }}
11+
{{- include "apl-gitea-operator.selectorLabels" . | nindent 6 }}
1212
template:
1313
metadata:
1414
{{- with .Values.podAnnotations }}
1515
annotations:
1616
{{- toYaml . | nindent 8 }}
1717
{{- end }}
1818
labels:
19-
{{- include "gitea-operator.selectorLabels" . | nindent 8 }}
19+
{{- include "apl-gitea-operator.selectorLabels" . | nindent 8 }}
2020
spec:
2121
{{- with .Values.imagePullSecrets }}
2222
imagePullSecrets:
2323
{{- toYaml . | nindent 8 }}
2424
{{- end }}
25-
serviceAccountName: {{ include "gitea-operator.serviceAccountName" . }}
25+
serviceAccountName: {{ include "apl-gitea-operator.serviceAccountName" . }}
2626
securityContext:
2727
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2828
containers:
@@ -32,20 +32,13 @@ spec:
3232
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3333
imagePullPolicy: {{ .Values.image.pullPolicy }}
3434
command: [npm, run, operator:gitea]
35-
ports:
36-
- name: http
37-
containerPort: {{ .Values.service.port }}
38-
protocol: TCP
39-
# livenessProbe:
40-
# httpGet:
41-
# path: /live
42-
# port: 8080
43-
# failureThreshold: 3
44-
# initialDelaySeconds: 10
45-
# # Allow sufficient amount of time (90 seconds = periodSeconds * failureThreshold)
46-
# # for the registered shutdown handlers to run to completion.
47-
# periodSeconds: 30
48-
# successThreshold: 1
35+
env:
36+
- name: GITEA_URL
37+
value: "{{ .Values.env.GITEA_URL }}"
38+
- name: GITEA_URL_PORT
39+
value: "{{ .Values.env.GITEA_URL_PORT }}"
40+
- name: GITEA_OPERATOR_NAMESPACE
41+
value: "{{ .Values.env.GITEA_OPERATOR_NAMESPACE }}"
4942
resources:
5043
{{- toYaml .Values.resources | nindent 12 }}
5144
{{- with .Values.nodeSelector }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{- if .Values.serviceAccount.create }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "apl-gitea-operator.serviceAccountName" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
automountServiceAccountToken: true
8+
---
9+
# Role for configmaps and secrets in apl-gitea-operator namespace
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: Role
12+
metadata:
13+
name: {{ include "apl-gitea-operator.fullname" . }}-configs-secrets
14+
namespace: apl-gitea-operator
15+
rules:
16+
# Allows the operator to read and watch configmaps and secrets in the operator namespace. This is necessary to set up the gitea configuration.
17+
- apiGroups: [""]
18+
resources: ["configmaps", "secrets"]
19+
verbs: ["get", "watch", "list"]
20+
---
21+
# RoleBinding for the above Role in apl-gitea-operator namespace
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: RoleBinding
24+
metadata:
25+
name: {{ include "apl-gitea-operator.fullname" . }}-configs-secrets-binding
26+
namespace: apl-gitea-operator
27+
subjects:
28+
- kind: ServiceAccount
29+
namespace: {{ .Release.Namespace }}
30+
name: {{ include "apl-gitea-operator.serviceAccountName" . }}
31+
roleRef:
32+
kind: Role
33+
name: {{ include "apl-gitea-operator.fullname" . }}-configs-secrets
34+
apiGroup: rbac.authorization.k8s.io
35+
---
36+
# Role for pods/exec in gitea namespace
37+
apiVersion: rbac.authorization.k8s.io/v1
38+
kind: Role
39+
metadata:
40+
name: {{ include "apl-gitea-operator.fullname" . }}-pod-exec
41+
namespace: gitea
42+
rules:
43+
# Allows the operator to execute commands within pods in the gitea namespace. This is necessary to set up gitea group mapping and OIDC configuration.
44+
- apiGroups: [""]
45+
resources: ["pods/exec"]
46+
verbs: ["create", "get", "post"]
47+
---
48+
# RoleBinding for the above Role in gitea namespace
49+
apiVersion: rbac.authorization.k8s.io/v1
50+
kind: RoleBinding
51+
metadata:
52+
name: {{ include "apl-gitea-operator.fullname" . }}-pod-exec-binding
53+
namespace: gitea
54+
subjects:
55+
- kind: ServiceAccount
56+
namespace: {{ .Release.Namespace }}
57+
name: {{ include "apl-gitea-operator.serviceAccountName" . }}
58+
roleRef:
59+
kind: Role
60+
name: {{ include "apl-gitea-operator.fullname" . }}-pod-exec
61+
apiGroup: rbac.authorization.k8s.io
62+
{{- end }}

charts/gitea-operator/values.yaml charts/apl-gitea-operator/values.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Default values for gitea-operator.
1+
# Default values for apl-gitea-operator.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

@@ -13,13 +13,11 @@ image:
1313
imagePullSecrets: []
1414
nameOverride: ""
1515
fullnameOverride: ""
16-
service:
17-
port: 8080
1816

1917
# Service Account requires access to gitea pod to edit the oauth through CLI commands
2018
serviceAccount:
2119
create: true
22-
name: "gitea-operator"
20+
name: "apl-gitea-operator"
2321
annotations: {}
2422

2523
podAnnotations: {}
@@ -57,3 +55,5 @@ nodeSelector: {}
5755
tolerations: []
5856

5957
affinity: {}
58+
59+
env: {}

charts/gitea-operator/templates/NOTES.txt

-1
This file was deleted.

charts/gitea-operator/templates/rbac.yaml

-36
This file was deleted.

charts/gitea-operator/templates/tests/test-connection.yaml

-15
This file was deleted.

core.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ k8s:
2424
- name: harbor
2525
app: harbor
2626
- name: gitea
27-
- name: gitea-operator
27+
- name: apl-gitea-operator
2828
disableIstioInjection: true
2929
- name: grafana
3030
app: grafana

helmfile.d/helmfile-03.init.yaml

+10-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ releases:
4040
labels:
4141
pkg: gitea
4242
<<: *raw
43-
- name: gitea-operator
44-
installed: true
45-
namespace: gitea-operator
43+
- name: apl-gitea-operator-artifacts
44+
installed: {{ $a | get "gitea.enabled" }}
45+
namespace: apl-gitea-operator
46+
labels:
47+
pkg: apl-gitea-operator
48+
<<: *raw
49+
- name: apl-gitea-operator
50+
installed: {{ $a | get "gitea.enabled" }}
51+
namespace: apl-gitea-operator
4652
labels:
47-
pkg: gitea-operator
53+
pkg: apl-gitea-operator
4854
<<: *default
4955
- name: kiali-operator-artifacts
5056
installed: {{ $a | get "kiali.enabled" }}

helmfile.d/helmfile-59.pre-teams.yaml

-20
This file was deleted.

helmfile.d/snippets/defaults.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ environments:
181181
gitea:
182182
enabled: true
183183
adminUsername: otomi-admin
184-
gitea-operator:
184+
apl-gitea-operator:
185185
resources:
186186
operator:
187187
requests:

helmfile.d/snippets/values-gitea-prepare.gotmpl

-13
This file was deleted.

values-schema.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -2538,6 +2538,16 @@ properties:
25382538
properties:
25392539
operator:
25402540
$ref: '#/definitions/resources'
2541+
apl-gitea-operator:
2542+
additionalProperties: false
2543+
properties:
2544+
_rawValues:
2545+
$ref: '#/definitions/rawValues'
2546+
resources:
2547+
additionalProperties: false
2548+
properties:
2549+
operator:
2550+
$ref: '#/definitions/resources'
25412551
apl-keycloak-operator:
25422552
additionalProperties: false
25432553
properties:

0 commit comments

Comments
 (0)