-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating from client-side apply to server-side prevents field deletion #486
Comments
To allow Flux to manage all fields, the current workaround is to delete the kubectl patch cm test --type=json -p='[{"op": "remove", "path": "/metadata/managedFields/1"}]' After the |
Is there a way to tell kustomize controller to become the sole manager via force as described in: https://kubernetes.io/docs/reference/using-api/server-side-apply/#conflicts ? |
@monotek we do that (see https://github.com/fluxcd/pkg/blob/main/ssa/manager_apply.go#L199) but it doesn't help in this case, you can't force ownerships for non existing fields. |
So whats the upgradepath, coming from flux 0.17.0? The only way i was able to remove an env var from a pod was to delete the deployment with "--cascade=orphan" so flux recreates the deployment. Deleting managedFields and reconcile kustomization had no effect to deleted fields. |
Add the env vars to Git, remove the managedFields, then at the next reconciliation Flux will own them all. Then you can remove/add env vars via Git. |
The env var is already in git and was client side applied with Flux 0.17.0 |
We were able to let flux take ownership like this.
When we've reconciled the kustomization the env var was finaly removed :) |
Helm controller seems to have the same problem :( We're currently struggling finding a general solution to update all resources created by the flux controllers, so they are changed reliably again. Have you found a genral workaround for prod clusters? Currently more and more apps need fixes by hand as the changes, which remove single parts of a resource, do not change the resources anymore. For example some pdb, which should be updated by helm controller, kept the old matchlabels after an update and therfore the matchlabels did not match and the pdb did not work. |
@monotek helm-controller is using Helm packages, Helm itself didn’t switched to server-side apply, so I don’t see how any of this can affect HelmReleases. |
Thanks for the update. So the helm problem might be something else :/ How do you've handled your clusters after updating flux? |
This had nothing to so with server-side apply nor with kustomize-controller. Please open an issue on the Kubernetes repo. |
We were having the same issue, here is a quick for-loop which seems to mitigate this well enough for us. Bash / ZSH: for ns in $(kubectl get namespaces -o name | awk '{print $2}' FS=/);
do kubectl config set-context --current --namespace $ns;
for deploy in $(kubectl get deploy -o name);
do kubectl patch $deploy --type=json -p='[{"op": "remove", "path": "/metadata/managedFields/1"}]';
done
done Fish: for ns in (kubectl get namespaces -o name | awk '{print $2}' FS=/)
kubectl config set-context --current --namespace $ns
for deploy in (kubectl get deploy -o name)
kubectl patch $deploy --type=json -p='[{"op": "remove", "path": "/metadata/managedFields/1"}]'
end
end |
We have some annotations that are not being removed. The cluster only ever had flux2 v0.23.0 so there was never a migration from a previous version of flux. This cm was created from a file via the From the cluster:
From the repo:
The
|
@texasbobs That's a known facet of this issue. Using Very sorry for this issue, we are still working on a total resolution that covers all the varied and different ways this problem can creep in. |
In preparation to install Flux 0.17.2, ensure that no kustomization overlay rewrites the version of kustomize-controller or any other Flux controllers. I'll be installing this version that came from before SSA to test upgrading through Flux SSA versions to the latest RC, can proceed smoothly, and not fall victim anymore to fluxcd/kustomize-controller#486
In preparation to install Flux 0.17.2, ensure that no kustomization overlay rewrites the version of kustomize-controller or any other Flux controllers. I'll be installing this version that came from before SSA to test upgrading through Flux SSA versions to the latest RC, can proceed smoothly, and not fall victim anymore to fluxcd/kustomize-controller#486
In preparation to install Flux 0.17.2, ensure that no kustomization overlay rewrites the version of kustomize-controller or any other Flux controllers. I'll be installing this version that came from before SSA to test upgrading through Flux SSA versions to the latest RC, can proceed smoothly, and not fall victim anymore to fluxcd/kustomize-controller#486
In preparation to install Flux 0.17.2, ensure that no kustomization overlay rewrites the version of kustomize-controller or any other Flux controllers. I'll be installing this version that came from before SSA to test upgrading through Flux SSA versions to the latest RC, can proceed smoothly, and not fall victim anymore to fluxcd/kustomize-controller#486
When migrating from Flux 0.17 (that used kubectl client-side apply) to Flux 0.18 or later (that uses server-side apply) fields removed from Git will not be removed from the cluster. The same issue is when migrating from manually applied resources to Flux.
Ref: kubernetes/kubernetes#99003
The text was updated successfully, but these errors were encountered: