Skip to content

Commit 122ac85

Browse files
committed
feat(templates): add shimexecutor-post-install-job
Signed-off-by: Vaughn Dice <[email protected]>
1 parent 18c7d4d commit 122ac85

File tree

4 files changed

+99
-56
lines changed

4 files changed

+99
-56
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ kubectl config current-context
2121

2222
## Install SpinKube
2323
```bash
24-
helm install spinkube .
25-
26-
# wait for the pods to be ready
27-
28-
kubectl apply -f spin-operator.shim-executor.yaml
24+
helm install --wait spinkube .
2925
```
3026

3127
## Deploy a Spin App

spin-executor.post-install-job.yaml

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

spin-operator.shim-executor.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: "{{ .Release.Name }}-post-install"
5+
labels:
6+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
7+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
8+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
9+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
10+
annotations:
11+
"helm.sh/hook": post-install
12+
"helm.sh/hook-weight": "-5"
13+
"helm.sh/hook-delete-policy": hook-succeeded
14+
spec:
15+
template:
16+
metadata:
17+
name: "{{ .Release.Name }}"
18+
labels:
19+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
20+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
21+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
22+
spec:
23+
restartPolicy: Never
24+
serviceAccountName: {{ .Release.Name }}-post-install
25+
containers:
26+
- name: post-install-job
27+
image: "bitnami/kubectl:1.30.0"
28+
imagePullPolicy: IfNotPresent
29+
command: ["/bin/sh", "-c"]
30+
args:
31+
- |-
32+
cat <<EOF | kubectl apply -f -
33+
apiVersion: core.spinoperator.dev/v1alpha1
34+
kind: SpinAppExecutor
35+
metadata:
36+
name: containerd-shim-spin
37+
namespace: default
38+
spec:
39+
createDeployment: true
40+
deploymentConfig:
41+
runtimeClassName: wasmtime-spin-v2
42+
EOF
43+
---
44+
apiVersion: v1
45+
kind: ServiceAccount
46+
metadata:
47+
name: {{ .Release.Name }}-post-install
48+
labels:
49+
app.kubernetes.io/component: rbac
50+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
51+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
52+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
53+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
54+
---
55+
apiVersion: rbac.authorization.k8s.io/v1
56+
kind: Role
57+
metadata:
58+
name: {{ .Release.Name }}-post-install-role
59+
namespace: default
60+
labels:
61+
app.kubernetes.io/component: rbac
62+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
63+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
64+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
65+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
66+
rules:
67+
- apiGroups:
68+
- core.spinoperator.dev
69+
resources:
70+
- spinappexecutors
71+
verbs:
72+
- create
73+
- delete
74+
- get
75+
- list
76+
- patch
77+
- update
78+
- watch
79+
---
80+
apiVersion: rbac.authorization.k8s.io/v1
81+
kind: RoleBinding
82+
metadata:
83+
name: '{{ .Release.Name }}-post-install-rolebinding'
84+
namespace: default
85+
labels:
86+
app.kubernetes.io/component: rbac
87+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
88+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
89+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
90+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
91+
roleRef:
92+
apiGroup: rbac.authorization.k8s.io
93+
kind: Role
94+
name: '{{ .Release.Name }}-post-install-role'
95+
subjects:
96+
- kind: ServiceAccount
97+
name: '{{ .Release.Name }}-post-install'
98+
namespace: '{{ .Release.Namespace }}'

0 commit comments

Comments
 (0)