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 105fb8e commit a2e86f3
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,37 @@ def sync(self, parent, children):
namespace = parent["metadata"]["namespace"]
clusterRoleBinding = parent["metadata"]["namespace"] + "-" + serviceAccountName

jobs = [
{
"restartPolicy": "Never",
"serviceAccountName": serviceAccountName,
"containers": [
{
"name": "runner",
"image": "busybox",
"command": ["sleep", "10"]
}
]
},
{
"restartPolicy": "Never",
"serviceAccountName": serviceAccountName,
"containers": [
{
"name": "runner",
"image": "busybox",
"command": ["sleep", "10"]
}
]
}
]

jobConfigs = {}
i = 0
for job in jobs:
jobConfigs["job-" + i] = json.dumps({"spec": {"template": {"spec": job}}})
i = i + 1

desired_status = {
"clusterrolebindings": len(children["ClusterRoleBinding.rbac.authorization.k8s.io/v1"]),
"serviceaccounts": len(children["ServiceAccount.v1"]),
Expand Down Expand Up @@ -107,10 +138,7 @@ def sync(self, parent, children):
"name": configMapName,
"namespace": namespace
},
"data": {
"job1.yaml": "spec:\n template:\n spec:\n restartPolicy: Never\n containers:\n - name: sleep-container\n image: busybox\n command: [\"sleep\", \"10\"]\n",
"job2.yaml": "spec:\n template:\n spec:\n restartPolicy: Never\n containers:\n - name: sleep-container\n image: busybox\n command: [\"sleep\", \"20\"]\n"
}
"data": jobConfigs
}
]

Expand Down

0 comments on commit a2e86f3

Please sign in to comment.