fix nil check

Signed-off-by: Megrez Lu <lujiajing1126@gmail.com>
This commit is contained in:
Megrez Lu 2024-11-29 11:28:10 +08:00
parent cb609fa210
commit 8880544881
1 changed files with 1 additions and 1 deletions

View File

@ -601,7 +601,7 @@ func newTrafficRoutingContext(c *RolloutContext) *trafficrouting.TrafficRoutingC
revisionLabelKey = c.Workload.RevisionLabelKey
}
var selectorPatch map[string]string
if c.Rollout.Spec.Strategy.GetRollingStyle() == v1beta1.CanaryRollingStyle {
if !c.Rollout.Spec.Strategy.DisableGenerateCanaryService() && c.Rollout.Spec.Strategy.Canary.PatchPodTemplateMetadata != nil {
selectorPatch = c.Rollout.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels
}
return &trafficrouting.TrafficRoutingContext{