mirror of
https://github.com/rancher/rke.git
synced 2025-05-05 14:57:05 +00:00
33 lines
938 B
Go
33 lines
938 B
Go
package addons
|
|
|
|
func GetAddonsExcuteJob(addonName, nodeName, image string) string {
|
|
return `apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: ` + addonName + `-deploy-job
|
|
spec:
|
|
template:
|
|
metadata:
|
|
name: pi
|
|
spec:
|
|
hostNetwork: true
|
|
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`
|
|
}
|