Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(trafficrouting): support ingresses with multiple service ports in TrafficRouting.ALB spec #3551

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions docs/features/traffic-management/alb.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,27 @@ spec:
alb:
# The referenced ingress will be injected with a custom action annotation, directing
# the AWS Load Balancer Controller to split traffic between the canary and stable
# Service, according to the desired traffic weight (required).
# Service, according to the desired traffic weight.
ingress: ingress
# If you want to controll multiple ingress resources you can use the ingresses field, if ingresses is specified
# If you want to control multiple ingress resources you can use the ingresses field, if ingresses is specified
# the ingress field will need to be omitted.
ingresses:
- ingress-1
- ingress-2
# Reference to a Service that the Ingress must target in one of the rules (optional).
# If omitted, uses canary.stableService.
rootService: root-service
# Service port is the port which the Service listens on (required).
# Service port is the port which the Service listens on.
servicePort: 443
# ServicePorts specify list of ports for given ingress. If no ports are listed for ingress
# under .servicePorts - it will fall back to .servicePort value as default
servicePorts:
- ingress: ingress-1
servicePorts: [80, 443]
```

To avoid confusion with ingress/ingresses and servicePort/servicePorts fields use either `ingress` + `servicePort` only if you have a single ingress with a single port. In all other cases use `ingresses` + `servicePorts`.

The referenced Ingress should be deployed with an ingress rule that matches the Rollout service:

```yaml
Expand Down Expand Up @@ -442,4 +449,4 @@ controller should operate on multiple values. This may be desired when a cluster
Ingress controllers that operate on different `kubernetes.io/ingress.class` or `spec.ingressClassName` values.

If the controller needs to operate on any Ingress without the `kubernetes.io/ingress.class`
annotation or `spec.ingressClassName`, the flag can be specified with an empty string (e.g. `--alb-ingress-classes ''`).
annotation or `spec.ingressClassName`, the flag can be specified with an empty string (e.g. `--alb-ingress-classes ''`).
22 changes: 21 additions & 1 deletion docs/getting-started/alb/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,31 @@ spec:
# Reference to a Service that the Ingress must target in one of the rules (optional).
# If omitted, uses canary.stableService.
rootService: rollouts-demo-root
# Service port is the port which the Service listens on (required).
# Service port is the port which the Service listens on.
servicePort: 443
...
```

If you need to manage more than one ingress or an ingress with multiple ports, you can use `ingresses` and `servicePorts` fields:

```yaml
...
trafficRouting:
alb:
ingresses:
- rollouts-demo-ingress
- some-other-ingress
# Reference to a Service that the Ingress must target in one of the rules (optional).
# If omitted, uses canary.stableService.
servicePorts:
- ingress: rollouts-demo-ingress
servicePorts: [443]
- ingress: some-other-ingress
servicePorts: [80, 443]
...
```


The Ingress referenced by the Rollout must have a rule which matches one of Rollout services.
This should be `canary.trafficRouting.alb.rootService` (if specified), otherwise the rollout will
use `canary.stableService`.
Expand Down
17 changes: 15 additions & 2 deletions manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,21 @@ spec:
servicePort:
format: int32
type: integer
servicePorts:
items:
properties:
ingress:
type: string
servicePorts:
items:
format: int32
type: integer
type: array
required:
- ingress
- servicePorts
type: object
type: array
stickinessConfig:
properties:
durationSeconds:
Expand All @@ -784,8 +799,6 @@ spec:
- durationSeconds
- enabled
type: object
required:
- servicePort
type: object
ambassador:
properties:
Expand Down
17 changes: 15 additions & 2 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13335,6 +13335,21 @@ spec:
servicePort:
format: int32
type: integer
servicePorts:
items:
properties:
ingress:
type: string
servicePorts:
items:
format: int32
type: integer
type: array
required:
- ingress
- servicePorts
type: object
type: array
stickinessConfig:
properties:
durationSeconds:
Expand All @@ -13346,8 +13361,6 @@ spec:
- durationSeconds
- enabled
type: object
required:
- servicePort
type: object
ambassador:
properties:
Expand Down
26 changes: 25 additions & 1 deletion pkg/apiclient/rollout/rollout.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,23 @@
}
},
"definitions": {
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.ALBIngressWithPorts": {
"type": "object",
"properties": {
"ingress": {
"type": "string",
"title": "Ingress specifies name of the ingress ServicePorts refer to"
},
"servicePorts": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"title": "ServicePorts define list of ports to be set for the ingress"
}
}
},
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.ALBStatus": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -523,7 +540,7 @@
"servicePort": {
"type": "integer",
"format": "int32",
"title": "ServicePort refers to the port that the Ingress action should route traffic to"
"title": "ServicePort refers to the port that the Ingress action should route traffic to.\nCan be omitted if ports for each Ingress from .Ingresses list specified via ServicePorts\n+optional"
},
"rootService": {
"type": "string",
Expand All @@ -543,6 +560,13 @@
"type": "string"
},
"title": "Ingresses refers to the name of an `Ingress` resource in the same namespace as the `Rollout` in a multi ingress scenario\n+optional"
},
"servicePorts": {
"type": "array",
"items": {
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.ALBIngressWithPorts"
},
"title": "ServicePorts define ports for ingresses in a multi ingress scenario,\nin cases when when ingress has multiple ports or has port different from specified servicePort\n+optional"
}
},
"title": "ALBTrafficRouting configuration for ALB ingress controller to control traffic routing"
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ALBIngressWithPorts,ServicePorts
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ALBTrafficRouting,Ingresses
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ALBTrafficRouting,ServicePorts
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AmbassadorTrafficRouting,Mappings
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunSpec,Args
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunSpec,DryRun
Expand Down
Loading
Loading