我正在尝试使用helm设置一个CronJob。我的作业模板部分如下
jobTemplate:
metadata:
creationTimestamp: null
spec:
backoffLimit: 3
template:
metadata:
creationTimestamp: null
spec:
containers:
- args:
- >
POD_LIST=($(kubectl get pod
--field-selector=status.phase=Succeeded -n ex-namespace -l
tekton.dev/pipeline | awk '$5 ~
/(^[6-9][0-9]*|^[1-5][0-9]+)d.*/ {print $1}')); for podname in
$POD_LIST; do;
echo "deleting pod $podname";
kubectl delete pod -n ex-namespace $podname;
done;
command:
- /bin/sh
- '-c'
image: > kubctlImage
imagePullPolicy: IfNotPresent
name: cleanup-completed-pods
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Never
schedulerName: default-scheduler
securityContext: {}
serviceAccount: ral-tekton
serviceAccountName: ral-tekton
terminationGracePeriodSeconds: 30
schedule: 0 0 * * *
startingDeadlineSeconds: 200
successfulJobsHistoryLimit: 3
触发此作业时,我在Pod日志中看到以下错误。
“/bin/sh:1:语法错误:“(《意料之外》
显然这是一个shell脚本错误,但不确定我在这里错过了什么?
有人能帮我找到这里的shell错误吗?
p.s:我复制了命令,将其转换为单行,并尝试在我的mac的/bin/sh shell ,似乎是工作.
1条答案
按热度按时间yh2wf1be1#
假设你的kubectl图像有gawk,可能会起作用