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

[spike] Pull based model to get HelmRelease events #180

Closed
wants to merge 8 commits into from
Closed

Conversation

luizbafilho
Copy link
Contributor

@luizbafilho luizbafilho commented May 8, 2023

This PR is all about trying out a new way of getting events from HelmReleases. Instead of the old way where we used webhooks to get notified when something happened, we're going for a pull-based model.

The big idea here is to make our Pipeline configuration simpler. That means no more messing around with setting up notification-controller providers and alerts.

What's going on

  • Our controller keeps an eye out for changes in GitopsCluster CRs. When it spots something, it creates clients for leaf clusters.
  • When a Pipeline is being sorted out, the controller identifies the app and labels all targets in each cluster. These labels help us know which pipeline we're dealing with when a HelmRelease event comes in.
  • The controller then starts a watch on all HelmRelease targets to catch any events that happen.
  • When an actual version update pops up, the controller moves the app to the next environment. It's like a promotion for the app!
   sequenceDiagram
    actor U as operator
    U->>+API Server: creates Pipeline
    participant PC as Pipeline Controller
    participant PS as Promotion Strategy
    API Server->>+PC: notifies
    participant dt1 as dev/target 1
    
    rect rgb(67, 207, 250)
    note right of PC: setup phase
    note right of PC: pipelines.wego.weave.works/name<br/>pipelines.wego.weave.works/env<br/>pipelines.wego.weave.works/target
    PC->>+dt1: label AppRef with metadata
    participant dt2 as dev/target 2
    PC->>+dt2: label AppRef with metadata
    participant pt1 as prod/target 1
    PC->>+pt1: label AppRef with metadata
    end
   
    rect rgb(50, 227, 221)
    note right of PC: promotion phase
    PC-->>+dt1: watches HelmRelease and Kustomizations changes
    PC-->>+dt2: watches HelmRelease and Kustomizations changes
    PC-->>+pt1: watches HelmRelease and Kustomizations changes
    end


    dt1->>+PC: update events from AppRef
    PC ->>PC: filter upgrade events 
    PC ->>PC: extract metadata 
    PC->>+PS: kicks off
Loading


restConfigManager.Add("local", "", ctrl.GetConfigOrDie())

// promServer, err := server.NewPromotionServer(
Copy link
Contributor Author

@luizbafilho luizbafilho May 8, 2023

Choose a reason for hiding this comment

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

I'll add it back commented out just to make sure the webhook is not being used while I test it.

@luizbafilho
Copy link
Contributor Author

/make-pr-image

@luizbafilho
Copy link
Contributor Author

/make-pr-image

@luizbafilho
Copy link
Contributor Author

/make-pr-image

@luizbafilho
Copy link
Contributor Author

/make-pr-image

yiannistri added a commit to weaveworks/weave-gitops-clusters that referenced this pull request May 15, 2023
Testing out spike for pipeline-controller using watchers (weaveworks/pipeline-controller#180). Must revert after demo.
@luizbafilho
Copy link
Contributor Author

/make-pr-image

@luizbafilho luizbafilho changed the title Add HelmReleases watcher [spike] Pull based model to get HelmRelease events Jul 7, 2023
@squaremo
Copy link
Contributor

This is superseded by #193.

@squaremo squaremo closed this Oct 26, 2023
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.

2 participants