Skip to content

Commit

Permalink
run hello world containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Deltachaos committed Aug 31, 2024
1 parent 9c55592 commit b458148
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
8 changes: 8 additions & 0 deletions helm/kentledge/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ spec:
env:
- name: KUBERNETES_CLUSTERROLE
value: {{ template "kentledge.fullname" . }}
- name: KENTLEDGE_IMAGE
value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
- name: KENTLEDGE_PULLPOLICY
value: {{ .Values.image.pullPolicy }}
- name: JOBSEQUENCE_IMAGE
value: "{{ .Values.jobsequenceImage.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
- name: JOBSEQUENCE_PULLPOLICY
value: {{ .Values.jobsequenceImage.pullPolicy }}
ports:
- name: http
containerPort: 8080
Expand Down
5 changes: 5 additions & 0 deletions helm/kentledge/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: main

jobsequenceImage:
repository: ghcr.io/deltachaos/kubernetes-jobsequence
pullPolicy: Always
tag: main

rbac:
create: true

Expand Down
24 changes: 9 additions & 15 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def dump(self, obj):
def sync(self, parent, children):

clusterRole = os.environ.get("KUBERNETES_CLUSTERROLE")
kentledgeImage = os.environ.get("KENTLEDGE_IMAGE")
kentledgePullPolicy = os.environ.get("KENTLEDGE_PULLPOLICY")
jobsequenceImage = os.environ.get("JOBSEQUENCE_IMAGE")
jobsequencePullPolicy = os.environ.get("JOBSEQUENCE_PULLPOLICY")

configMapName = parent["metadata"]["name"]
serviceAccountName = parent["metadata"]["name"]
Expand All @@ -29,19 +33,9 @@ def sync(self, parent, children):
"containers": [
{
"name": "runner",
"image": "busybox",
"command": ["sleep", "10"]
}
]
},
{
"restartPolicy": "Never",
"serviceAccountName": serviceAccountName,
"containers": [
{
"name": "runner",
"image": "busybox",
"command": ["sleep", "10"]
"imagePullPolicy": kentledgePullPolicy,
"image": kentledgeImage,
"args": ["python", "backup.py"]
}
]
}
Expand Down Expand Up @@ -114,8 +108,8 @@ def sync(self, parent, children):
"containers": [
{
"name": "runner",
"imagePullPolicy": "Always",
"image": "ghcr.io/deltachaos/kubernetes-jobsequence:main",
"imagePullPolicy": jobsequencePullPolicy,
"image": jobsequenceImage,
"volumeMounts": [
{
"name": "jobs",
Expand Down
8 changes: 8 additions & 0 deletions src/backup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import time

print("hallo test")
time.sleep(3)
print(os.environ.get('JOB_CONFIGMAP'))
print(os.environ.get('JOB_NAME'))
print("hallo test ende")
time.sleep(10)

0 comments on commit b458148

Please sign in to comment.