cuddly-king-39663
04/21/2023, 9:45 PMbrainy-church-78120
04/21/2023, 10:44 PMcuddly-king-39663
04/21/2023, 11:23 PMbrainy-church-78120
04/21/2023, 11:26 PMbillowy-army-68599
04/22/2023, 12:05 AMcuddly-king-39663
04/22/2023, 12:20 AM# initial setup (dummy kubernetes cronjob resource)
pulumi up
# kubectl get cronjob my-cron-job -o yaml | grep image
image: alpine
# modifying the resource manually, changin the image from alipne to nxing
kubectl edit cronjob my-cron-job > from alpine to nginx
pulumi up -r
Resources:
2 unchanged
~ image : "alpine" => "nginx"
Do you want to perform this update?
no matter if i choose yes or no, image is still nginx, which did not match what is inside the code, this is edited versionbrainy-church-78120
04/22/2023, 12:21 AMcuddly-king-39663
04/22/2023, 12:25 AM~ image : "alpine" => "nginx"
but i want quite an opposite - to restore the state from the code, so it should return to alpine againorange-policeman-59119
04/22/2023, 2:33 AMup -r
? If I recall correctly, up -r
is like doing pulumi refresh && pulumi up
.
The second phase of the up would run your program, and I'd expect it to detect the diff between state (which should now contain nginx
) and then correct it, by updating the cron back to alpine
.pulumi up -r
Resources:
2 unchanged
~ image : "alpine" => "nginx"
Do you want to perform this update?
Is the refresh updating the state.
There are some resource options that could modify this behavior, could you copy the code you're using to manage the cronjob into this thread?cuddly-king-39663
04/22/2023, 4:07 PMfrom pulumi_kubernetes.batch.v1beta1 import CronJob
# Create a CronJob.
cron_job = CronJob(
"my-cron-job",
metadata={
"name": "my-cron-job"
},
spec={
"schedule": "*/1 * * * *",
"job_template": {
"spec": {
"template": {
"spec": {
"containers": [{
"name": "my-container",
"image": "alpine",
"command": ["/bin/sh", "-c", 'echo "Hello World"']
}],
"restart_policy": "OnFailure"
}
}
}
}
}
)
orange-policeman-59119
04/22/2023, 5:00 PMpulumi refresh --yes
then pulumi up
, it doesn't report any changes to deploy on the up?cuddly-king-39663
04/22/2023, 5:04 PM~ image : "alpine" => "nginx"
so it notices the differences, but when i click yes, it saved manual changes to the state file, so pulumi up did not revert the manual changesorange-policeman-59119
04/22/2023, 6:57 PMrefresh
in this thread. What does pulumi up
show?up
to detect that the state does not equal what your program declares.cuddly-king-39663
04/22/2023, 7:44 PMDo you want to perform this update? details
pulumi:pulumi:Stack: (same)
[urn=urn:pulumi:cronjob::kubernetes-cronjob::pulumi:pulumi:Stack::kubernetes-cronjob-cronjob]
Do you want to perform this update? yes
and noting happens, image is still nginx
Resources:
2 unchanged
kubectl get cronjob my-cron-job -o yaml | grep image
image: nginx
orange-policeman-59119
04/22/2023, 7:47 PMcuddly-king-39663
04/22/2023, 7:49 PM