pulumi-kubernetesx
pulumi-kubernetesx copied to clipboard
asJobSpec has a wrong value for restartPolicy
trafficstars
const pb = new kx.PodBuilder({
containers: [
{
image: 'bitnami/mongodb:4.4.3-debian-10-r0',
command: ['/bin/bash', '-c'],
args: [
`mongo admin -u root -p 'xxx' --eval "db.getSiblingDB('${namespace.name}').createUser({user: '${namespace.name}', pwd: '${namespace.password}', roles: [{role: 'readWrite', db: '${namespace.name}'}] })"`,
],
},
],
});
new kx.Job(`create-mongodb-user-${namespace.name}`, {
spec: pb.asJobSpec({ ttlSecondsAfterFinished: 30, completions: 1 }),
});
kubernetes:batch/v1:Job (create-mongodb-user-blue):
error: resource create-mongodb-user-blue-zs7v5wx8 was not successfully created by the Kubernetes API server : Job.batch "create-mongodb-user-blue-zs7v5wx8" is invalid: spec.template.spec.restartPolicy: Unsupported value: "Always": supported values: "OnFailure", "Never"
Always is the default and isn't being set within pulumi-kubernetesx, so it looks like something that could be added for Job to ensure that restartPolicy is being set appropriately. As a workaround, you can set this value yourself in the spec.