Skip to content

Commit 5ffb36b

Browse files
feat: replace install job by apl-operator (#2501)
Co-authored-by: svcAPLBot <[email protected]>
1 parent 7775c2f commit 5ffb36b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4373
-2419
lines changed

chart/apl/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
apiVersion: v2
2-
name: apl
2+
name: apl-operator
33
description: A Helm chart for installing APL in Kubernetes
44
home: https://techdocs.akamai.com/app-platform/docs/welcome
55
type: application
66
version: 0.0.0-chart-version
7-
appVersion: APP_VERSION_PLACEHOLDER
7+
appVersion: "main"
88
keywords:
99
- linode
1010
- lke
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: apl-operator
5+
labels:
6+
kubernetes.io/metadata.name: apl-operator
7+
name: apl-operator
8+
---
9+
apiVersion: v1
10+
kind: Namespace
11+
metadata:
12+
name: otomi
13+
labels:
14+
kubernetes.io/metadata.name: otomi
15+
name: otomi

chart/apl/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The APL installer was successfully deployed on the cluster.
22

3-
Please inspect the output of the installer job ({{ .Release.Namespace }}/{{ include "apl.fullname" . }}) for any feedback or errors.
3+
Please inspect the output of the installer job ({{ .Release.Namespace }}/{{ include "apl-operator.fullname" . }}) for any feedback or errors.
44

55
Also visit https://apl-docs.net for further instructions and reference documentation.

chart/apl/templates/_helpers.tpl

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
{{/*
22
Expand the name of the chart.
33
*/}}
4-
{{- define "apl.name" -}}
4+
{{- define "apl-operator.name" -}}
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

88
{{/*
99
Create a default fully qualified app name.
10-
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11-
If release name contains chart name it will be used as a full name.
10+
Always returns "apl-operator" to ensure consistent naming.
1211
*/}}
13-
{{- define "apl.fullname" -}}
14-
{{- if .Values.fullnameOverride }}
15-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16-
{{- else }}
17-
{{- $name := default .Chart.Name .Values.nameOverride }}
18-
{{- if contains $name .Release.Name }}
19-
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20-
{{- else }}
21-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22-
{{- end }}
23-
{{- end }}
12+
{{- define "apl-operator.fullname" -}}
13+
{{- if .Values.fullnameOverride -}}
14+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
15+
{{- else -}}
16+
apl-operator
17+
{{- end -}}
2418
{{- end }}
2519

2620
{{/*
2721
Create chart name and version as used by the chart label.
2822
*/}}
29-
{{- define "apl.chart" -}}
23+
{{- define "apl-operator.chart" -}}
3024
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3125
{{- end }}
3226

3327
{{/*
3428
Common labels
3529
*/}}
36-
{{- define "apl.labels" -}}
37-
helm.sh/chart: {{ include "apl.chart" . }}
38-
{{ include "apl.selectorLabels" . }}
30+
{{- define "apl-operator.labels" -}}
31+
helm.sh/chart: {{ include "apl-operator.chart" . }}
32+
{{ include "apl-operator.selectorLabels" . }}
3933
{{- if .Chart.AppVersion }}
4034
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4135
{{- end }}
@@ -45,8 +39,19 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
4539
{{/*
4640
Selector labels
4741
*/}}
48-
{{- define "apl.selectorLabels" -}}
49-
app.kubernetes.io/name: {{ include "apl.name" . }}
50-
app.kubernetes.io/instance: {{ .Release.Name }}
42+
{{- define "apl-operator.selectorLabels" -}}
43+
app.kubernetes.io/name: apl-operator
44+
app.kubernetes.io/instance: apl-operator
45+
{{- end }}
46+
47+
{{/*
48+
Create the name of the service account to use
49+
*/}}
50+
{{- define "apl-operator.serviceAccountName" -}}
51+
{{- if .Values.serviceAccount.create }}
52+
{{- default (include "apl-operator.fullname" .) .Values.serviceAccount.name }}
53+
{{- else }}
54+
{{- .Values.serviceAccount.name }}
55+
{{- end }}
5156
{{- end }}
5257

chart/apl/templates/conf.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: git-config
5+
namespace: apl-operator
6+
data:
7+
.gitconfig: |
8+
[safe]
9+
directory = *
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{{- $kms := .Values.kms | default dict }}
2+
{{- $imageName := .Values.imageName | default "linode/apl-core" }}
3+
{{- $version := .Values.otomi.version | default .Chart.AppVersion }}
4+
{{- $useORCS := .Values.otomi.useORCS | default "true"}}
5+
apiVersion: apps/v1
6+
kind: Deployment
7+
metadata:
8+
name: {{ include "apl-operator.fullname" . }}
9+
namespace: apl-operator
10+
labels: {{- include "apl-operator.labels" . | nindent 4 }}
11+
spec:
12+
replicas: 1
13+
selector:
14+
matchLabels: {{- include "apl-operator.selectorLabels" . | nindent 6 }}
15+
template:
16+
metadata:
17+
{{- with .Values.podAnnotations }}
18+
annotations: {{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels: {{- include "apl-operator.selectorLabels" . | nindent 8 }}
21+
spec:
22+
dnsConfig:
23+
nameservers:
24+
- 8.8.8.8
25+
- 8.8.4.4
26+
restartPolicy: Always
27+
serviceAccountName: {{ include "apl-operator.serviceAccountName" . }}
28+
securityContext:
29+
runAsNonRoot: true
30+
runAsUser: 999
31+
runAsGroup: 999
32+
fsGroup: 3000
33+
seccompProfile:
34+
type: RuntimeDefault
35+
containers:
36+
- name: apl-operator
37+
{{- if $useORCS }}
38+
image: "mirror.registry.linodelke.net/docker/{{ $imageName }}:{{ $version }}"
39+
{{- else }}
40+
image: "{{ $imageName }}:{{ $version }}"
41+
{{- end }}
42+
imagePullPolicy: {{ ternary "IfNotPresent" "Always" (regexMatch "^v\\d" $version) }}
43+
securityContext:
44+
allowPrivilegeEscalation: false
45+
capabilities:
46+
drop:
47+
- ALL
48+
readOnlyRootFilesystem: true
49+
runAsNonRoot: true
50+
runAsUser: 1001
51+
resources:
52+
limits:
53+
cpu: '2'
54+
memory: '2Gi'
55+
requests:
56+
cpu: '1'
57+
memory: '1Gi'
58+
workingDir: /home/app/stack
59+
command:
60+
- node
61+
- dist/src/operator/main.js
62+
env:
63+
- name: VERBOSITY
64+
value: '1'
65+
- name: ENV_DIR
66+
value: /home/app/stack/env
67+
- name: VALUES_INPUT
68+
value: /secret/values.yaml
69+
# Git configuration for operator (will be set after installation)
70+
- name: GIT_ORG
71+
value: {{ .Values.operator.gitOrg | default "apl" | quote }}
72+
- name: GIT_REPO
73+
value: {{ .Values.operator.gitRepo | default "values" | quote }}
74+
- name: POLL_INTERVAL_MS
75+
value: {{ .Values.operator.pollIntervalMs | default "30000" | quote }}
76+
- name: RECONCILE_INTERVAL_MS
77+
value: {{ .Values.operator.reconcileIntervalMs | default "300000" | quote }}
78+
{{- if hasKey $kms "sops" }}
79+
envFrom:
80+
- secretRef:
81+
name: apl-sops-secrets
82+
- secretRef:
83+
name: gitea-credentials
84+
{{- end }}
85+
volumeMounts:
86+
- name: otomi-values
87+
mountPath: /home/app/stack/env
88+
- name: values-secret
89+
mountPath: /secret
90+
- name: tmp
91+
mountPath: /tmp
92+
- name: git-config
93+
mountPath: /home/app/.gitconfig
94+
subPath: .gitconfig
95+
livenessProbe:
96+
exec:
97+
command: ["/bin/sh", "-c", "pgrep -f 'apl-operator' > /dev/null"]
98+
initialDelaySeconds: 60
99+
periodSeconds: 30
100+
timeoutSeconds: 10
101+
failureThreshold: 3
102+
readinessProbe:
103+
exec:
104+
command: ["/bin/sh", "-c", "pgrep -f 'apl-operator' > /dev/null"]
105+
initialDelaySeconds: 30
106+
periodSeconds: 10
107+
timeoutSeconds: 5
108+
failureThreshold: 3
109+
volumes:
110+
- name: values-secret
111+
secret:
112+
secretName: {{ .Release.Name }}-values
113+
- name: otomi-values
114+
emptyDir: {}
115+
- name: tmp
116+
emptyDir: {}
117+
- name: git-config
118+
configMap:
119+
name: git-config
120+
items:
121+
- key: .gitconfig
122+
path: .gitconfig
123+
{{- if hasKey .Values "imagePullSecretNames" }}
124+
imagePullSecrets:
125+
{{- range .Values.imagePullSecretNames }}
126+
- name: {{ . }}
127+
{{- end }}
128+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: gitea-credentials
5+
namespace: apl-operator
6+
type: Opaque
7+
stringData:
8+
{{- if .Values.gitUsername }}
9+
GIT_USERNAME: {{ .Values.gitUsername | quote }}
10+
{{- end }}
11+
{{- if .Values.gitPassword }}
12+
GIT_PASSWORD: {{ .Values.gitPassword | quote }}
13+
{{- end }}

chart/apl/templates/job.yaml

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)