Skip to content

Commit

Permalink
revert changes. only enable service if weighted or template service n…
Browse files Browse the repository at this point in the history
…ot nil

Signed-off-by: Alex Eftimie <[email protected]>
  • Loading branch information
alexef committed Nov 4, 2022
1 parent b262cd1 commit fcbb31a
Show file tree
Hide file tree
Showing 15 changed files with 587 additions and 485 deletions.
3 changes: 3 additions & 0 deletions manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,16 @@ spec:
type: string
type: object
type: object
service:
type: object
specRef:
type: string
weight:
format: int32
type: integer
required:
- name
- service
- specRef
type: object
type: array
Expand Down
3 changes: 3 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11571,13 +11571,16 @@ spec:
type: string
type: object
type: object
service:
type: object
specRef:
type: string
weight:
format: int32
type: integer
required:
- name
- service
- specRef
type: object
type: array
Expand Down
3 changes: 3 additions & 0 deletions manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11571,13 +11571,16 @@ spec:
type: string
type: object
type: object
service:
type: object
specRef:
type: string
weight:
format: int32
type: integer
required:
- name
- service
- specRef
type: object
type: array
Expand Down
7 changes: 7 additions & 0 deletions pkg/apiclient/rollout/rollout.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,10 @@
"type": "integer",
"format": "int32",
"title": "Weight sets the percentage of traffic the template's replicas should receive"
},
"service": {
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.TemplateService",
"title": "Service defines wether a service will be generated or not"
}
},
"title": "RolloutExperimentTemplate defines the template used to create experiments for the Rollout's experiment canary step"
Expand Down Expand Up @@ -1725,6 +1729,9 @@
},
"description": "TLSRoute holds the information on the virtual service's TLS/HTTPS routes that are desired to be matched for changing weights."
},
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.TemplateService": {
"type": "object"
},
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.TraefikTrafficRouting": {
"type": "object",
"properties": {
Expand Down
1,003 changes: 528 additions & 475 deletions pkg/apis/rollouts/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/apis/rollouts/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions pkg/apis/rollouts/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/apis/rollouts/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ type RolloutExperimentTemplate struct {
Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,5,opt,name=selector"`
// Weight sets the percentage of traffic the template's replicas should receive
Weight *int32 `json:"weight,omitempty" protobuf:"varint,6,opt,name=weight"`
// Service defines wether a service will be generated or not
Service *TemplateService `json:"service,omitemepty" protobuf:"bytes,7,opt,name=service"`
}

// PodTemplateMetadata extra labels to add to the template
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 || templateStep.Service != 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 @@ -818,7 +818,7 @@ 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)
}

func TestRolloutCreateExperimentWithServicePorts(t *testing.T) {
Expand Down Expand Up @@ -859,5 +859,5 @@ func TestRolloutCreateExperimentWithServicePorts(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)
}
1 change: 1 addition & 0 deletions test/e2e/functional/experiment-dry-run-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
templates:
- name: baseline
replicas: 1
service: {}
selector:
matchLabels:
app: experiment-with-dry-run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
templates:
- name: baseline
replicas: 1
service: {}
selector:
matchLabels:
app: experiment-with-mr
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/functional/experiment-with-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ spec:
templates:
- name: test
replicas: 1
service:
ports:
- protocol: TCP
port: 80
targetPort: 8080
service: {}
selector:
matchLabels:
app: experiment-with-service
Expand All @@ -29,3 +25,7 @@ spec:
requests:
memory: 16Mi
cpu: 1m
ports:
- protocol: TCP
port: 80
containerPort: 8080
13 changes: 13 additions & 0 deletions ui/src/models/rollout/generated/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,12 @@ export interface GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1RolloutExpe
* @memberof GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1RolloutExperimentTemplate
*/
weight?: number;
/**
*
* @type {GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1TemplateService}
* @memberof GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1RolloutExperimentTemplate
*/
service?: GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1TemplateService;
}
/**
*
Expand Down Expand Up @@ -1698,6 +1704,13 @@ export interface GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1TLSRoute {
*/
sniHosts?: Array<string>;
}
/**
*
* @export
* @interface GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1TemplateService
*/
export interface GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1TemplateService {
}
/**
*
* @export
Expand Down

0 comments on commit fcbb31a

Please sign in to comment.