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: Traefik support. Fixes #516 #1907

Merged
merged 54 commits into from
Apr 29, 2022

Conversation

PhilippPlotnikov
Copy link
Contributor

@PhilippPlotnikov PhilippPlotnikov commented Mar 11, 2022

Fixes #516

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

@PhilippPlotnikov PhilippPlotnikov mentioned this pull request Mar 11, 2022
@PhilippPlotnikov PhilippPlotnikov changed the title Traefik support Traefik support. fixed #516 Mar 11, 2022
@PhilippPlotnikov PhilippPlotnikov changed the title Traefik support. fixed #516 Feat:Traefik support. fixed #516 Mar 11, 2022
@PhilippPlotnikov PhilippPlotnikov changed the title Feat:Traefik support. fixed #516 feat:Traefik support. fixed #516 Mar 11, 2022
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #1907 (ba6d753) into master (e42b4d4) will decrease coverage by 0.01%.
The diff coverage is 82.69%.

@@            Coverage Diff             @@
##           master    #1907      +/-   ##
==========================================
- Coverage   82.51%   82.50%   -0.02%     
==========================================
  Files         119      120       +1     
  Lines       16919    17054     +135     
==========================================
+ Hits        13961    14070     +109     
- Misses       2265     2283      +18     
- Partials      693      701       +8     
Impacted Files Coverage Δ
utils/defaults/defaults.go 88.35% <ø> (ø)
rollout/trafficrouting/traefik/traefik.go 81.25% <81.25%> (ø)
rollout/trafficrouting.go 81.70% <100.00%> (+0.64%) ⬆️
metricproviders/prometheus/prometheus.go 96.42% <0.00%> (-3.58%) ⬇️
analysis/analysis.go 85.53% <0.00%> (-0.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e42b4d4...ba6d753. Read the comment docs.

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
@PhilippPlotnikov PhilippPlotnikov changed the title feat:Traefik support. fixed #516 feat: Traefik support. fixed #516 Mar 30, 2022
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
@alexec alexec changed the title feat: Traefik support. fixed #516 feat: Traefik support. Fixes #516 Apr 3, 2022
@leoluz
Copy link
Contributor

leoluz commented Apr 7, 2022

Please update rollouts controller rbac permissions allowing it to update the traefik service resources.

Copy link
Member

@perenesenko perenesenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have one comment for the VerifyWeight

return selectedService, nil
}

func (r *Reconciler) VerifyWeight(desiredWeight int32, additionalDestinations ...v1alpha1.WeightDestination) (*bool, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably there is no need to implement this method in that way. You're accessing the same traefic service object (which you just modified in a SetWeight method)

Right now it's implemented for ALB only. The reason whay we have this implementation for the ALB is delays in traffic shifting.
For the ALB once you modified the Ingress object it take some time to really shift the traffic by creating/modifying target group. So here we need to make validation against the target group objects to see the traffic was really updated.

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Philipp-Plotnikov and others added 6 commits April 22, 2022 17:09
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>
Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>
@leoluz leoluz self-assigned this Apr 28, 2022
Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>
Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>
Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>
@sonarcloud
Copy link

sonarcloud bot commented Apr 29, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
2.6% 2.6% Duplication

Copy link
Contributor

@leoluz leoluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@perenesenko perenesenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ayanhamza
Copy link

ayanhamza commented Jun 24, 2022

@PhilippPlotnikov Hello !
I am using Traefik ingress for Canary Deploy and used kind TraefikService for trafficRouting. Everything works fine when i start deploy canary release. Traffic for my services splits by weight for Canary pods by percentage. BUT when Canary version of my app is Degraded (in case of failure analysis) it's rollback to old version and requests for my Stable version not go. Because argo rollout after Degraded don't sends traffic via canary service. How to modify code to send traffic via canary service also after Degraded??
Cause in IngressRoute object of Traefik I declare in spec service "TraefikService". And TraefikService dont't work's properly when one of the services can't receive traffic to pods.

  strategy:
    canary:
      canaryService: colorapi-canary
      stableService: colorapi-stable
      trafficRouting:
        traefik:
          weightedTraefikServiceName: colorapi
      analysis:
        templates:
        - templateName: web
      steps:
      - setWeight: 10
      - pause:
          duration: 50s
      - setWeight: 50
      - pause:
          duration: 50s
apiVersion: traefik.containo.us/v1alpha1
kind: TraefikService
metadata:
  name: colorapi
  namespace: devops-services
spec:
  weighted:
    services:
      - name: colorapi-canary
        port: 5000
      - name: colorapi-stable
        port: 5000
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  annotations:
    kubernetes.io/ingress.class: traefik
  creationTimestamp: null
  name: colorapi
  namespace: devops-services
spec:
  entryPoints: []
  routes:
  - kind: Rule
    match: Host("colorapi") && PathPrefix("/")
    middlewares: []
    priority: 0
    services:
    - kind: TraefikService
      name: colorapi

@ayanhamza
Copy link

ayanhamza commented Jun 24, 2022

I found that after "Degraded" selector of kind:Service canary not return to old ReplicaSet Hash. And still remains in new ReplicaSet Hash. That's why canary-service doesn't have endpoints. And TraefikService not serve traffic to stable version,
Please help. How to modify code to change Hash of selector to old ReplicaSet if new canary version of app don't updated and Degraded ?

Name:              colorapi-canary
Namespace:         devops-services
Labels:            app=colorapi
                   app.kubernetes.io/instance=colorapi
Annotations:       argo-rollouts.argoproj.io/managed-by-rollouts: colorapi
Selector:          app=colorapi,rollouts-pod-template-hash=75f9cc4fb4
Type:              ClusterIP
IP Families:       <none>
IP:                192.168.18.218
IPs:               <none>
Port:              web  5000/TCP
TargetPort:        5000/TCP
Endpoints:         <none>
Session Affinity:  None
Events:            <none>
Name:              colorapi-stable
Namespace:         devops-services
Labels:            app=colorapi
                   app.kubernetes.io/instance=colorapi
Annotations:       argo-rollouts.argoproj.io/managed-by-rollouts: colorapi
Selector:          app=colorapi,rollouts-pod-template-hash=5c559c684b
Type:              ClusterIP
IP Families:       <none>
IP:                192.168.29.202
IPs:               <none>
Port:              web  5000/TCP
TargetPort:        5000/TCP
Endpoints:         192.168.189.142:5000,192.168.223.178:5000
Session Affinity:  None
Events:            <none>

jenciso pushed a commit to jenciso/argo-rollouts that referenced this pull request Oct 25, 2022
* Make Traefik suppurt

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Make Traefik suppurt

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Make Traefik suppurt

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Traefik support

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Traefik support

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Update traefik

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Implement traefil support

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* make codegen

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add traefik tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Goimports

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add test to trafiicrouting_test.go

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Remove added test to trafficrouting_test.go

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Generate new files

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Make codegen

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add test

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Change tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add mocks

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Change go.yml

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Back apimachinery package version

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Revert "Back apimachinery package version"

This reverts commit 34c61b8.

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Fix

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Bump

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add field doc

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Make codegen

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Removew verifyWeight and add permissions

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Back go.yml

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Back go.yml

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Change manifests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Fix tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add tests

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add test

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Bump

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Add documentation

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>

* Refactor

Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>

* Bump

Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>

* Refactor

Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>

* Bump

Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>

* Bump

Signed-off-by: PhilippPlotnikov <philipp.plotnikov@codefresh.io>

Co-authored-by: PhilippPlotnikov <70917163+PhilippDeveloper@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Traefik Support
6 participants