From 37691d880d294270e3c1309fee8f72c0eacae51d Mon Sep 17 00:00:00 2001 From: Seungkyu Ahn Date: Thu, 30 Sep 2021 20:14:17 +0900 Subject: [PATCH] Add deploying ingress for temporary --- deploy_apps/tks-service-mesh-wftpl.yaml | 89 ++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/deploy_apps/tks-service-mesh-wftpl.yaml b/deploy_apps/tks-service-mesh-wftpl.yaml index 780c7d53..92f50182 100644 --- a/deploy_apps/tks-service-mesh-wftpl.yaml +++ b/deploy_apps/tks-service-mesh-wftpl.yaml @@ -121,6 +121,16 @@ spec: value: "{{workflow.parameters.site_name}}" dependencies: - grafana-prometheus-resource + - name: deploy-ingress-temporary + template: deploy-ingress-temporary + arguments: + parameters: + - name: site_name + value: "{{workflow.parameters.site_name}}" + - name: kubeconfig_secret_name + value: "{{workflow.parameters.site_name}}-kubeconfig" + dependencies: + - sync-app - name: copy-eck-secret arguments: {} inputs: @@ -150,7 +160,7 @@ spec: kubectl --kubeconfig=/etc/kubeconfig get ns ${TARGET_NAMESPACE} if [[ $? =~ 1 ]]; then kubectl --kubeconfig=/etc/kubeconfig create ns ${TARGET_NAMESPACE} - kubectl --kubeconfig=/etc/kubeconfig label ns ${TARGET_NAMESPACE} name=${TARGET_NAMESPACE} + kubectl --kubeconfig=/etc/kubeconfig label ns ${TARGET_NAMESPACE} name=${SOURCE_NAMESPACE} kubectl --kubeconfig=/etc/kubeconfig label ns ${TARGET_NAMESPACE} taco-tls=enabled log "INFO" "${TARGET_NAMESPACE} successfully created." fi @@ -208,3 +218,80 @@ spec: activeDeadlineSeconds: 900 retryStrategy: limit: 2 + - name: deploy-ingress-temporary + inputs: + parameters: + - name: site_name + - name: kubeconfig_secret_name + container: + name: deploy-ingress-temporary + image: 'k8s.gcr.io/hyperkube:v1.18.6' + command: + - /bin/bash + - '-c' + - | + function log() { + level=$1 + msg=$2 + date=$(date '+%F %H:%M:%S') + echo "[$date] $level $msg" + } + + function deploy_ingress() { + ingress_name=$1 + namespace=$2 + host_name=$3 + service_name=$4 + service_port=$5 + + kubectl --kubeconfig=/etc/kubeconfig get ing $ingress_name -n $namespace + if [[ $? =~ 1 ]]; then + cat < /etc/kubeconfig + + deploy_ingress "grafana" "lma" $GRAFANA_HOST "grafana" "80" + deploy_ingress "kibana" "lma" $KIBANA_HOST "eck-kibana-kb-http" "5601" + deploy_ingress "kiali" "istio-system" $KIALI_HOST "kiali" "20001" + env: + - name: SITE_NAME + value: '{{inputs.parameters.site_name}}' + - name: KUBE_CONFIG + valueFrom: + secretKeyRef: + name: "{{ inputs.parameters.kubeconfig_secret_name }}" + key: value + activeDeadlineSeconds: 900 + retryStrategy: + limit: 2