-
Notifications
You must be signed in to change notification settings - Fork 420
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
Propagate annotations from EL to svc and deployment #712
Conversation
The following is the coverage report on the affected files.
|
@piyush-garg Thank you for the PR 👍 I have one suggestion related to annotation usage as @dibyom mentioned use case of adding annotation over the issue so i feel it would be great if we cover that usecase as part of examples also Otherwise PR looks good to me 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but add this information succinctly in https://github.com/tektoncd/triggers/blob/master/docs/eventlisteners.md
And an example like @savitaashture said.
@khrm @savitaashture Would want to add some annotation to all the examples there? The feature is all the annotations present in eventlistener will be copied to all services and deployments, not sure how we can show that in examples. |
IMO adding in one example(GH, GL etc...) would be enough to show the usage of annotation propagation. And +1 for adding it to docs |
@khrm @savitaashture I have updated the PR with doc and example. Thanks for review |
The following is the coverage report on the affected files.
|
/lgtm |
/lgtm Thank you |
@@ -447,6 +451,7 @@ func generateObjectMeta(el *v1alpha1.EventListener) metav1.ObjectMeta { | |||
Name: el.Status.Configuration.GeneratedResourceName, | |||
OwnerReferences: []metav1.OwnerReference{*el.GetOwnerReference()}, | |||
Labels: mergeLabels(el.Labels, GenerateResourceLabels(el.Name)), | |||
Annotations: el.Annotations, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should merge any extra annotations that might have been added by something besides the EL controller instead of overwriting it (just like we are doing it with the labels above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dibyom We are also overwriting in case of labels as per my understanding. We are merging labels to add the few labels which are generated by triggers controller, apart from that in case of labels also we are doing the same, copying the available in eventlistener, add the few generated by the controller and propagate to svc/deployment.
If we merge the extra annotation, don't do any anything which is already added, then how we can remove the one which a user did by mistake e.g. I have added an annotation with a typo in key. We will be in the same situation as before. So I think whatever the current set in EL should be copied further.
And as per my little understanding with the codebase, we are doing the same with labels. Please correct me here if wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we are just copying labels coming from eventlistener and merging with labels which are generated by triggers controller.
For annotation we don't have any annotation which are generated by triggers controller so we should just copy whatever is coming from eventlistener yaml and imo we don't require any merging functionality here
I think we should merge any extra annotations that might have been added by something besides the EL controller instead of overwriting it
@dibyom when you say something besides the EL controller
do you mean annotation added by user ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for the delayed response.
@piyush-garg you are right -> we do overwrite the labels. The use case I was thinking of is the following -- say someone currently has a custom annotation set directly on the EL service/deployment. Now, when they upgrade to Triggers containing this change, the custom annotation will be unset. So, they'd have to manually add their annotations to the EL in order to make it work.
If we merge the extra annotation, don't do any anything which is already added, then how we can remove the one which a user did by mistake e.g. I have added an annotation with a typo in key.
Yeah, that's not ideal either :( The user would have to delete them from the EL deployment/service manually.
It gets a bit more complicated if we consider TEP-009. In that design, users can specify annotations/labels directly for the EL deployment. So, we'll have to see if it makes sense to keep propagating them.
So, the options I see are:
-
Make the change in this PR and mark in the Release Notes that users have to manually update the EL's annotations if they added any custom annotations.
-
Merge any existing annotations on the labels/annotations with any applied on the EL instead of overwriting them.
-
Wait for TEP-009 design to be implemented where users can directly specify a podTemplate with exactly the annotations they want for the deployment. ( We might want to augment that design with something like a serviceTemplate for the EL service as well)
Does that make sense? Thoughts @savitaashture @piyush-garg @khrm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i agree with your point lets merge this PR with release note
- Wait for TEP-009 design to be implemented where users can directly specify a podTemplate with exactly the annotations they want for the deployment. ( We might want to augment that design with something like a serviceTemplate for the EL service as well)
Yes need to rethink about the support of annotation for Service while implementing TEP-0008 as that is bit tricky.
I will take care of this while implementation
Thank you for pointing it out here 👍
@piyush-garg could you please add points mentioned by @dibyom to release note and also resolve the conflict |
The following is the coverage report on the affected files.
|
@khrm @savitaashture @dibyom I have updated the PR according to the discussion and also resolved the conflicts. Thanks for all reviews and suggestions. |
/lgtm |
@@ -220,6 +221,24 @@ must adhere to the | |||
[Kubernetes syntax and character set requirements](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set) | |||
for label values. | |||
|
|||
## Annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also document the behaviour for what happens when deployment or service has an annotation already present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is mentioning that only in release note OK, @dibyom ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khrm I have updated the doc also with the Note
This will add the feature of propagating annotations of an eventlistener to the service, deployment and further pods created by the eventlistener Add docs and tests Fix tektoncd#700
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@savitaashture @dibyom Probably the last round of review |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
In tektoncd#712, we added a feature to propagate annotations added to the EL to its underlying resources. However, this resulted in infinite reconcile loops since the deployment controller will add a standard revision annotation that the EL controller will keep trying to overwrite. To fix this, this commit switches the annotation propagation to merge any annotations set on the underlying resources before adding any extra annotations from the EL. Fixes tektoncd#751 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
In tektoncd#712, we added a feature to propagate annotations added to the EL to its underlying resources. However, this resulted in infinite reconcile loops since the deployment controller will add a standard revision annotation that the EL controller will keep trying to overwrite. To fix this, this commit switches the annotation propagation to merge any annotations set on the underlying resources before adding any extra annotations from the EL. Fixes tektoncd#752 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
In tektoncd#712, we added a feature to propagate annotations added to the EL to its underlying resources. However, this resulted in infinite reconcile loops since the deployment controller will add a standard revision annotation that the EL controller will keep trying to overwrite. To fix this, this commit switches the annotation propagation to merge any annotations set on the underlying resources before adding any extra annotations from the EL. Fixes tektoncd#752 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
In tektoncd#712, we added a feature to propagate annotations added to the EL to its underlying resources. However, this resulted in infinite reconcile loops since the deployment controller will add a standard revision annotation that the EL controller will keep trying to overwrite. To fix this, this commit switches the annotation propagation to merge any annotations set on the underlying resources before adding any extra annotations from the EL. Fixes tektoncd#752 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
In #712, we added a feature to propagate annotations added to the EL to its underlying resources. However, this resulted in infinite reconcile loops since the deployment controller will add a standard revision annotation that the EL controller will keep trying to overwrite. To fix this, this commit switches the annotation propagation to merge any annotations set on the underlying resources before adding any extra annotations from the EL. Fixes #752 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
This will add the feature of propagating annotations
of an eventlistener to the service, deployment and
further pods created by the eventlistener
Add docs and tests
Fix #700
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Release Notes