2017-12-16 03:37:45 +00:00
|
|
|
package templates
|
|
|
|
|
|
|
|
const JobDeployerTemplate = `
|
|
|
|
{{- $addonName := .AddonName }}
|
|
|
|
{{- $nodeName := .NodeName }}
|
|
|
|
{{- $image := .Image }}
|
|
|
|
apiVersion: batch/v1
|
|
|
|
kind: Job
|
|
|
|
metadata:
|
|
|
|
name: {{$addonName}}-deploy-job
|
|
|
|
spec:
|
2018-02-06 20:37:22 +00:00
|
|
|
backoffLimit: 10
|
2017-12-16 03:37:45 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
name: pi
|
|
|
|
spec:
|
|
|
|
hostNetwork: true
|
|
|
|
serviceAccountName: rke-job-deployer
|
|
|
|
nodeName: {{$nodeName}}
|
|
|
|
containers:
|
|
|
|
- name: {{$addonName}}-pod
|
|
|
|
image: {{$image}}
|
|
|
|
command: [ "kubectl", "apply", "-f" , "/etc/config/{{$addonName}}.yaml"]
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /etc/config
|
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
# Provide the name of the ConfigMap containing the files you want
|
|
|
|
# to add to the container
|
|
|
|
name: {{$addonName}}
|
|
|
|
items:
|
|
|
|
- key: {{$addonName}}
|
|
|
|
path: {{$addonName}}.yaml
|
|
|
|
restartPolicy: Never`
|