From 746507dcc9bf88fcc30f16525dfcff8300d2aa65 Mon Sep 17 00:00:00 2001 From: nmlc Date: Thu, 26 Nov 2020 05:28:38 +0500 Subject: [PATCH] [traefik] Remove TraefikService metadata from canary spec --- artifacts/flagger/crd.yaml | 12 ------------ charts/flagger/crds/crd.yaml | 12 ------------ kustomize/base/flagger/crd.yaml | 12 ------------ pkg/apis/flagger/v1beta1/canary.go | 4 ---- pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go | 5 ----- pkg/router/traefik.go | 2 +- pkg/router/traefik_test.go | 6 +++--- test/e2e-traefik-tests.sh | 2 +- 8 files changed, 5 insertions(+), 50 deletions(-) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 6d25ab39..1eebd4be 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -542,18 +542,6 @@ spec: type: object additionalProperties: type: string - traefikService: - description: Metadata to add to the TraefikService - type: object - properties: - labels: - type: object - additionalProperties: - type: string - annotations: - type: object - additionalProperties: - type: string skipAnalysis: description: Skip analysis and promote canary type: boolean diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index 6d25ab39..1eebd4be 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -542,18 +542,6 @@ spec: type: object additionalProperties: type: string - traefikService: - description: Metadata to add to the TraefikService - type: object - properties: - labels: - type: object - additionalProperties: - type: string - annotations: - type: object - additionalProperties: - type: string skipAnalysis: description: Skip analysis and promote canary type: boolean diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 6d25ab39..1eebd4be 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -542,18 +542,6 @@ spec: type: object additionalProperties: type: string - traefikService: - description: Metadata to add to the TraefikService - type: object - properties: - labels: - type: object - additionalProperties: - type: string - annotations: - type: object - additionalProperties: - type: string skipAnalysis: description: Skip analysis and promote canary type: boolean diff --git a/pkg/apis/flagger/v1beta1/canary.go b/pkg/apis/flagger/v1beta1/canary.go index fca2e54a..38b90761 100644 --- a/pkg/apis/flagger/v1beta1/canary.go +++ b/pkg/apis/flagger/v1beta1/canary.go @@ -175,10 +175,6 @@ type CanaryService struct { // +optional Backends []string `json:"backends,omitempty"` - // TraefikService is metadata to add to the traefik service - // +optional - TraefikService *CustomMetadata `json:"traefikService,omitempty"` - // Apex is metadata to add to the apex service // +optional Apex *CustomMetadata `json:"apex,omitempty"` diff --git a/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go b/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go index 41f9a065..5a878808 100644 --- a/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go @@ -369,11 +369,6 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) { *out = make([]string, len(*in)) copy(*out, *in) } - if in.TraefikService != nil { - in, out := &in.TraefikService, &out.TraefikService - *out = new(CustomMetadata) - (*in).DeepCopyInto(*out) - } if in.Apex != nil { in, out := &in.Apex, &out.Apex *out = new(CustomMetadata) diff --git a/pkg/router/traefik.go b/pkg/router/traefik.go index 7e57316a..04081e37 100644 --- a/pkg/router/traefik.go +++ b/pkg/router/traefik.go @@ -40,7 +40,7 @@ func (tr *TraefikRouter) Reconcile(canary *flaggerv1.Canary) error { traefikService, err := tr.traefikClient.TraefikV1alpha1().TraefikServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{}) if errors.IsNotFound(err) { - tsMetadata := canary.Spec.Service.TraefikService + tsMetadata := canary.Spec.Service.Apex if tsMetadata == nil { tsMetadata = &flaggerv1.CustomMetadata{} } diff --git a/pkg/router/traefik_test.go b/pkg/router/traefik_test.go index e4c84dbc..7c5cde96 100644 --- a/pkg/router/traefik_test.go +++ b/pkg/router/traefik_test.go @@ -13,7 +13,7 @@ import ( func TestTraefikRouter_Reconcile(t *testing.T) { mocks := newFixture(nil) - mocks.canary.Spec.Service.TraefikService = &flaggerv1.CustomMetadata{ + mocks.canary.Spec.Service.Apex = &flaggerv1.CustomMetadata{ Labels: map[string]string{ "test": "label", }, @@ -35,8 +35,8 @@ func TestTraefikRouter_Reconcile(t *testing.T) { assert.Len(t, services, 1) assert.Equal(t, uint(100), services[0].Weight) - assert.Equal(t, ts.ObjectMeta.Labels, mocks.canary.Spec.Service.TraefikService.Labels) - assert.Equal(t, ts.ObjectMeta.Annotations, mocks.canary.Spec.Service.TraefikService.Annotations) + assert.Equal(t, ts.ObjectMeta.Labels, mocks.canary.Spec.Service.Apex.Labels) + assert.Equal(t, ts.ObjectMeta.Annotations, mocks.canary.Spec.Service.Apex.Annotations) for _, tt := range []struct { name string diff --git a/test/e2e-traefik-tests.sh b/test/e2e-traefik-tests.sh index e983d619..f927aca7 100755 --- a/test/e2e-traefik-tests.sh +++ b/test/e2e-traefik-tests.sh @@ -51,7 +51,7 @@ spec: service: port: 80 targetPort: 9898 - traefikService: + apex: labels: test: test-label annotations: