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

[RFC] Dedicated API for commit status updates #2639

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

[RFC] Dedicated API for commit status updates #2639

wants to merge 3 commits into from

Conversation

somtochiama
Copy link
Member

Proposal for adding a new API kind CommitStatus to the notification-controller.

Signed-off-by: Somtochi Onyekwere somtochionyekwere@gmail.com

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
@somtochiama somtochiama marked this pull request as draft April 13, 2022 18:58
@phillebaba
Copy link
Member

@somtochiama I would suggest looking at this discussion. I kind of dropped the ball on implementing this last summer...

#1529 (reply in thread)

@somtochiama
Copy link
Member Author

@phillebaba I have! It was a very good starting point.
I plan on writing another proposal on adding templating (with you as co-author since you have already written a bulk of it in the discussion) and keeping this proposal on just adding the new CommitStatus kind.
Is the proposal too sparse?

@stefanprodan stefanprodan changed the title [RFC] CommitStatus API kind in the noticfication-controller [RFC] Dedicated API for commit status updates Apr 14, 2022
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this RFC needs to address the multi-cluster issue that users are running into. @somtochiama have you've seen fluxcd/notification-controller#340?


- [Implement GitHub commit status notifier](https://github.com/fluxcd/notification-controller/pull/27)
- [Add Gitlab notifier](https://github.com/fluxcd/notification-controller/pull/43)
- [Add bitbucket notifier](https://github.com/fluxcd/notification-controller/pull/73)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Azure DevOps is missing from here.

eventSeverity: info
eventSources:
- kind: Kustomization
name: webapp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a summary field here similar to Alert. This can be helpful in adding some metadata about the event, which can be helpful, for example when there are multiple clusters. (ref: fluxcd/notification-controller#194)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name summary doesn't make sense for commit status IMO, it should be prefix or something else.

@stefanprodan
Copy link
Member

@phillebaba @somtochiama does it make sense to add templating to CommitStatus if the actual message is limited to a couple of characters ? Maybe adding prefix is enough to solve the multi-cluster issue, it's not like the cluster name is something people can template, there is no such metadata in the payload.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
@hiddeco
Copy link
Member

hiddeco commented Apr 21, 2022

It would be good to take into account that cdevents is shaping.

@stefanprodan
Copy link
Member

@somtochiama we need to take into account things like fluxcd/notification-controller#369 it's not a commit status but it's not an alert either...

@phillebaba
Copy link
Member

So I have looked this over now and for the most part this looks pretty straight forward. My opinion is that this should only cover CommitStatus as it seems to be a well defined term within most Git providers today. Everything else like Github Workflow dispatch should be covered in another RFC, as it would be to much work dealing with that too.

I would like to push for adding some sort of templating feature to the commit status. Just because there would be so many different needs in the future that we cant really consider. The reasoning for why to have it in the first place is that we want to differ a commit status coming from different environments, but we could consider for example a environment with multiple regions. Does just having a prefix solve this? I am not sure but maybe. One use case which my comment covered was the option to add templating parameters from a configmap which would enable the same commit status to be deployed into multiple clsuters but result in different prefixes. The question is mostly how much of an hassle that work is worth.

@stefanprodan
Copy link
Member

My opinion is that this should only cover CommitStatus as it seems to be a well defined term within most Git providers today.

Agreed, I've merged the GitHub dispatch integration for the Alert API.

Copy link
Member

@hiddeco hiddeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First round of comments to steer towards something I would be comfortable with.

In general, I think the document needs more tidying in terms of style, line wraps, punctuation, etc. which I didn't nitpick on in full.

Other than this, I think what the RFC itself is suggesting is the right direction.


## Summary

There should be a dedicated kind in the notification controller for sending commit status notifications to git providers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the summary to be written as [This RFC] <summary>. So in this particular case, something like:

This RFC proposes to create a dedicated CommitStatus kind in the to allow configuration of commit status notifications to a (Git) Provider.


## Motivation

Currently, The Alert type can reference both git providers and chat providers. However, the differences between the two providers and how notifications being sent to them should be handled has continued to diverge.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Currently, the ...
  2. git -> Git
  3. I would provide examples of what Git providers and/or chat providers are to provide further context.
  4. The last part of this line is difficult to read ("being sent to them should be handled has continued to diverge").

## Motivation

Currently, The Alert type can reference both git providers and chat providers. However, the differences between the two providers and how notifications being sent to them should be handled has continued to diverge.
For example, there is a limit on the length of the name/context of the status for git provider.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference which proofs this?

Comment on lines +19 to +22
When one commit triggers more than one deployment/reconciliation in different clusters, the commit status notification from one overwrites the other as seen in this [issue](https://github.com/fluxcd/notification-controller/issues/195).
A new field specific to the git commit status will allow Flux users to specify a prefix that will be prepended to the context to differentiate the statuses.

By creating a separate kind for git commit status, the specific nuances of the provider can be properly taken into account and it would allow more flexibility in adding fields specific to each kind.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would restructure the argumentation here to gradually get to the point of introducing a new kind, because the changes to the current kind or not justified.

Paraphrasing:

We have observed the issue to be <problem>, this would require the introduction of
<something> because of <reason>. Which is ultimately solved by <introducing new kind>,
because of <argumentation>.


## Implementation History

- [Implement GitHub commit status notifier](https://github.com/fluxcd/notification-controller/pull/27)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think none of these entries belong under "implementation history", as they are not related to this RFC but rather to what moved us to creating this RFC. Making it e.g. part of the motivation, which is the section in which you provide historical context to build up your case.

Comment on lines +35 to +39
Introduce a new kind in the notification-controller called `CommitStatus`.
The `CommitStatus` kind will similar to the `Alert` kind, referencing a provider and including event sources to accept events from. The major difference is that it will only reference git providers. Additionally, it can only have a `Kustomization` as its event source since it requires the `revision` field in the event metadata.
It would include a new field `.spec.prefix` that will be used to differentiate results of multiple deployments on different clusters triggered by the same commit and prevent one from overwriting the other.

This proposal will also introduce breaking changes as the `Alert` kind will no longer send notifications to git providers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very thin and lacks technical details.


### Alternatives

Alternatively, we could keep using the `Alert` kind for sending notifications to git providers. While this might not be much of a pain now, it would continue to grow as the implementations details of new features might differ for the chat and git providers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of

While this might not be much of a pain now, ...

I would phrase it as (something like):

This would not allow for further growth of the Git and chat providers. As the implementation details of new features might differ, making it difficult to invent an API around this which is self explanatory and user friendly.

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

Successfully merging this pull request may close these issues.

None yet

5 participants