Skip to content

spike: implement workflowtemplate #1553

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions chart/infra-server/argo-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ argo-workflows:
server:
authModes:
- server
# We do this separately, because they cannot be installed from the dependant chart.
crds:
install: false

controller:
# Default values that will apply to all Workflows from this controller, unless overridden on the Workflow-level
Expand Down
9 changes: 8 additions & 1 deletion chart/infra-server/static/flavors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
name: OpenShift 4.x Perf&Scale
description: OpenShift 4.x Perf&Scale
availability: stable
workflow: configuration/workflow-openshift-4-perf-scale.yaml
workflow: configuration/workflow-openshift-4.yaml
aliases:
- ocp-4-perf-scale
parameters:
Expand Down Expand Up @@ -579,6 +579,13 @@
Consult OCP documentation for details. {{ .Chart.Annotations.ocpCredentialsMode }} is the value used by
stackrox CI.

- name: keep-failed-cluster
description: Keep failed cluster
value: false
kind: optional
help: |
*Only for debugging infra issues.* If in doubt, please keep to false.

- name: ssd-storage-class
description: Ensure an SSD StorageClass is the default StorageClass for the cluster
value: false
Expand Down
53 changes: 21 additions & 32 deletions chart/infra-server/static/test-simulate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,46 @@ metadata:
generateName: simulate-
spec:
entrypoint: start
onExit: stop
arguments:
parameters:
- name: name
- name: create-delay-seconds
value: ""
- name: create-outcome
value: ""
- name: destroy-delay-seconds
value: ""
- name: destroy-outcome
value: ""

templates:
- name: start
steps:
- - name: create
template: simulate
dag:
tasks:
- name: create
templateRef:
name: test-simulate
template: simulate
arguments:
parameters:
- name: delay-seconds
value: '{{ "{{" }}workflow.parameters.create-delay-seconds{{ "}}" }}'
- name: outcome
value: '{{ "{{" }}workflow.parameters.create-outcome{{ "}}" }}'
- - name: wait
template: wait
- - name: destroy
template: simulate

- name: wait
dependencies: [create]
templateRef:
name: common
template: wait

- name: stop
dag:
tasks:
- name: destroy
templateRef:
name: test-simulate
template: simulate
arguments:
parameters:
- name: delay-seconds
value: '{{ "{{" }}workflow.parameters.destroy-delay-seconds{{ "}}" }}'
- name: outcome
value: '{{ "{{" }}workflow.parameters.destroy-outcome{{ "}}" }}'

- name: simulate
inputs:
parameters:
- name: delay-seconds
- name: outcome
script:
image: debian:9.4
command: [bash]
source: |
set -x
start=0
while sleep 1; do
if [[ $((start++)) -ge {{ "{{" }}inputs.parameters.delay-seconds{{ "}}" }} ]]; then
break
fi
done
[[ "{{ "{{" }}inputs.parameters.outcome{{ "}}" }}" == "success" ]] || exit 1

- name: wait
suspend: {}
181 changes: 0 additions & 181 deletions chart/infra-server/static/workflow-openshift-4-perf-scale.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion chart/infra-server/static/workflow-openshift-4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- name: fips-enabled
- name: trusted-certs-enabled
- name: credentials-mode
- name: keep-failed-cluster
- name: keep-failed-cluster # this not present in openshift-4-perf-scale
- name: ssd-storage-class
volumeClaimTemplates:
- metadata:
Expand Down
3 changes: 0 additions & 3 deletions chart/infra-server/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ data:
workflow-openshift-4-demo.yaml: |-
{{- tpl (.Files.Get "static/workflow-openshift-4-demo.yaml" ) . | b64enc | nindent 4 }}

workflow-openshift-4-perf-scale.yaml: |-
{{- tpl (.Files.Get "static/workflow-openshift-4-perf-scale.yaml" ) . | b64enc | nindent 4 }}

workflow-eks.yaml: |-
{{- tpl (.Files.Get "static/workflow-eks.yaml" ) . | b64enc | nindent 4 }}

Expand Down
10 changes: 10 additions & 0 deletions chart/infra-server/templates/workflowtemplates/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: common
namespace: default
spec:
templates:
- name: wait
suspend: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: test-simulate
namespace: default
spec:
templates:
- name: simulate
inputs:
parameters:
- name: delay-seconds
- name: outcome
script:
image: debian:9.4
command: [bash]
source: |
set -x
start=0
while sleep 1; do
if [[ $((start++)) -ge {{ "{{" }}inputs.parameters.delay-seconds{{ "}}" }} ]]; then
break
fi
done
[[ "{{ "{{" }}inputs.parameters.outcome{{ "}}" }}" == "success" ]] || exit 1
7 changes: 7 additions & 0 deletions scripts/deploy/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TEST_MODE="${TEST_MODE:-false}"
SECRETS_PROJECT="acs-team-automation"
RELEASE_NAMESPACE="infra"
RELEASE_NAME="infra-server"
ARGO_WORKFLOWS_APP_VERSION="v3.6.5"

check_not_empty() {
for V in "$@"; do
Expand All @@ -25,6 +26,11 @@ check_not_empty() {
done
}

install_crds() {
kubectl apply --kustomize \
"https://github.com/argoproj/argo-workflows/manifests/base/crds/minimal?ref=${ARGO_WORKFLOWS_APP_VERSION}"
}

template() {
# Need to use helm upgrade --dry-run to have .Capabilities context available
helm upgrade \
Expand Down Expand Up @@ -102,4 +108,5 @@ diff() {
}

check_not_empty TASK TAG ENVIRONMENT
install_crds
eval "$TASK"
Loading