Skip to content

Commit

Permalink
fix: Rollback change on service creation with weightless experiments (#…
Browse files Browse the repository at this point in the history
…2624)

BREAKING CHANGE There was an unintentional change in behavior related to service creation with experiments introduced in v1.4.0 this has been reverted in v1.4.1 back to the original behavior. In v1.4.0 services where always created with for inline experiments even if there was no weight set. In 1.4.1 we go back to the original behavior of requiring weight to be set in order to create a service.
  • Loading branch information
daniddelrio authored Feb 24, 2023
1 parent 50c3b88 commit 6e623bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/features/experiment.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Experiment CRD allows users to have ephemeral runs of one or more ReplicaSet
running ephemeral ReplicaSets, the Experiment CRD can launch AnalysisRuns alongside the ReplicaSets.
Generally, those AnalysisRun is used to confirm that new ReplicaSets are running as expected.

A Service routing traffic to the Experiment ReplicaSet is also generated.
A Service routing traffic to the Experiment ReplicaSet is also generated if a weight for that experiment is set.

## Use cases of Experiments

Expand Down Expand Up @@ -245,7 +245,7 @@ to `experiment-baseline`, leaving the remaining 90% of traffic to the old stack.

!!! note
When a weighted experiment step with traffic routing is used, a
Service is auto-created for each experiment template. The traffic routers use
service is auto-created for each experiment template. The traffic routers use
this service to send traffic to the experiment pods.

By default, the generated Service has the name of the ReplicaSet and inherits
Expand Down
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 6e623bc

Please sign in to comment.