diff --git a/pkg/apis/flagger/v1beta1/canary.go b/pkg/apis/flagger/v1beta1/canary.go index 5251fe823..6106d143d 100644 --- a/pkg/apis/flagger/v1beta1/canary.go +++ b/pkg/apis/flagger/v1beta1/canary.go @@ -171,15 +171,15 @@ type CanaryService struct { // Apex is metadata to add to the apex service // +optional - Apex CustomMetadata `json:"apex,omitempty"` + Apex *CustomMetadata `json:"apex,omitempty"` // Primary is the metadata to add to the primary service // +optional - Primary CustomMetadata `json:"primary,omitempty"` + Primary *CustomMetadata `json:"primary,omitempty"` // Canary is the metadata to add to the canary service // +optional - Canary CustomMetadata `json:"canary,omitempty"` + Canary *CustomMetadata `json:"canary,omitempty"` } // CanaryAnalysis is used to describe how the analysis should be done diff --git a/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go b/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go index c1a7d3500..31ec068e1 100644 --- a/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go @@ -364,9 +364,21 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) { *out = make([]string, len(*in)) copy(*out, *in) } - in.Apex.DeepCopyInto(&out.Apex) - in.Primary.DeepCopyInto(&out.Primary) - in.Canary.DeepCopyInto(&out.Canary) + if in.Apex != nil { + in, out := &in.Apex, &out.Apex + *out = new(CustomMetadata) + (*in).DeepCopyInto(*out) + } + if in.Primary != nil { + in, out := &in.Primary, &out.Primary + *out = new(CustomMetadata) + (*in).DeepCopyInto(*out) + } + if in.Canary != nil { + in, out := &in.Canary, &out.Canary + *out = new(CustomMetadata) + (*in).DeepCopyInto(*out) + } return } diff --git a/pkg/router/kubernetes_default.go b/pkg/router/kubernetes_default.go index addb07afa..16ab28e35 100644 --- a/pkg/router/kubernetes_default.go +++ b/pkg/router/kubernetes_default.go @@ -68,7 +68,7 @@ func (c *KubernetesDefaultRouter) GetRoutes(_ *flaggerv1.Canary) (primaryRoute i return 0, 0, nil } -func (c *KubernetesDefaultRouter) reconcileService(canary *flaggerv1.Canary, name string, podSelector string, metadata flaggerv1.CustomMetadata) error { +func (c *KubernetesDefaultRouter) reconcileService(canary *flaggerv1.Canary, name string, podSelector string, metadata *flaggerv1.CustomMetadata) error { portName := canary.Spec.Service.PortName if portName == "" { portName = "http" @@ -218,7 +218,7 @@ func (c *KubernetesDefaultRouter) Finalize(canary *flaggerv1.Canary) error { return fmt.Errorf("service %s update error: %w", clone.Name, err) } } else { - err = c.reconcileService(canary, apexName, canary.Spec.TargetRef.Name, canary.Spec.Service.Apex) + err = c.reconcileService(canary, apexName, canary.Spec.TargetRef.Name, nil) if err != nil { return fmt.Errorf("reconcileService failed: %w", err) }