Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(templates): add shimexecutor-post-install-job #15

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ kubectl config current-context

## Install SpinKube
```bash
helm install spinkube .

# wait for the pods to be ready

kubectl apply -f spin-operator.shim-executor.yaml
helm install --wait spinkube .
```

## Deploy a Spin App
Expand Down
41 changes: 0 additions & 41 deletions spin-executor.post-install-job.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions spin-operator.shim-executor.yaml

This file was deleted.

98 changes: 98 additions & 0 deletions templates/shimexecutor-post-install-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-post-install"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: "{{ .Release.Name }}"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
restartPolicy: Never
serviceAccountName: {{ .Release.Name }}-post-install
containers:
- name: post-install-job
image: "bitnami/kubectl:1.30.0"
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args:
- |-
cat <<EOF | kubectl apply -f -
apiVersion: core.spinoperator.dev/v1alpha1
kind: SpinAppExecutor
metadata:
name: containerd-shim-spin
namespace: default
Mossaka marked this conversation as resolved.
Show resolved Hide resolved
spec:
createDeployment: true
deploymentConfig:
runtimeClassName: wasmtime-spin-v2
EOF
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}-post-install
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Release.Name }}-post-install-role
namespace: default
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
rules:
- apiGroups:
- core.spinoperator.dev
resources:
- spinappexecutors
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: '{{ .Release.Name }}-post-install-rolebinding'
namespace: default
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: '{{ .Release.Name }}-post-install-role'
subjects:
- kind: ServiceAccount
name: '{{ .Release.Name }}-post-install'
namespace: '{{ .Release.Namespace }}'
Loading