From 50b808f19cf96431f20b4d5a0dafe8b1a364b24e Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Fri, 20 May 2022 16:44:09 +0900 Subject: [PATCH 1/4] add validate-usercluster WFT --- tks-cluster/create-usercluster-wftpl.yaml | 3 -- tks-cluster/validate-usercluster-wftpl.yaml | 39 +++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 tks-cluster/validate-usercluster-wftpl.yaml diff --git a/tks-cluster/create-usercluster-wftpl.yaml b/tks-cluster/create-usercluster-wftpl.yaml index 2125ee24..bd952589 100644 --- a/tks-cluster/create-usercluster-wftpl.yaml +++ b/tks-cluster/create-usercluster-wftpl.yaml @@ -17,9 +17,6 @@ spec: value: "template-std" - name: git_account value: "tks-management" - # TODO: if gittoken is necessary, the following options might be tried. - # 1. Pass gittoken name (or use predefined name) and createApp reconstructs this repo URL. - # 2. Make argocd pod always use the common gittoken. - name: manifest_repo_url value: "" - name: revision diff --git a/tks-cluster/validate-usercluster-wftpl.yaml b/tks-cluster/validate-usercluster-wftpl.yaml new file mode 100644 index 00000000..5c85a972 --- /dev/null +++ b/tks-cluster/validate-usercluster-wftpl.yaml @@ -0,0 +1,39 @@ +apiVersion: argoproj.io/v1alpha1 +kind: WorkflowTemplate +metadata: + name: tks-validate-usercluster + namespace: argo +spec: + entrypoint: run-sonobuoy + arguments: + parameters: + - name: cluster_id + value: "011b88fa-4d53-439f-9336-67845f994051" + - name: sonobuoy_mode + value: "quick" + templates: + - name: run-sonobuoy + container: + name: sonobuoy + image: 'sonobuoy/sonobuoy' + command: + - /bin/bash + - '-exc' + - | + KUBECONFIG=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) + echo -e "kubeconfig:\n$KUBECONFIG" | head -n 5 + export KUBECONFIG + + sonobuoy run --mode {{workflow.parameters.sonobuoy_mode}} --e2e-parallel 30 --wait + sonobuoy retrieve && mkdir ./results + tar xzf ./*.tar.gz -C ./results + cat ./results/plugins/e2e/results/global/e2e.log + + status=$(sonobuoy status) + + if grep -q "failed" <<< "$status"; then + echo "Sonobuoy e2e test failed!" + exit 1 + fi + + sonobuoy delete --all --wait From 6ca38114053a99f247554abae0f0c35971c74efc Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Fri, 20 May 2022 19:59:03 +0900 Subject: [PATCH 2/4] use custom sonobuoy image --- tks-cluster/validate-usercluster-wftpl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tks-cluster/validate-usercluster-wftpl.yaml b/tks-cluster/validate-usercluster-wftpl.yaml index 5c85a972..44264f64 100644 --- a/tks-cluster/validate-usercluster-wftpl.yaml +++ b/tks-cluster/validate-usercluster-wftpl.yaml @@ -15,7 +15,7 @@ spec: - name: run-sonobuoy container: name: sonobuoy - image: 'sonobuoy/sonobuoy' + image: 'sktcloud/sonobuoy-worker' command: - /bin/bash - '-exc' From 683ae8c454ecdebda5233b13043bd03f6c9cd9b6 Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Fri, 20 May 2022 20:21:03 +0900 Subject: [PATCH 3/4] fix KUBECONFIG env var --- tks-cluster/validate-usercluster-wftpl.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tks-cluster/validate-usercluster-wftpl.yaml b/tks-cluster/validate-usercluster-wftpl.yaml index 44264f64..f2b68f35 100644 --- a/tks-cluster/validate-usercluster-wftpl.yaml +++ b/tks-cluster/validate-usercluster-wftpl.yaml @@ -20,9 +20,9 @@ spec: - /bin/bash - '-exc' - | - KUBECONFIG=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) - echo -e "kubeconfig:\n$KUBECONFIG" | head -n 5 - export KUBECONFIG + KUBECONFIG_=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) + cat <<< "$KUBECONFIG_" > /etc/kubeconfig_temp + export KUBECONFIG='/etc/kubeconfig_temp' sonobuoy run --mode {{workflow.parameters.sonobuoy_mode}} --e2e-parallel 30 --wait sonobuoy retrieve && mkdir ./results From 71b5546eee0063b8aecd560601fb70092f3a704e Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Mon, 23 May 2022 09:48:47 +0900 Subject: [PATCH 4/4] remove 'x' permission from workflow files --- tks-cluster/create-aws-conf-secret.yaml | 0 tks-cluster/manage-internal-communication.yaml | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tks-cluster/create-aws-conf-secret.yaml mode change 100755 => 100644 tks-cluster/manage-internal-communication.yaml diff --git a/tks-cluster/create-aws-conf-secret.yaml b/tks-cluster/create-aws-conf-secret.yaml old mode 100755 new mode 100644 diff --git a/tks-cluster/manage-internal-communication.yaml b/tks-cluster/manage-internal-communication.yaml old mode 100755 new mode 100644