Merge pull request #217 from weaveworks/provider

Add the service mesh provider to the canary spec
This commit is contained in:
Stefan Prodan
2019-06-21 11:13:17 +03:00
committed by GitHub
5 changed files with 18 additions and 2 deletions
+2
View File
@@ -45,6 +45,8 @@ spec:
- service
- canaryAnalysis
properties:
provider:
type: string
progressDeadlineSeconds:
type: number
targetRef:
+2
View File
@@ -46,6 +46,8 @@ spec:
- service
- canaryAnalysis
properties:
provider:
type: string
progressDeadlineSeconds:
type: number
targetRef:
+4
View File
@@ -45,6 +45,10 @@ type Canary struct {
// CanarySpec is the spec for a Canary resource
type CanarySpec struct {
// if specified overwrites the -mesh-provider flag for this particular canary
// +optional
Provider string `json:"provider,omitempty"`
// reference to target resource
TargetRef hpav1.CrossVersionObjectReference `json:"targetRef"`
+8 -2
View File
@@ -90,10 +90,16 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh
primaryName := fmt.Sprintf("%s-primary", cd.Spec.TargetRef.Name)
// override the global provider if one is specified in the canary spec
provider := c.meshProvider
if cd.Spec.Provider != "" {
provider = cd.Spec.Provider
}
// create primary deployment and hpa if needed
// skip primary check for Istio since the deployment will become ready after the ClusterIP are created
skipPrimaryCheck := false
if skipLivenessChecks || strings.Contains(c.meshProvider, "istio") {
if skipLivenessChecks || strings.Contains(provider, "istio") {
skipPrimaryCheck = true
}
label, ports, err := c.deployer.Initialize(cd, skipPrimaryCheck)
@@ -103,7 +109,7 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh
}
// init routers
meshRouter := c.routerFactory.MeshRouter(c.meshProvider)
meshRouter := c.routerFactory.MeshRouter(provider)
// create or update ClusterIP services
if err := c.routerFactory.KubernetesRouter(label, ports).Reconcile(cd); err != nil {
+2
View File
@@ -47,6 +47,8 @@ func (factory *Factory) MeshRouter(provider string) Interface {
switch {
case provider == "none":
return &NopRouter{}
case provider == "kubernetes":
return &NopRouter{}
case provider == "nginx":
return &IngressRouter{
logger: factory.logger,