Add CanaryDeployment kind

- bootstrap the deployments. services and Istio virtual service
- use google/go-cmp to detect changes in the deployment pod spec
This commit is contained in:
Stefan Prodan
2018-10-10 16:57:12 +03:00
parent 3eb60a8447
commit e2be4fdaed
47 changed files with 2675 additions and 2010 deletions
+21
View File
@@ -5,6 +5,8 @@ import (
"log"
"time"
"github.com/stefanprodan/flagger/pkg/operator"
_ "github.com/istio/glog"
sharedclientset "github.com/knative/pkg/client/clientset/versioned"
"github.com/knative/pkg/signals"
@@ -71,6 +73,7 @@ func main() {
rolloutInformerFactory := informers.NewSharedInformerFactory(rolloutClient, time.Second*30)
rolloutInformer := rolloutInformerFactory.Flagger().V1beta1().Canaries()
canaryDeploymentInformer := rolloutInformerFactory.Flagger().V1beta1().CanaryDeployments()
logger.Infof("Starting flagger version %s revision %s", version.VERSION, version.REVISION)
@@ -101,11 +104,22 @@ func main() {
logger,
)
cd := operator.NewController(
kubeClient,
sharedClient,
rolloutClient,
canaryDeploymentInformer,
controlLoopInterval,
metricsServer,
logger,
)
rolloutInformerFactory.Start(stopCh)
logger.Info("Waiting for informer caches to sync")
for _, synced := range []cache.InformerSynced{
rolloutInformer.Informer().HasSynced,
canaryDeploymentInformer.Informer().HasSynced,
} {
if ok := cache.WaitForCacheSync(stopCh, synced); !ok {
logger.Fatalf("Failed to wait for cache sync")
@@ -119,5 +133,12 @@ func main() {
}
}(c)
// start controller
go func(ctrl *operator.Controller) {
if err := ctrl.Run(2, stopCh); err != nil {
logger.Fatalf("Error running controller: %v", err)
}
}(cd)
<-stopCh
}