Skip to content

Commit

Permalink
update workflow in consistent manner
Browse files Browse the repository at this point in the history
- sync variable names with other workflows
- use 'steps' instead of 'dags' when there are only sequential tasks
  • Loading branch information
robertchoi80 committed Sep 28, 2021
1 parent 9e594d7 commit 71437e2
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 44 deletions.
7 changes: 3 additions & 4 deletions deploy_apps/tks-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ spec:
parameters:
- name: site_name
value: "hanu-reference"
# TODO: This should be renamed to app_group_name
- name: app_name
- name: app_group
value: "lma"
# Replace these urls properly for your env #
- name: site_repo_url
Expand Down Expand Up @@ -79,7 +78,7 @@ spec:
- name: cluster_name
value: "{{item.name}}"
- name: app_group
value: "{{workflow.parameters.app_name}}"
value: "{{workflow.parameters.app_group}}"
- name: chart
value: "thanos"
- name: kv_map_str
Expand All @@ -99,7 +98,7 @@ spec:
- name: cluster_name
value: "{{steps.collectThanosScEndpoints.outputs.parameters.cur_cluster_name}}"
- name: app_group
value: "{{workflow.parameters.app_name}}"
value: "{{workflow.parameters.app_group}}"
- name: chart
value: "thanos"
- name: kv_map_str
Expand Down
6 changes: 3 additions & 3 deletions deploy_apps/tks-remove-servicemesh-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
template: delete-argocd-app
arguments:
parameters:
- name: app_name
- name: app_group
value: service-mesh
- name: site_name
value: "{{workflow.parameters.site_name}}"
Expand Down Expand Up @@ -71,7 +71,7 @@ spec:
- name: delete-argocd-app
inputs:
parameters:
- name: app_name
- name: app_group
- name: site_name
container:
name: delete-argocd-app
Expand All @@ -98,7 +98,7 @@ spec:
name: decapod-argocd-config
env:
- name: APP_NAME
value: "{{inputs.parameters.app_name}}"
value: "{{inputs.parameters.app_group}}"
- name: SITE_NAME
value: '{{inputs.parameters.site_name}}'
activeDeadlineSeconds: 900
Expand Down
2 changes: 1 addition & 1 deletion deploy_apps/tks-service-mesh-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
parameters:
- name: site_name
value: hanu-reference
- name: app_name
- name: app_group
value: service-mesh
- name: manifest_repo_url
value: 'https://github.com/openinfradev/decapod-manifests'
Expand Down
3 changes: 1 addition & 2 deletions sealed_secrets/deploy-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ spec:

kubectl apply -f $repo_name/{{input.parameters.secret_path}}

## Check if workflow fails if this cmd fails. Otherwise, should add exit cmd ##
#kubectl get secret -n kube-system -l sealedsecrets.bitnami.com/sealed-secrets-key | grep sealed-secrets-key
# TODO: need to add logic to check if the secret was successfully created?

envFrom:
- secretRef:
Expand Down
4 changes: 2 additions & 2 deletions sealed_secrets/setup-sealed-secrets-infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- name: site_name
value: "hanu-reference"
# TODO: This should be renamed to app_group_name
- name: app_name
- name: app_group
value: "sealed-secrets"
- name: manifest_repo_url
value: "https://github.com/openinfradev/decapod-manifests"
Expand Down Expand Up @@ -42,7 +42,7 @@ spec:
- - name: installControllers
templateRef:
name: tks-create-application
template: AppGroupOnAdmin
template: installAppsOnAdmin
arguments:
parameters:
- name: list
Expand Down
31 changes: 13 additions & 18 deletions tks-cluster/create-usercluster-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,45 @@ spec:
value: main
- name: tks_admin
value: "tks-admin"
- name: app_name
- name: app_group
value: "tks-cluster"

templates:
- name: deploy
dag:
tasks:
- name: tks-create-cluster-site
steps:
- - name: tks-create-cluster-site
template: new-cluster-site
dependencies: []

- name: k8s-by-capi
- - name: k8s-by-capi
templateRef:
name: tks-create-application
template: AppGroupOnAdmin
template: installAppsOnAdmin
arguments:
parameters:
- name: list
value: |
[
{ "path": "cluster-api-aws", "namespace": "argo" }
]
dependencies: [tks-create-cluster-site]
- name: wait-for-clster-is-registered
template: wait-template
dependencies: [k8s-by-capi]
- - name: wait-for-clster-to-be-registered
template: wait-for-cluster-registration

- name: ready-for-cni-and-csi
# TODO: What does this name mean? Wait for CNI?
- - name: ready-for-cni-and-csi
templateRef:
name: tks-create-application
template: AppGroup
template: installApps
arguments:
parameters:
- name: list
value: |
[
{ "path": "ingress-nginx", "namespace": "taco-system" },
{ "path": "kubed", "namespace": "taco-system" },
{ "path": "kubernetes-addons", "namespace": "taco-system" }
]
dependencies: [k8s-by-capi, wait-for-clster-is-registered ]
- name: wait-template
- name: wait-for-cluster-registration
activeDeadlineSeconds: 1800
container:
image: ghcr.io/openinfradev/argocd-cli:v2.0.1
Expand All @@ -71,7 +66,7 @@ spec:
yes | ./argocd login --insecure $ARGO_SERVER --username $ARGO_USERNAME --password $ARGO_PASSWORD
while [ $(./argocd cluster list | grep \ $target\ | wc -l ) == 0 ]; do
echo "> Wait for cluster is registered"
echo "> Wait for cluster to be registered"
sleep 30
done
envFrom:
Expand Down Expand Up @@ -121,4 +116,4 @@ spec:
- name: git_account
value: "{{workflow.parameters.git_account}}"
- name: revision
value: "{{workflow.parameters.revision}}"
value: "{{workflow.parameters.revision}}"
30 changes: 16 additions & 14 deletions tks-cluster/tks-createapp-wftp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ spec:
parameters:
- name: cluster_id
value: "hanu-deploy-apps"
- name: app_name
- name: app_group
value: "lma"
- name: repository_url
- name: manifest_repo_url
value: "https://github.com/openinfradev/decapod-manifests"
- name: revision
value: main
value: "main"
templates:
- name: createApp
inputs:
Expand All @@ -32,21 +32,23 @@ spec:
#NAMESPACE=$SITE_NAME
CD_APP=${SITE_NAME:0:8}-$PATH
echo "argo-cd application name: $CD_APP"
# log into Argo CD server
./argocd login $ARGO_SERVER --plaintext --insecure --username $ARGO_USERNAME \
--password $ARGO_PASSWORD
# check if app already exists.
REPO=https://$(echo $gittoken|xargs)@github.com/$git_account/${contract_id}-manifests.git
# check if app already exists.
./argocd app get $CD_APP
if [[ $? -ne 0 ]]; then
echo "$CD_APP application is not in server"
# create new application if not exists.
echo ./argocd app create $CD_APP --repo $REPO --revision $REVISION --path $SITE_NAME/$TACO_APP/$PATH --dest-namespace $NAMESPACE --dest-name $TARGET_CLUSTER --project $TACO_APP --label app=$TACO_APP --directory-recurse
echo ./argocd app create $CD_APP --repo $REPO --revision $REVISION --path $SITE_NAME/$APP_GROUP/$PATH --dest-namespace $NAMESPACE --dest-name $TARGET_CLUSTER --project $APP_GROUP --label app=$APP_GROUP --directory-recurse
./argocd app create $CD_APP --repo $REPO --revision $REVISION \
--path $SITE_NAME/$TACO_APP/$PATH \
--path $SITE_NAME/$APP_GROUP/$PATH \
--dest-namespace $NAMESPACE --dest-name $TARGET_CLUSTER \
--project $TACO_APP --label app=$TACO_APP --directory-recurse
--project $APP_GROUP --label app=$APP_GROUP --directory-recurse
if [[ $? -ne 0 ]]; then
exit $?
Expand All @@ -68,8 +70,8 @@ spec:
value: "{{workflow.parameters.cluster_id}}"
- name: TARGET_CLUSTER
value: "{{inputs.parameters.target_cluster}}"
- name: TACO_APP
value: "{{workflow.parameters.app_name}}"
- name: APP_GROUP
value: "{{workflow.parameters.app_group}}"
- name: NAMESPACE
value: "{{inputs.parameters.namespace}}"
- name: REVISION
Expand All @@ -82,12 +84,12 @@ spec:
value: "{{workflow.parameters.git_account}}"


- name: AppGroup
- name: installApps
inputs:
parameters:
- name: list
steps:
- - name: "InstallAppGroup"
- - name: "InstallApps"
template: createApp
arguments:
parameters:
Expand All @@ -96,16 +98,16 @@ spec:
- {name: target_cluster, value: "{{workflow.parameters.cluster_id}}"}
withParam: "{{inputs.parameters.list}}"

- name: AppGroupOnAdmin
- name: installAppsOnAdmin
inputs:
parameters:
- name: list
steps:
- - name: "InstallAppGroup"
- - name: "InstallAppsOnAdmin"
template: createApp
arguments:
parameters:
- {name: path, value: "{{item.path}}"}
- {name: namespace, value: "{{item.namespace}}"}
- {name: target_cluster, value: "{{workflow.parameters.tks_admin}}"}
withParam: "{{inputs.parameters.list}}"
withParam: "{{inputs.parameters.list}}"

0 comments on commit 71437e2

Please sign in to comment.