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

fix: Enable default triggers for argo rollouts #1689

Merged
merged 14 commits into from
Dec 15, 2021

Conversation

RaviHari
Copy link
Contributor

@RaviHari RaviHari commented Dec 8, 2021

Fixes: #1668

Signed-off-by: Ravi Hari [email protected]

Checklist:

  • [ X ] 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.
  • [ X ] 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".
  • [ X ] I've signed my commits with DCO
  • [ X ] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • [ X ] My builds are green. Try syncing with master if they are not.
  • [ X ] My organization is added to USERS.md.

@RaviHari RaviHari changed the title fix: enable default trigerres for argo rollouts fix: Enable default trigerres for argo rollouts Dec 8, 2021
@RaviHari
Copy link
Contributor Author

RaviHari commented Dec 8, 2021

Testing Done:

Logs:

INFO[2021-12-08T22:33:14+05:30] Start processing                              resource=rollout-demo/rollout-bluegreen
INFO[2021-12-08T22:33:14+05:30] Trigger on-rollout-completed result: [{[0].xxxxx  [rollout-completed] false}]  resource=rollout-demo/rollout-bluegreen
INFO[2021-12-08T22:33:14+05:30] Trigger on-scaling-replica-set result: [{[0].xxxxx  [scaling-replicaset] false}]  resource=rollout-demo/rollout-bluegreen
apiVersion: v1
kind: ConfigMap
metadata:
  name: argo-rollouts-notification-configmap
  namespace: argo-rollouts
data:
  service.slack: |
    token: $slack-token
    icon: https://avatars.githubusercontent.com/u/30269780?s=400&v=4
  template.rollout-completed: |
    message: Rollout {{.rollout.metadata.name}} has been completed.
    slack:
      attachments: |
          [{
            "title": "{{ .rollout.metadata.name}}",
            "color": "#18be52",
            "fields": [
            {
              "title": "Strategy",
              "value": "{{if .rollout.spec.strategy.blueGreen}}BlueGreen{{end}}{{if .rollout.spec.strategy.canary}}Canary{{end}}",
              "short": true
            }
            {{range $index, $c := .rollout.spec.template.spec.containers}}
              {{if not $index}},{{end}}
              {{if $index}},{{end}}
              {
                "title": "{{$c.name}}",
                "value": "{{$c.image}}",
                "short": true
              }
            {{end}}
            ]
          }]
  template.rollout-step-completed: |
    message: Rollout {{.rollout.metadata.name}} step number {{ add .rollout.status.currentStepIndex 1}}/{{len .rollout.spec.strategy.canary.steps}} has been completed.
    email:
      subject: Rollout {{.rollout.metadata.name}} step number {{ add .rollout.status.currentStepIndex 1}}/{{len .rollout.spec.strategy.canary.steps}} has been completed.
    slack:
      attachments: |
          [{
            "title": "{{ .rollout.metadata.name}}",
            "color": "#18be52",
            "fields": [
            {
              "title": "Strategy",
              "value": "{{if .rollout.spec.strategy.blueGreen}}BlueGreen{{end}}{{if .rollout.spec.strategy.canary}}Canary{{end}}",
              "short": true
            },
            {
              "title": "Step completed",
              "value": "{{add .rollout.status.currentStepIndex 1}}/{{len .rollout.spec.strategy.canary.steps}}",
              "short": true
            }
            {{range $index, $c := .rollout.spec.template.spec.containers}}
              {{if not $index}},{{end}}
              {{if $index}},{{end}}
              {
                "title": "{{$c.name}}",
                "value": "{{$c.image}}",
                "short": true
              }
            {{end}}
            ]
          }]
  template.rollout-updated: |
    message: Rollout {{.rollout.metadata.name}} has been updated.
    email:
      subject: Rollout {{.rollout.metadata.name}} has been updated.
    slack:
      attachments: |
          [{
            "title": "{{ .rollout.metadata.name}}",
            "color": "#18be52",
            "fields": [
            {
              "title": "Strategy",
              "value": "{{if .rollout.spec.strategy.blueGreen}}BlueGreen{{end}}{{if .rollout.spec.strategy.canary}}Canary{{end}}",
              "short": true
            }
            {{range $index, $c := .rollout.spec.template.spec.containers}}
              {{if not $index}},{{end}}
              {{if $index}},{{end}}
              {
                "title": "{{$c.name}}",
                "value": "{{$c.image}}",
                "short": true
              }
            {{end}}
            ]
          }]
  template.scaling-replicaset: |
    message: Scaling Rollout {{.rollout.metadata.name}}'s replicaset to {{.rollout.spec.replicas}}.
    email:
      subject: Scaling Rollout {{.rollout.metadata.name}}'s replcaset to {{.rollout.spec.replicas}}.
    slack:
      attachments: |
          [{
            "title": "{{ .rollout.metadata.name}}",
            "color": "#18be52",
            "fields": [
            {
              "title": "Strategy",
              "value": "{{if .rollout.spec.strategy.blueGreen}}BlueGreen{{end}}{{if .rollout.spec.strategy.canary}}Canary{{end}}",
              "short": true
            },
            {
              "title": "Desired replica",
              "value": "{{.rollout.spec.replicas}}",
              "short": true
            },
            {
              "title": "Updated replicas",
              "value": "{{.rollout.status.updatedReplicas}}",
              "short": true
            }
            {{range $index, $c := .rollout.spec.template.spec.containers}}
              {{if not $index}},{{end}}
              {{if $index}},{{end}}
              {
                "title": "{{$c.name}}",
                "value": "{{$c.image}}",
                "short": true
              }
            {{end}}
            ]
          }]
  trigger.on-rollout-completed: |
    - send: [rollout-completed]
  trigger.on-rollout-step-completed: |
    - send: [rollout-step-completed]
  trigger.on-rollout-updated: |
    - send: [rollout-updated]
  trigger.on-scaling-replica-set: |
    - send: [scaling-replicaset]
  defaultTriggers: |
    - on-scaling-replica-set

slack messages:


testAPP  10:40 PM
Scaling Rollout rollout-bluegreen's replicaset to 1.
rollout-bluegreen
Strategy
BlueGreen
Desired replica
1
Updated replicas
2
rollouts-demo
argoproj/rollouts-demo:blue


New
10:40
Scaling Rollout rollout-bluegreen's replicaset to 2.
rollout-bluegreen
Strategy
BlueGreen
Desired replica
2
Updated replicas
1
rollouts-demo
argoproj/rollouts-demo:blue


10:41
Scaling Rollout rollout-bluegreen's replicaset to 3.
rollout-bluegreen
Strategy
BlueGreen
Desired replica
3
Updated replicas
2
rollouts-demo
argoproj/rollouts-demo:blue

utils/record/record.go Outdated Show resolved Hide resolved
utils/record/record.go Outdated Show resolved Hide resolved
utils/record/record.go Show resolved Hide resolved
utils/record/record.go Outdated Show resolved Hide resolved
utils/record/record.go Show resolved Hide resolved
@RaviHari RaviHari changed the title fix: Enable default trigerres for argo rollouts fix: Enable default triggers for argo rollouts Dec 9, 2021
@RaviHari RaviHari requested a review from huikang December 9, 2021 15:11
@jessesuen
Copy link
Member

@khhirani do you mind taking a look at this?

@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #1689 (0457797) into master (4d3b992) will decrease coverage by 0.04%.
The diff coverage is 78.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1689      +/-   ##
==========================================
- Coverage   82.07%   82.02%   -0.05%     
==========================================
  Files         116      116              
  Lines       16064    16096      +32     
==========================================
+ Hits        13184    13203      +19     
- Misses       2208     2218      +10     
- Partials      672      675       +3     
Impacted Files Coverage Δ
utils/record/record.go 86.75% <78.04%> (-4.08%) ⬇️
rollout/trafficrouting/alb/alb.go 82.26% <0.00%> (-2.69%) ⬇️
rollout/trafficrouting/istio/controller.go 50.81% <0.00%> (-1.63%) ⬇️
utils/analysis/helpers.go 77.93% <0.00%> (-0.25%) ⬇️
rollout/pause.go 95.33% <0.00%> (ø)
rollout/restart.go 98.64% <0.00%> (ø)
rollout/replicaset.go 67.59% <0.00%> (ø)
analysis/controller.go 52.17% <0.00%> (ø)
utils/metric/metric.go 100.00% <0.00%> (ø)
utils/ingress/ingress.go 100.00% <0.00%> (ø)
... and 18 more

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 4d3b992...0457797. Read the comment docs.

@RaviHari
Copy link
Contributor Author

RaviHari commented Dec 13, 2021

I noticed that some times this test-e2e fails on test case: TestIstioSuite/TestIstioAbortUpdateDeleteAllCanaryPods as given here: https://github.com/argoproj/argo-rollouts/runs/4494296112?check_suite_focus=true I think this is primarily due to a timeout not a functional defect.

time="2021-12-11T19:40:32Z" level=info msg="Waiting for condition: status=Degraded" rollout=istio-host-split
    when.go:440: timeout after 1m0s waiting for condition status=Degraded

When I run this test locally it works fine:

 make test-e2e E2E_TEST_OPTIONS="-testify.m TestIstioAbortUpdateDeleteAllCanaryPods"   
go test -timeout 30m -v -count 1 --tags e2e -p 4 --short ./test/e2e -testify.m TestIstioAbortUpdateDeleteAllCanaryPods
=== RUN   TestAnalysisSuite
    suite.go:190: warning: no tests to run
--- PASS: TestAnalysisSuite (0.00s)
=== RUN   TestAWSSuite
    suite.go:190: warning: no tests to run
--- PASS: TestAWSSuite (0.00s)
=== RUN   TestBlueGreenSuite
    suite.go:190: warning: no tests to run
--- PASS: TestBlueGreenSuite (0.00s)
=== RUN   TestCanarySuite
    suite.go:190: warning: no tests to run
--- PASS: TestCanarySuite (0.00s)
=== RUN   TestExperimentSuite
    suite.go:190: warning: no tests to run
--- PASS: TestExperimentSuite (0.00s)
=== RUN   TestFunctionalSuite
    suite.go:190: warning: no tests to run
--- PASS: TestFunctionalSuite (0.00s)
=== RUN   TestIstioSuite
=== RUN   TestIstioSuite/TestIstioAbortUpdateDeleteAllCanaryPods
time="2021-12-13T13:13:40+05:30" level=info msg="Deleting e2e-test-name=TestIstioAbortUpdateDeleteAllCanaryPods"
time="2021-12-13T13:13:43+05:30" level=info msg="service/istio-host-split-canary created\n" rollout=istio-host-split
time="2021-12-13T13:13:43+05:30" level=info msg="service/istio-host-split-stable created\n" rollout=istio-host-split
time="2021-12-13T13:13:43+05:30" level=info msg="virtualservice.networking.istio.io/istio-host-split-vsvc created\n" rollout=istio-host-split
time="2021-12-13T13:13:43+05:30" level=info msg="rollout.argoproj.io/istio-host-split created\n" rollout=istio-host-split
time="2021-12-13T13:13:43+05:30" level=info msg="Waiting for condition: status=Healthy" rollout=istio-host-split
time="2021-12-13T13:13:54+05:30" level=info msg="Condition 'status=Healthy' met after 10s" rollout=istio-host-split
time="2021-12-13T13:13:54+05:30" level=info msg="Updated rollout pod spec: 2021-12-13T13:13:54.128467+05:30" rollout=istio-host-split
time="2021-12-13T13:13:54+05:30" level=info msg="Waiting for condition: status=Paused" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Condition 'status=Paused' met after 5s" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Pod expectation 'revision:2 pod count == 2' met" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Promoted rollout" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Waiting for condition: status=Paused" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Condition 'status=Paused' met after 0s" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Promoted rollout" rollout=istio-host-split
time="2021-12-13T13:13:59+05:30" level=info msg="Waiting for condition: status=Paused" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Condition 'status=Paused' met after 4s" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Pod expectation 'revision:2 pod count == 4' met" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Aborted rollout" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Waiting for condition: status=Degraded" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Condition 'status=Degraded' met after 0s" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Pod expectation 'revision:1 pod count == 5' met" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Pod expectation 'revision:2 pod count == 4' met" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="rs expectation 'RS istio-host-split-b8d98f5fd scale down' met" rollout=istio-host-split
time="2021-12-13T13:14:04+05:30" level=info msg="Deleting e2e-test-name=TestIstioAbortUpdateDeleteAllCanaryPods"
time="2021-12-13T13:14:04+05:30" level=info msg="Deleting e2e-test-name"
--- PASS: TestIstioSuite (24.76s)
    --- PASS: TestIstioSuite/TestIstioAbortUpdateDeleteAllCanaryPods (24.49s)
=== RUN   TestSMIIngressSuite
    suite.go:190: warning: no tests to run
--- PASS: TestSMIIngressSuite (0.00s)
=== RUN   TestSMISuite
    suite.go:190: warning: no tests to run
--- PASS: TestSMISuite (0.00s)
PASS
ok      github.com/argoproj/argo-rollouts/test/e2e      25.688s

@jessesuen
Copy link
Member

I think this is primarily due to a timeout not a functional defect.

Yes tests are flaky right now. I'll resubmit it when I think/notice it is the case.

@harikrongali harikrongali requested review from harikrongali and removed request for khhirani December 13, 2021 18:30
@harikrongali
Copy link
Contributor

@RaviHari let me validate and come back. quick question, have you applied https://github.com/argoproj/argo-rollouts/blob/master/manifests/notifications-install.yaml ?

@RaviHari
Copy link
Contributor Author

@RaviHari let me validate and come back. quick question, have you applied https://github.com/argoproj/argo-rollouts/blob/master/manifests/notifications-install.yaml ?

@harikrongali ,
Thanks for loking into it.. In my local test yes I applied.. but the E2E tests now fail for a different usecase.. FAIL: TestFunctionalSuite/TestBlueGreenUpdate which passed in earlier runs.

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

LGTM!

utils/record/record.go Show resolved Hide resolved
Signed-off-by: Ravi Hari <[email protected]>
@sonarcloud
Copy link

sonarcloud bot commented Dec 15, 2021

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 7 Code Smells

No Coverage information No Coverage information
5.3% 5.3% Duplication

Copy link
Contributor

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

LGTM

@alexmt alexmt merged commit 5b140c9 into argoproj:master Dec 15, 2021
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.

Notifications do not respect defaultTriggers
5 participants