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(pass-businessid): pass businessid into container template #165

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions cronjob/templates/_argo_cron_workflow.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@

{{- if .Values.containers }}
{{- range .Values.containers }}
{{ $value := list . $.Release.Namespace $.Values.name }}
{{ $value := list . $.Release.Namespace $.Values.name $.Values.businessid }}
- {{- include "cronjob.argo_cron_workflow.container_template" $value | nindent 8}}
{{- end }}
{{- else }}
{{- $defaultValue := merge (fromJson "{\"name\":\"template\"}") $.Values }}
{{- $value := list $defaultValue $.Release.Namespace $.Values.name }}
{{- $value := list $defaultValue $.Release.Namespace $.Values.name $.Values.businessid}}
- {{- include "cronjob.argo_cron_workflow.container_template" $value | nindent 8 }}
{{- end }}

Expand Down
3 changes: 2 additions & 1 deletion cronjob/templates/_argo_cron_workflow_container_template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
{{- $input := index . 0 -}}
{{- $namespace := index . 1 -}}
{{- $workflowName := index . 2 -}}
{{- $businessid := index . 3 -}}
name: {{ $input.name }}
metadata:
namespace: {{ $namespace }}
labels:
businessid: {{ $input.businessid | quote }}
businessid: {{ $businessid | quote }}
{{- with $input.podSpecPatch }}
podSpecPatch: {{ quote . }}
{{- end }}
Expand Down
11 changes: 10 additions & 1 deletion cronjob/tests/cronjob_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,13 @@ tests:
businessid: ~
asserts:
- failedTemplate:
errorMessage: businessid must be provided
errorMessage: businessid must be provided
- it: should render an multi-container argo cron workflow
values:
- ./values/cronjob/argo_multi_container.yaml
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.workflowSpec.templates[1].metadata.labels.businessid
value: "some-business-id"
102 changes: 102 additions & 0 deletions cronjob/tests/values/cronjob/argo_multi_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: simple-cron-workflow
schedule: 1 * * * *
kind: CronWorkflow
businessid: "some-business-id"
startingDeadlineSeconds: {}
job:
retries: 1
timeout: 1800
retryPolicy: OnFailure
ttlStrategy:
secondsAfterCompletion: 600
podGC:
strategy: OnPodCompletion
annotations: {}
image:
repository: test/testImage
tag: latest
command:
- bundle
- exec
- rails
- test
args:
- abc
resources:
requests:
cpu: 300m
memory: 2Gi
exitNotifications:
slackApp:
portalDomain: https://argo.com
webhookUrl: https://webhook/service/test
mention:
onFailure:
- U0123ABC123
- S0345DEF345
onSuccess:
- U0123ABC123
- S0345DEF345
newRelic:
image:
repository: test/test-newrelic-agent
tag: latest
licenseKey: 12345testtest1234test
appName: Test App
healthcheckIo:
uuid: arf21-323s-232d-23dasd
env:
RAILS_ENV: staging
envSecrets:
MONGODB_USER: mongodb
envFrom:
configMapRef:
- test-1-env
- test-2-env
secretRef:
- test-1-secret
- test-2-secret
serviceaccount:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/my-service-account
name: my-service-account
pdb:
enable: true
minAvailable: 9999
securityContextForPod:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
nodeSelector:
nodegroup: ec-eks-db-cpu-node-autoscaling-group
tolerations:
- key: shop-callback-node
operator: Equal
value: "true"
effect: NoSchedule
dnsConfig:
options:
- name: ndots
value: "5"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/instance-type
operator: In
values:
- m6i.2xlarge
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
a: 1
topologyKey: topology.kubernetes.io/zone
containers:
- name: multi-step-test-container
image:
repository: test/testImage
tag: latest
args:
- echo "Hello, World!"
Loading