Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
wf-final*.yaml
*.swp
34 changes: 34 additions & 0 deletions argo-workflows/values.archives.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
argo-workflows:
controller:
workflowDefaults:
spec:
ttlStrategy:
secondsAfterCompletion: 84600 # 1 day
persistence:
archive: true
postgresql:
host: postgres.postgres.svc.cluster.local
port: 5432
database: workflow
tableName: argo_workflows
userNameSecret:
name: argo-postgres-config
key: username
passwordSecret:
name: argo-postgres-config
key: password
ssl: false
sslmode: disable
useDefaultArtifactRepo: true
artifactRepository:
archiveLogs: true
s3:
bucket: workflows
endpoint: minio.minio.svc.cluster.local:9000
insecure: true
accessKeySecret:
name: minio-creds
key: accesskey
secretKeySecret:
name: minio-creds
key: secretkey
29 changes: 0 additions & 29 deletions argo-workflows/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,9 @@ argo-workflows:
workflowDefaults:
spec:
serviceAccountName: argo-workflow
ttlStrategy:
secondsAfterCompletion: 84600 # 1 day
workflowNamespaces:
- argo
- default
persistence:
archive: true
postgresql:
host: postgres.postgres.svc.cluster.local
port: 5432
database: workflow
tableName: argo_workflows
userNameSecret:
name: argo-postgres-config
key: username
passwordSecret:
name: argo-postgres-config
key: password
ssl: false
sslmode: disable
executor:
image: {}
# registry: our-harbor-cache/quay.io
Expand Down Expand Up @@ -79,18 +62,6 @@ argo-workflows:
# rbac:
# enabled: true
useDefaultArtifactRepo: true
artifactRepository:
archiveLogs: true
s3:
bucket: workflows
endpoint: minio.minio.svc.cluster.local:9000
insecure: true
accessKeySecret:
name: minio-creds
key: accesskey
secretKeySecret:
name: minio-creds
key: secretkey
workflow:
serviceAccount:
create: true
Expand Down
3 changes: 3 additions & 0 deletions down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -xeu

k3d cluster delete workflow-archiving
10 changes: 10 additions & 0 deletions run-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -xeu

export BATCH_MODE=1
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

"${SCRIPTPATH}/up-no-archives.sh"
"${SCRIPTPATH}/up-with-archives.sh"
"${SCRIPTPATH}/up-archives-after-workflow.sh"

diff -y wf-final-archive.yaml wf-final-archive-after-workflow.yaml
57 changes: 57 additions & 0 deletions up-archives-after-workflow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash -xeu

# Create cluster, install deps
k3d cluster create --config k3d.conf
kubectl get pods -Aw &
kubectl create namespace minio && kubectl -n minio apply -f minio
kubectl create namespace postgres && kubectl -n postgres apply -f postgres
kubectl create namespace argo
kubectl apply -n argo -f workflows-additions

# Install Argo w/out archive
cd argo-workflows
helm dependency update
helm template -n argo argo-workflows -f values.yaml . > todeploy.yaml
kubectl apply -n argo -f todeploy.yaml
kubectl get workflows -Aw &
kubectl -n argo rollout status deployment/argo-workflows-workflow-controller
kubectl -n argo rollout status deployment/argo-workflows-server
cd ..

# Create and wait for workflow to finish
wf_name=$(kubectl -n argo create -f hello-world/hello-world.yaml -o name | awk -F '/' '{ print $2 }')
argo -n argo wait "${wf_name}"

# Add archive to Argo, wait for update
cd argo-workflows
helm dependency update
helm template -n argo argo-workflows -f values.yaml -f values.archives.yaml . > todeploy.yaml
kubectl apply -n argo -f todeploy.yaml
kubectl -n argo rollout restart deployment/argo-workflows-workflow-controller
kubectl -n argo rollout restart deployment/argo-workflows-server
kubectl -n argo rollout status deployment/argo-workflows-server
kubectl -n argo rollout status deployment/argo-workflows-workflow-controller
cd ..
sleep 3
kubectl -n argo port-forward svc/argo-workflows-server 2746:2746 &
sleep 3

# Delete workflow, check archive
kubectl -n argo get workflow "${wf_name}" -o yaml | tee /dev/stderr > wf-final-archive-after-workflow.yaml
kubectl -n argo delete workflow "${wf_name}"
if ! ARGO_SERVER=localhost:2746 ARGO_TOKEN='BEARER foo' ARGO_INSECURE_SKIP_VERIFY=true argo -n argo archive get "${wf_name}"; then
echo 'Workflow was not archived!'
fi

# Debugging
if [ -z "${BATCH_MODE:-}" ]; then
if which xdg-open; then
xdg-open https://localhost:2746/archived-workflows
elif which open; then
open https://localhost:2746/archived-workflows
fi
read -p "Paused, press enter to clean up cluster"
fi

# Cleanup
k3d cluster delete workflow-archiving
42 changes: 42 additions & 0 deletions up-no-archives.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash -xeu

# Create cluster, install deps
k3d cluster create --config k3d.conf
kubectl get pods -Aw &
kubectl create namespace argo
kubectl apply -n argo -f workflows-additions

# Install Argo w/out archive
cd argo-workflows
helm dependency update
helm template -n argo argo-workflows -f values.yaml . > todeploy.yaml
kubectl apply -n argo -f todeploy.yaml
kubectl get workflows -Aw &
kubectl -n argo rollout status deployment/argo-workflows-workflow-controller
kubectl -n argo rollout status deployment/argo-workflows-server
cd ..
kubectl -n argo port-forward --address 0.0.0.0 svc/argo-workflows-server 2746:2746 &

# Create and wait for workflow to finish
wf_name=$(kubectl -n argo create -f hello-world/hello-world.yaml -o name | awk -F '/' '{ print $2 }')
argo -n argo wait "${wf_name}"

# Delete workflow, check archive
kubectl -n argo get workflow "${wf_name}" -o yaml | tee /dev/stderr > wf-final-no-archive.yaml
kubectl -n argo delete workflow "${wf_name}"
if ! ARGO_SERVER=localhost:2746 ARGO_TOKEN='BEARER foo' ARGO_INSECURE_SKIP_VERIFY=true argo -n argo archive get "${wf_name}"; then
echo 'Workflow was not archived!'
fi

# Debugging
if [ -z "${BATCH_MODE:-}" ]; then
if which xdg-open; then
xdg-open https://localhost:2746
elif which open; then
open https://localhost:2746
fi
read -p "Paused, press enter to clean up cluster"
fi

# Cleanup
k3d cluster delete workflow-archiving
44 changes: 44 additions & 0 deletions up-with-archives.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash -xeu

# Create cluster, install deps
k3d cluster create --config k3d.conf
kubectl get pods -Aw &
kubectl create namespace minio && kubectl -n minio apply -f minio
kubectl create namespace postgres && kubectl -n postgres apply -f postgres
kubectl create namespace argo
kubectl apply -n argo -f workflows-additions

# Install Argo w/out archive
cd argo-workflows
helm dependency update
helm template -n argo argo-workflows -f values.yaml -f values.archives.yaml . > todeploy.yaml
kubectl apply -n argo -f todeploy.yaml
kubectl get workflows -Aw &
kubectl -n argo rollout status deployment/argo-workflows-workflow-controller
kubectl -n argo rollout status deployment/argo-workflows-server
cd ..
kubectl -n argo port-forward svc/argo-workflows-server 2746:2746 &

# Create and wait for workflow to finish
wf_name=$(kubectl -n argo create -f hello-world/hello-world.yaml -o name | awk -F '/' '{ print $2 }')
argo -n argo wait "${wf_name}"

# Delete workflow, check archive
kubectl -n argo get workflow "${wf_name}" -o yaml | tee /dev/stderr > wf-final-archive.yaml
kubectl -n argo delete workflow "${wf_name}"
if ! ARGO_SERVER=localhost:2746 ARGO_TOKEN='BEARER foo' ARGO_INSECURE_SKIP_VERIFY=true argo -n argo archive get "${wf_name}"; then
echo 'Workflow was not archived!'
fi

# Debugging
if [ -z "${BATCH_MODE:-}" ]; then
if which xdg-open; then
xdg-open https://localhost:2746
elif which open; then
open https://localhost:2746
fi
read -p "Paused, press enter to clean up cluster"
fi

# Cleanup
k3d cluster delete workflow-archiving