Skip to content
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

How to ignore deployment revision and restartedat #74

Open
yene opened this issue Oct 19, 2021 · 7 comments
Open

How to ignore deployment revision and restartedat #74

yene opened this issue Oct 19, 2021 · 7 comments

Comments

@yene
Copy link

yene commented Oct 19, 2021

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.

@itaysk
Copy link
Owner

itaysk commented Oct 20, 2021

Hi, what do you mean by "ignoring" the paths? Do you want to keep them in the resulting yaml?

@yene
Copy link
Author

yene commented Oct 20, 2021

I want to build a kubectl-neat that removes these properties. Currently I do it manually with grep.

@AssafKatz3
Copy link

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

@spiegela
Copy link

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.

@itaysk
Copy link
Owner

itaysk commented Oct 31, 2021

Thanks for the suggestions! sounds like a useful feature. If anyone wants to implement it, I'm happy to help

@jialechan
Copy link

How to implement this feature, please give some suggestions

@itaysk
Copy link
Owner

itaysk commented Jan 22, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants