Skip to content

Commit

Permalink
Controller refactoring
Browse files Browse the repository at this point in the history
- split controller logic into components (deployer, observer, router and scheduler)
- set the canary analysis final state (failed or finished) in a single run
  • Loading branch information
stefanprodan committed Oct 11, 2018
1 parent 56f2ee9 commit baeee62
Show file tree
Hide file tree
Showing 7 changed files with 818 additions and 704 deletions.
20 changes: 12 additions & 8 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
for {
select {
case <-tickChan:
c.doRollouts()
c.scheduleCanaries()
case <-stopCh:
c.logger.Info("Shutting down operator workers")
return nil
Expand Down Expand Up @@ -182,13 +182,13 @@ func (c *Controller) syncHandler(key string) error {

c.rollouts.Store(fmt.Sprintf("%s.%s", cd.Name, cd.Namespace), cd)

if cd.Spec.TargetRef.Kind == "Deployment" {
err = c.bootstrapDeployment(cd)
if err != nil {
c.logger.Warnf("%s.%s bootstrap error %v", cd.Name, cd.Namespace, err)
return err
}
}
//if cd.Spec.TargetRef.Kind == "Deployment" {
// err = c.bootstrapDeployment(cd)
// if err != nil {
// c.logger.Warnf("%s.%s bootstrap error %v", cd.Name, cd.Namespace, err)
// return err
// }
//}

c.logger.Infof("Synced %s", key)

Expand Down Expand Up @@ -229,3 +229,7 @@ func (c *Controller) recordEventWarningf(r *flaggerv1.Canary, template string, a
c.logger.Infof(template, args...)
c.recorder.Event(r, corev1.EventTypeWarning, "Synced", fmt.Sprintf(template, args...))
}

func int32p(i int32) *int32 {
return &i
}
Loading

0 comments on commit baeee62

Please sign in to comment.