helm-hook安装后shell脚本执行



我正在尝试掌舵"安装后";勾选并查看下面的错误。错误:sh:script/jenkins.sh:未找到

postinstall.yaml内容

apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}"
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
spec:
template:
spec:
containers:
- name: post-install-jenkins-job
image: alpine:3.3
imagePullPolicy: IfNotPresent
command: [ "/bin/sh", "-c", "scripts/jenkins.sh"]
restartPolicy: Never
terminationGracePeriodSeconds: 0

helm包的文件夹结构scripts/jenkins.h是我试图用";postinstall.yaml";作为后安装舵钩。

riq-agent
├── Chart.yaml
├── README.md
├── scripts
│   └── jenkins.sh
├── templates
│   ├── NOTES.txt
│   ├── Untitled-1.yml
│   ├── _helpers.tpl
│   ├── awssecret.yaml
│   ├── clusterrolebinding.yaml
│   ├── configurationFiles-configmap.yaml
│   ├── deployment.yaml
│   ├── hook-aws-ecr.yaml
│   ├── initializationFiles-configmap.yaml
│   ├── postinstall.yaml
│   ├── pvc.yaml
│   ├── secrets.yaml
│   ├── serviceaccount.yaml
│   ├── servicemonitor.yaml
│   ├── svc.yaml
│   └── tests
│       ├── test-configmap.yaml
│       └── test.yaml
└── values.yaml

我试图在helm hook中执行shell脚本(存储在helm包中(的方式是否有任何错误?

为了执行,scripts/jenkins.sh应该是post-install-jenkins-job容器的一部分,作为卷安装。您可以使用存储在配置映射中的数据填充卷。

安装后configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-postinstall-configmap
data:
jenkins.sh: |-
{{ .Files.Get "scripts/jenkins.sh" | indent 4}}

postinstall.yaml

apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}"
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
spec:
template:
spec:
containers:
- name: post-install-jenkins-job
image: alpine:3.3
imagePullPolicy: IfNotPresent
command: [ "/bin/sh", "-c", "/opt/scripts/jenkins.sh"]
volumeMounts:
- name: config-volume
mountPath: /opt/scripts
volumes:
- name: config-volume
configMap:
name: {{ .Release.Name }}-postinstall-configmap
defaultMode: 0777
restartPolicy: Never
terminationGracePeriodSeconds: 0

相关内容

  • 没有找到相关文章

最新更新