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:
Maintain a list of known annotations that we want to trim, such as kubectl.kubernetes.io/last-applied-configuration
Introduce a new flag which allows users to trim other annotations that are not in this list
Export all annotations that are not removed by one of the measures above
This changes the behaviour of the export slightly, but I think the change is small enough to not require a new major version.
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
orserviceaccounts.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:
kubectl.kubernetes.io/last-applied-configuration
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?