Open TheEdgeOfRage opened 1 year ago
/sig API Machinery
@TheEdgeOfRage: The label(s) sig/api, sig/machinery
cannot be applied, because the repository doesn't have them.
/sig api-machinery
The existing job need to be deleted, because the template section in the job is immutable or not updatable. so you have 2 following options.
But that would mean that the job would show up in the diff every time. I'm fine with force applying the job on deploy, that's what we're doing anyway. The annoying part is that the diff is failing and we use kubectl diff to print the diff in PRs when we open them.
Generating a new job every time, or deleting the old one would mean that we'd get a large diff of all the same jobs every time and you couldn't tell what actually changed
/cc @apelisse Would you mind take a look at this one when have time? Thank you :) /triage accepted
I'm not sure I properly understand the issue. You typically apply with --force
so that the job gets deleted and recreated, and you can't find the flag in kubectl diff
? So you would want --force
in kubectl diff
, but you would like to not show the deletion/recreation, is that right?
That is correct. It doesn't have to be --force
for the diff command, it could be something like --ignore-immutable
, to make it clear that it's just showing the diff, not the actual action that would be performed.
If it doesn't make sense semantically, I'd be also happy with showing the diff with the jobs being deleted and recreated, but at least let the command succeed. Cause currently, it's completely broken when there's a change in a Job.
Yeah, we definitely don't recommend using --force
I think, but I see where you're coming from. I think in general we want diff to be as close as possible to apply, so I'd be OK adding a force flag there, but we would have to show the full deletion/recreation. We would have to play with the name of the object a little bit to guarantee that diff(1) does trigger a full diff.
We use flux to apply our manifests to the clusters and they recommend to use the force apply function when updating resources with immutable fields. If we were to expire Jobs and delete them, flux would keep recreating them on every reconciliation loop, so it's not really a feasible option in this case. Generating a new name would be possible, but it would be tedious as we would have to add that functionality to our CI pipeline and it would be cumbersome and add more commits to our git log. I don't see another good option except to use --force
when applying
Sure, I think it's fine to add --force
to kubectl diff
, but I don't have any capacity to help with that at the moment unfortunately.
@apelisse I can pick this up, but I would require some help since I am new here. Would that be feasible?
Absolutely, feel free to shoot me up with questions on slack (same handle as my github) or here if needed! Good luck.
/assign
@aparekh7 any progress?
This issue has not been updated in over 1 year, and should be re-triaged.
You can:
/triage accepted
(org members only)/close
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/
/remove-triage accepted
/triage accepted /cc @seans3
What happened?
I am trying to run a
kubectl diff --server-side --force-conflicts
against our cluster, but it fails with the following message:We use flux with the
force: true
option when applying this change to the cluster, so we don't have a problem with deployments and immutability, but it is a problem when trying to do a diff against the cluster.What did you expect to happen?
I would expect
kubectl diff
to have a--force
flag just like theapply
command to ignore immutable fields during diff operations. I see that there is--force-conflicts
, but it doesn't fix this issueHow can we reproduce it (as minimally and precisely as possible)?
Create a simple Job and apply it to the cluster:
Update any field in the template spec, for example change the
hello there
message.The
...
is the redacted pod spec, it's not relevant here.Anything else we need to know?
No response
Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)