opendevstack / tailor

Infrastructure as Code for OpenShift
Apache License 2.0
13 stars 9 forks source link

Export should not trim all annotations by default #203

Closed michaelsauter closed 4 years ago

michaelsauter commented 4 years ago

Tailor trims all annotations in the export unless --with-annotations is given. This was done to avoid annotations in the export that make no sense in a template, e.g. kubectl.kubernetes.io/last-applied-configuration.

Unfortunately, there are annotations which are crucial for a resource to work. E.g. service.alpha.openshift.io/serving-cert-secret-name or serviceaccounts.openshift.io/oauth-redirectreference.primary. Trimming them causes problems when the export is used against an empty namespace, as then the annotation is missing, and the resource does not work properly. A workaround for current users is to use --with-annotations and trim annotations manually.

Unfortunately, we cannot know all annotations that should be trimmed, nor can we know all annotations that need to be kept, as annotations are an open extension mechanism.

That said, the current default is not ideal, and the user also has no way to control which annotations to keep or trim - it's either all in or all out.

I propose the following change:

This changes the behaviour of the export slightly, but I think the change is small enough to not require a new major version.

@henrjk @gerardcl Thoughts?