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: adding support for valueFrom in analysis arguments. #797

Merged
merged 10 commits into from
Nov 3, 2020
Merged

feat: adding support for valueFrom in analysis arguments. #797

merged 10 commits into from
Nov 3, 2020

Conversation

inspiremirnal
Copy link
Contributor

@inspiremirnal inspiremirnal commented Oct 20, 2020

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 "fix(valueFrom support): updated arguments to now resolve metadata. Fixes Analysis Arguments support for valueFrom  #778"`.
  • I've signed the CLA.
  • [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.

@CLAassistant
Copy link

CLAassistant commented Oct 20, 2020

CLA assistant check
All committers have signed the CLA.

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.

Please fix linting issues by running make lint and add documentation for the feature

utils/analysis/factory.go Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Oct 21, 2020

Codecov Report

Merging #797 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #797      +/-   ##
==========================================
+ Coverage   82.37%   82.40%   +0.03%     
==========================================
  Files          97       97              
  Lines        8279     8294      +15     
==========================================
+ Hits         6820     6835      +15     
  Misses       1045     1045              
  Partials      414      414              
Impacted Files Coverage Δ
pkg/apis/rollouts/validation/validation.go 89.72% <100.00%> (+0.83%) ⬆️
rollout/analysis.go 85.86% <100.00%> (ø)
rollout/experiment.go 86.25% <100.00%> (ø)
utils/analysis/factory.go 100.00% <100.00%> (ø)

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 c16119e...2d8c2e6. Read the comment docs.

@khhirani khhirani changed the title adding support for valueFrom in analysis arguments. fix: adding support for valueFrom in analysis arguments. Oct 26, 2020
@jessesuen jessesuen self-assigned this Oct 29, 2020
@jessesuen jessesuen changed the title fix: adding support for valueFrom in analysis arguments. feat: adding support for valueFrom in analysis arguments. Oct 31, 2020
docs/features/analysis.md Outdated Show resolved Hide resolved
docs/features/analysis.md Outdated Show resolved Hide resolved
@jessesuen
Copy link
Member

jessesuen commented Nov 3, 2020

I tried this out end-to-end, but it does not seem to be working.

EDIT: nevermind, i messed up my rollout labels.

kind: AnalysisTemplate
apiVersion: argoproj.io/v1alpha1
metadata:
  name: sleep-job
spec:
  args:
  - name: duration
    value: 0s
  - name: exit-code
    value: "0"
  metrics:
  - name: sleep-job
    provider:
      job:
        spec:
          template:
            spec:
              containers:
              - name: sleep-job
                image: nginx:1.19-alpine
                command: [sh, -c, -x]
                args: ["sleep {{args.duration}} && exit {{args.exit-code}}"]
              restartPolicy: Never
          backoffLimit: 0
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollout-inline-analysis
  metadata:
    labels:
      duration: 600s
spec:
  strategy:
    canary:
      steps:
      - setWeight: 10
      - analysis:
          templates:
          - templateName: sleep-job
          args:
          - name: duration
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['duration']
  selector:
    matchLabels:
      app: rollout-inline-analysis
  template:
    metadata:
      labels:
        app: rollout-inline-analysis
    spec:
      containers:
      - name: rollouts-demo
        image: nginx:1.19-alpine
        resources:
          requests:
            memory: 16Mi
            cpu: 5m

The resulting job did not have the value substituted:

    spec:
      containers:
      - args:
        - sleep  && exit 0
        command:
        - sh
        - -c
        - -x

@jessesuen jessesuen merged commit 101f99c into argoproj:master Nov 3, 2020
@jessesuen
Copy link
Member

Great work!

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.

Analysis Arguments support for valueFrom
4 participants