kubectl-neat
kubectl-neat copied to clipboard
How to ignore deployment revision and restartedat
hi,
how can I extend the code so that it ignores the following k8s Deployments properties
metatdata.annotations.deployment.kubernetes.io/revision
spec.template.metadata.annotations.kubectl.kubernetes.io/restartedAt
If you point me in the right direction I can do the change myself. Thank you.
Hi, what do you mean by "ignoring" the paths? Do you want to keep them in the resulting yaml?
I want to build a kubectl-neat that removes these properties. Currently I do it manually with grep.
Hi,
Actually, this is a specific use case for a general one. For example, we want to remove helm.sh/chart label. I suggest allowing a parameter of a blacklist of annotations and labels.
Something like:
--ignore metatdata.annotations:deployment.kubernetes.io/revision --ignore spec.template.metadata.annotations:kubectl.kubernetes.io/restartedAt --ignore spec.template.metadata.labels:spec.template.metadata
Thanks
As a user of kubectl-neat-diff I think there's good reason for a general feature, like @AssafKatz3 suggests. My preference would be to configure additional fields to filter out of the resulting YAML through a config file like $HOME/.kubectl-neat.
In my use case, I have some auto-generated annotations of SHASUMs that I'd like to exclude.
Thanks for the suggestions! sounds like a useful feature. If anyone wants to implement it, I'm happy to help
How to implement this feature, please give some suggestions
@jialechan I think what we're describing here is a configuration file for kubectl-neat that contains a list of paths to remove. currently the metadata cleaning is hardcoded here: https://github.com/itaysk/kubectl-neat/blob/master/cmd/neat.go#L93