Skip to content

Commit

Permalink
Rollback change on service creation with weightless experiments
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Del Rio <[email protected]>
  • Loading branch information
daniddelrio committed Feb 24, 2023
1 parent 50c3b88 commit ae32617
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion rollout/experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func GetExperimentFromTemplate(r *v1alpha1.Rollout, stableRS, newRS *appsv1.Repl
Name: templateStep.Name,
Replicas: templateStep.Replicas,
}
template.Service = &v1alpha1.TemplateService{}
if templateStep.Weight != nil {
template.Service = &v1alpha1.TemplateService{}
}
templateRS := &appsv1.ReplicaSet{}
switch templateStep.SpecRef {
case v1alpha1.CanarySpecRef:
Expand Down
4 changes: 2 additions & 2 deletions rollout/experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ func TestRolloutCreateExperimentWithService(t *testing.T) {
Replicas: pointer.Int32Ptr(1),
Weight: pointer.Int32Ptr(5),
},
// Service should also be created for "canary-template"
// Service should NOT be created for "canary-template"
{
Name: "canary-template",
SpecRef: v1alpha1.CanarySpecRef,
Expand All @@ -818,5 +818,5 @@ func TestRolloutCreateExperimentWithService(t *testing.T) {
assert.NotNil(t, ex.Spec.Templates[0].Service)

assert.Equal(t, "canary-template", ex.Spec.Templates[1].Name)
assert.NotNil(t, ex.Spec.Templates[1].Service)
assert.Nil(t, ex.Spec.Templates[1].Service)
}

0 comments on commit ae32617

Please sign in to comment.