Skip to content

Commit

Permalink
feat: add support for valueFrom in analysis arguments. (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
inspiremirnal authored Nov 3, 2020
1 parent c16119e commit 101f99c
Show file tree
Hide file tree
Showing 17 changed files with 521 additions and 19 deletions.
32 changes: 32 additions & 0 deletions docs/features/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,38 @@ spec:
valueFrom:
podTemplateHashValue: Latest
```
Analysis arguments also support valueFrom for reading metadata fields and passing them as arguments to AnalysisTemplate.
An example would be to reference metadata labels like env and region and passing them along to AnalysisTemplate.
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: guestbook
labels:
appType: demo-app
buildType: nginx-app
...
env: dev
region: us-west-2
spec:
...
strategy:
canary:
analysis:
templates:
- templateName: args-example
args:
...
- name: env
valueFrom:
fieldRef:
fieldPath: metadata.labels['env']
# region where this app is deployed
- name: region
valueFrom:
fieldRef:
fieldPath: metadata.labels['region']
```

## BlueGreen Pre Promotion Analysis
A Rollout using the BlueGreen strategy can launch an AnalysisRun before it switches traffic to the new version. The
Expand Down
7 changes: 7 additions & 0 deletions manifests/crds/analysis-run-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
secretKeyRef:
properties:
key:
Expand Down
7 changes: 7 additions & 0 deletions manifests/crds/analysis-template-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
secretKeyRef:
properties:
key:
Expand Down
7 changes: 7 additions & 0 deletions manifests/crds/cluster-analysis-template-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
secretKeyRef:
properties:
key:
Expand Down
7 changes: 7 additions & 0 deletions manifests/crds/experiment-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
secretKeyRef:
properties:
key:
Expand Down
35 changes: 35 additions & 0 deletions manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
type: object
Expand Down Expand Up @@ -154,6 +161,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
type: object
Expand Down Expand Up @@ -202,6 +216,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
type: object
Expand Down Expand Up @@ -267,6 +288,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
type: object
Expand Down Expand Up @@ -302,6 +330,13 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
type: object
Expand Down
121 changes: 121 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
Expand Down Expand Up @@ -2866,6 +2875,15 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
Expand Down Expand Up @@ -5619,6 +5637,15 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
Expand Down Expand Up @@ -8381,6 +8408,15 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
Expand Down Expand Up @@ -11138,8 +11174,25 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
- name
type: object
type: object
required:
- name
Expand Down Expand Up @@ -11170,8 +11223,25 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
- name
type: object
type: object
required:
- name
Expand Down Expand Up @@ -11218,8 +11288,25 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
- name
type: object
type: object
required:
- name
Expand Down Expand Up @@ -11283,8 +11370,25 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
- name
type: object
type: object
required:
- name
Expand Down Expand Up @@ -11318,8 +11422,25 @@ spec:
type: string
valueFrom:
properties:
fieldRef:
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
podTemplateHashValue:
type: string
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
- name
type: object
type: object
required:
- name
Expand Down
Loading

0 comments on commit 101f99c

Please sign in to comment.