-
Notifications
You must be signed in to change notification settings - Fork 519
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
Add make target to remove labels and annotations from manifests #625
Conversation
@fdberlking PTAL. |
@bnallapeta Images are available for testing. |
@bnallapeta Yikes! You better fix it before anyone else finds out! Build has Failed! |
Sure, I have a look around the weekend, thanks :) |
@bnallapeta LGTM, I'd only change the yq update statement to the following: remove-labels-annotations: yq-install
@for file in $$(find deployments/kubernetes/manifests -type f -name '*.yaml'); do \
echo "Processing $$file"; \
$(YQ_BIN) eval 'del(.metadata.annotations | with_entries(select(.key | startswith("meta.helm.sh/"))), .metadata.labels | with_entries(select(.value == "Helm")), .spec.template.metadata.labels | with_entries(select(.value == "Helm")))' -i "$$file"; \
done I think my initial issue statement was not precise enough, sorry for that. We should only remove annotations and labels from the .yaml files within metadata:
annotations:
meta.helm.sh/release-namespace: "default"
meta.helm.sh/release-name: "reloader"
labels:
heritage: "Helm"
app.kubernetes.io/managed-by: "Helm" The rest needs to stay, otherwise e.g. the deployment.yaml does not specify which pods the controller should manage or control. With the statement above, we would only delete Unfortunately, I was not able to push my draft to your PR due to missing access rights, but maybe you could have another check and verify, if my proposal makes sense or not. Thank you 🚀 |
I think from the workflow's perspective, its fine to remove all labels and annotations as they are the only ones present. |
@bnallapeta thanks for coming back to me so quickly. I need to admit that I wasn't executing the
From my understanding, we could leave all annotations except the ones related to Helm. If my deletion proposal for labels is not correct (as pointed out by you above), please feel free to adjust it. Additionally, we would need to take care as well on the labels within the |
@fdberlking Ah you're right. I didn't account for the fact that users can provide their custom labels from values.yaml and the ones that are being applied from _helpers.tpl. I will work on this one and the deployment change as well. |
@bnallapeta perfect, thank you very much. Overall, I hope my comments made sense 🙂 please let me know, if I should do another check whenever you have found the time to push your changes. |
@fdberlking
So, any labels/annotations coming from either Hope this makes sense. Let me know your thoughts. P.S.: I have made the deployment change. |
@bnallapeta Images are available for testing. |
@bnallapeta but files from this folder are used by serviceaccount/reloader-reloader created
clusterrole.rbac.authorization.k8s.io/reloader-reloader-role created
clusterrolebinding.rbac.authorization.k8s.io/reloader-reloader-role-binding created
The Deployment "reloader-reloader" is invalid: spec.template.metadata.labels: Invalid value: map[string]string(nil): `selector` does not match template `labels` Erasing the complete $(YQ_BIN) eval 'del(.spec.template.metadata.labels)' -i deployments/kubernetes/manifests/deployment.yaml would cause the selectors not being able to find the set labels anymore. Thus, I'd not recommend it as a good idea to delete everything below this |
@fdberlking Just pushed a commit with the changes. PTAL. |
@bnallapeta Images are available for testing. |
LGTM, this should work out 😃 Thanks for making the changes, @bnallapeta! |
@bnallapeta Images are available for testing. |
@bnallapeta Images are available for testing. |
Fixes #621