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

enhancement: propagate the annotations and labels from the CR to all child resources #779

Open
olevski opened this issue Dec 4, 2024 · 6 comments

Comments

@olevski
Copy link
Member

olevski commented Dec 4, 2024

This should be an option in the CRD. By default it should not propagate (so that we do not break the API since we currently do not propagate).

Actually it may be nicer to have 2 fields, one for annotations and one for labels.

When set all annotations and labels from the CR should be added to the children.

EDIT:

At the CRD we can add Spec.Template.Metadata.Labels and Spec.Template.Metadata.Annotations. The type for each can come from the k8s library.

In the rare case of collisions the original child annotation or label should prevail and not be replaced by the one from the CR. This is because the original child annotation or label can be used for example for auto scaling or similar things.

By default the template metadata and labels are empty and so no value is added to the children. Just like now.

@olevski
Copy link
Member Author

olevski commented Dec 4, 2024

Also for the statefulset these should propagate all the way to the Pod.

@leafty
Copy link
Member

leafty commented Dec 4, 2024

I suggest having allow lists of annotations/label domains, e.g. "allow renku.io/* annotations". This way there is much less chance of collision with k8s or other CRD annotations clashing.

Or support listing annotations with wildcard, e.g.:

propagateAnnotations:
  - renku.io/*
  - example.org/a-specific-annotation
propagateLabels:
  - renku.io/*
  - app.kubernetes.io/name

@leafty
Copy link
Member

leafty commented Dec 4, 2024

Case in point: things like app.kubernetes.io/created-by would most likely break controllers if propagated.

@olevski
Copy link
Member Author

olevski commented Dec 4, 2024

I think I would rather actually just have annotations or labels that you have to specify that are just applied to all children. This way we dont have to do partial matches / searches across the keys as with something like renku.io/*.

And it is also closer to how you can specify the pod annotations/labels from a deployment or statefulset.

@leafty
Copy link
Member

leafty commented Dec 4, 2024

That works too

@olevski
Copy link
Member Author

olevski commented Dec 4, 2024

For example a deployment has:

spec:
  template:
    metadata:
      labels:
        labelName: someValue
     annotations:
       annotationName: someValue

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

2 participants