diff --git a/api/v1alpha1/conversion.go b/api/v1alpha1/conversion.go index bab7259e..10bcee41 100644 --- a/api/v1alpha1/conversion.go +++ b/api/v1alpha1/conversion.go @@ -23,6 +23,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" utilpointer "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/conversion" + "strings" ) func (src *Rollout) ConvertTo(dst conversion.Hub) error { @@ -74,7 +75,7 @@ func (src *Rollout) ConvertTo(dst conversion.Hub) error { obj.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels[k] = v } } - if src.Annotations[RolloutStyleAnnotation] != string(PartitionRollingStyle) { + if !strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(PartitionRollingStyle)) { obj.Spec.Strategy.Canary.EnableExtraWorkloadForCanary = true } if src.Annotations[TrafficRoutingAnnotation] != "" { @@ -211,9 +212,9 @@ func (dst *Rollout) ConvertFrom(src conversion.Hub) error { dst.Annotations = map[string]string{} } if srcV1beta1.Spec.Strategy.Canary.EnableExtraWorkloadForCanary { - dst.Annotations[RolloutStyleAnnotation] = string(CanaryRollingStyle) + dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(CanaryRollingStyle)) } else { - dst.Annotations[RolloutStyleAnnotation] = string(PartitionRollingStyle) + dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(PartitionRollingStyle)) } if srcV1beta1.Spec.Strategy.Canary.TrafficRoutingRef != "" { dst.Annotations[TrafficRoutingAnnotation] = srcV1beta1.Spec.Strategy.Canary.TrafficRoutingRef @@ -336,7 +337,7 @@ func (src *BatchRelease) ConvertTo(dst conversion.Hub) error { obj.Spec.ReleasePlan.PatchPodTemplateMetadata.Labels[k] = v } } - if src.Annotations[RolloutStyleAnnotation] != string(PartitionRollingStyle) { + if !strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(PartitionRollingStyle)) { obj.Spec.ReleasePlan.EnableExtraWorkloadForCanary = true } @@ -416,9 +417,9 @@ func (dst *BatchRelease) ConvertFrom(src conversion.Hub) error { dst.Annotations = map[string]string{} } if srcV1beta1.Spec.ReleasePlan.EnableExtraWorkloadForCanary { - dst.Annotations[RolloutStyleAnnotation] = string(CanaryRollingStyle) + dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(CanaryRollingStyle)) } else { - dst.Annotations[RolloutStyleAnnotation] = string(PartitionRollingStyle) + dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(PartitionRollingStyle)) } // status