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

Traefik support #1

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
1929f48
Make Traefik suppurt
Philipp-Plotnikov Mar 2, 2022
628f106
Make Traefik suppurt
Philipp-Plotnikov Mar 2, 2022
bc71f07
Make Traefik suppurt
Philipp-Plotnikov Mar 2, 2022
77b4388
Traefik support
Philipp-Plotnikov Mar 2, 2022
97f561d
Traefik support
Philipp-Plotnikov Mar 2, 2022
cd8a86f
Update traefik
Philipp-Plotnikov Mar 11, 2022
accec27
Implement traefil support
Philipp-Plotnikov Mar 11, 2022
0accb50
make codegen
Philipp-Plotnikov Mar 11, 2022
58779d2
Refactor
Philipp-Plotnikov Mar 11, 2022
cebe6f1
Add traefik tests
Philipp-Plotnikov Mar 15, 2022
5e08058
Goimports
Philipp-Plotnikov Mar 15, 2022
448ec75
Refactor
Philipp-Plotnikov Mar 15, 2022
63f6516
Add test to trafiicrouting_test.go
Philipp-Plotnikov Mar 15, 2022
4cbb2aa
Remove added test to trafficrouting_test.go
Philipp-Plotnikov Mar 15, 2022
a6109bf
Refactor
Philipp-Plotnikov Mar 25, 2022
e97d057
Refactor
Philipp-Plotnikov Mar 25, 2022
284ce6c
Generate new files
Philipp-Plotnikov Mar 30, 2022
53e17fc
Make codegen
Philipp-Plotnikov Mar 30, 2022
2aa3b89
Add tests
Philipp-Plotnikov Apr 1, 2022
6c6c5e7
Add tests
Philipp-Plotnikov Apr 1, 2022
b4b5236
Add tests
Philipp-Plotnikov Apr 1, 2022
32d1c9f
Add test
Philipp-Plotnikov Apr 4, 2022
008e200
Change tests
Philipp-Plotnikov Apr 4, 2022
c4dad00
Add mocks
Philipp-Plotnikov Apr 4, 2022
c926d73
Add tests
Philipp-Plotnikov Apr 5, 2022
0aca820
Add tests
Philipp-Plotnikov Apr 5, 2022
2740b46
Merge remote-tracking branch 'upstream' into traefik-support
Philipp-Plotnikov Apr 5, 2022
3b0ccdd
Change go.yml
Philipp-Plotnikov Apr 5, 2022
39fdcc9
Refactor
Philipp-Plotnikov Apr 5, 2022
34c61b8
Back apimachinery package version
Philipp-Plotnikov Apr 5, 2022
981d95b
Revert "Back apimachinery package version"
Philipp-Plotnikov Apr 5, 2022
2497360
Fix
Philipp-Plotnikov Apr 5, 2022
900302a
Bump
Philipp-Plotnikov Apr 5, 2022
1699666
Refactor
Philipp-Plotnikov Apr 6, 2022
973ccb9
Resolve conflicts
Philipp-Plotnikov Apr 6, 2022
df83f35
Add field doc
Philipp-Plotnikov Apr 6, 2022
1205017
Make codegen
Philipp-Plotnikov Apr 6, 2022
f56b7a0
Removew verifyWeight and add permissions
Philipp-Plotnikov Apr 20, 2022
58b1fd2
Back go.yml
Philipp-Plotnikov Apr 20, 2022
3e22d53
Back go.yml
Philipp-Plotnikov Apr 20, 2022
16e62b2
Change manifests
Philipp-Plotnikov Apr 21, 2022
043791b
Refactor
Philipp-Plotnikov Apr 21, 2022
eee9f80
Fix tests
Philipp-Plotnikov Apr 21, 2022
c67261b
Add tests
Philipp-Plotnikov Apr 22, 2022
7979fd6
Add test
Philipp-Plotnikov Apr 22, 2022
faa3aab
Bump
Philipp-Plotnikov Apr 22, 2022
26f4349
Add documentation
Philipp-Plotnikov Apr 22, 2022
0dff7e6
Refactor
Philipp-Plotnikov Apr 22, 2022
6ca38fb
Refactor
PhilippPlotnikov Apr 27, 2022
12c230a
Merge remote-tracking branch 'origin/master' into traefik-support
PhilippPlotnikov Apr 27, 2022
45dceeb
Bump
PhilippPlotnikov Apr 27, 2022
f508232
Refactor
PhilippPlotnikov Apr 29, 2022
83faac3
Bump
PhilippPlotnikov Apr 29, 2022
ba6d753
Bump
PhilippPlotnikov Apr 29, 2022
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
101 changes: 101 additions & 0 deletions docs/features/traffic-management/traefik.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Traefik

The [TraefikService](https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#kind-traefikservice) is the object supports the ability for [weighted round robin load balancing](https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#weighted-round-robin) and (traffic mirroring)[https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#mirroring] when using Traefik as ingress.

## How to integrate TraefikService with Argo Rollouts using it as weighted round robin load balancer

Firstly, we need to create the TraefikService object using its ability for weighted round robin load balancing.

```yaml
apiVersion: traefik.containo.us/v1alpha1
kind: TraefikService
metadata:
name: traefik-service
spec:
weighted:
services:
- name: stable-rollout # k8s service name that you need to create for stable application version
port: 80
- name: canary-rollout # k8s service name that you need to create for new application version
port: 80
```

Notice, we don't specify the `weight` field. It is necessary to be synced with ArgoCD. If we specify this field and Argo Rollouts controller will change it, ArgoCD controller will notice it and will show that this resource is out of sync.

Secondly, we need to create the Argo Rollouts controller.

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
replicas: 5
strategy:
canary:
canaryService: canary-rollout
stableService: stable-rollout
trafficRouting:
traefik:
weightedTraefikServiceName: traefik-service # specify traefikService resource name that we have created before
steps:
- setWeight: 30
- pause: {}
- setWeight: 40
- pause: {duration: 10}
- setWeight: 60
- pause: {duration: 10}
- setWeight: 80
- pause: {duration: 10}
...
```

## How to integrate TraefikService with Argo Rollouts using it as traffic mirror

Firstly, we also need to create the TraefikService object but using its ability for traffic mirroring.

```yaml
apiVersion: traefik.containo.us/v1alpha1
kind: TraefikService
metadata:
name: traefik-service
spec:
mirroring:
name: some-service
port: 80
mirrors:
- name: stable-rollout # k8s service name that you need to create for stable application version
port: 80
- name: canary-rollout # k8s service name that you need to create for new application version
port: 80
```

Notice, we don't specify the `percent` field. It is necessary to be synced with ArgoCD. If we specify this field and Argo Rollouts controller will change it, ArgoCD controller will notice it and will show that this resource is out of sync.

Secondly, we need to create the Argo Rollouts controller.

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
replicas: 5
strategy:
canary:
canaryService: canary-rollout
stableService: stable-rollout
trafficRouting:
traefik:
mirrorTraefikServiceName: traefik-service # specify traefikService resource name that we have created before
steps:
- setWeight: 30
- pause: {}
- setWeight: 40
- pause: {duration: 10}
- setWeight: 60
- pause: {duration: 10}
- setWeight: 80
- pause: {duration: 10}
...
```
7 changes: 7 additions & 0 deletions manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,13 @@ spec:
trafficSplitName:
type: string
type: object
traefik:
properties:
weightedTraefikServiceName:
type: string
required:
- weightedTraefikServiceName
type: object
type: object
type: object
type: object
Expand Down
15 changes: 15 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11721,6 +11721,13 @@ spec:
trafficSplitName:
type: string
type: object
traefik:
properties:
weightedTraefikServiceName:
type: string
required:
- weightedTraefikServiceName
type: object
type: object
type: object
type: object
Expand Down Expand Up @@ -14534,6 +14541,14 @@ rules:
- list
- update
- patch
- apiGroups:
- traefik.containo.us
resources:
- traefikservices
verbs:
- watch
- get
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
15 changes: 15 additions & 0 deletions manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11721,6 +11721,13 @@ spec:
trafficSplitName:
type: string
type: object
traefik:
properties:
weightedTraefikServiceName:
type: string
required:
- weightedTraefikServiceName
type: object
type: object
type: object
type: object
Expand Down Expand Up @@ -14534,6 +14541,14 @@ rules:
- list
- update
- patch
- apiGroups:
- traefik.containo.us
resources:
- traefikservices
verbs:
- watch
- get
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
11 changes: 8 additions & 3 deletions manifests/role/argo-rollouts-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ rules:
- list
- update
- patch



- apiGroups:
- traefik.containo.us
resources:
- traefikservices
verbs:
- watch
- get
- update
14 changes: 14 additions & 0 deletions pkg/apiclient/rollout/rollout.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,10 @@
"appMesh": {
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.AppMeshTrafficRouting",
"title": "AppMesh holds specific configuration to use AppMesh to route traffic"
},
"traefik": {
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.TraefikTrafficRouting",
"title": "Traefik holds specific configuration to use Traefik to route traffic"
}
},
"title": "RolloutTrafficRouting hosts all the different configuration for supported service meshes to enable more fine-grained traffic routing"
Expand Down Expand Up @@ -1592,6 +1596,16 @@
},
"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.TraefikTrafficRouting": {
"type": "object",
"properties": {
"weightedTraefikServiceName": {
"type": "string",
"title": "TraefikServiceName refer to the name of the Traefik service used to route traffic to the service"
}
},
"title": "TraefikTrafficRouting defines the configuration required to use Traefik as traffic router"
},
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.TrafficWeights": {
"type": "object",
"properties": {
Expand Down
Loading