diff --git a/tks-cluster/create-usercluster-wftpl.yaml b/tks-cluster/create-usercluster-wftpl.yaml index b3c612ea..1e606f5b 100644 --- a/tks-cluster/create-usercluster-wftpl.yaml +++ b/tks-cluster/create-usercluster-wftpl.yaml @@ -114,16 +114,6 @@ spec: ] when: "{{steps.tks-create-cluster-repo.outputs.parameters.infra_provider}} == byoh" - - - name: tks-create-config-secret - template: create-endpoint-secret - arguments: - parameters: - - name: cluster_info - value: "{{steps.tks-get-cluster-info.outputs.parameters.cluster_info}}" - - name: cluster_id - value: "{{ workflow.parameters.cluster_id }}" - when: "{{steps.tks-create-cluster-repo.outputs.parameters.infra_provider}} == byoh" - - - name: init-cluster-for-tks template: init-cluster-for-tks arguments: @@ -222,6 +212,10 @@ spec: ] when: "{{steps.tks-create-cluster-repo.outputs.parameters.managed_cluster}} == false" + - - name: suspend + template: suspend + when: "{{steps.tks-create-cluster-repo.outputs.parameters.infra_provider}} == byoh" + - - name: install-cluster-autoscaler templateRef: name: create-application @@ -403,6 +397,9 @@ spec: ####################### # Template Definition # ####################### + - name: suspend + suspend: {} + - name: init-cluster-for-tks inputs: parameters: @@ -651,20 +648,19 @@ spec: kubectl --kubeconfig kubeconfig config delete-context "$ADMIN_CONTEXT" kubectl --kubeconfig kubeconfig config delete-user "$ADMIN_USER" - } + CURRENT_CONTEXT=$(kubectl --kubeconfig kubeconfig config current-context) case $INFRA_PROVIDER in aws) # check whether admin cluster is managed or not - kcp_count=$(kubectl get kcp -n $CLUSTER_ID $CLUSTER_ID | grep -v NAME | wc -l) - awsmcp_count=$(kubectl get awsmcp -n $CLUSTER_ID $CLUSTER_ID | grep -v NAME | wc -l) + kcp_count=$(kubectl get kcp -n default $CLUSTER | grep -v NAME | wc -l) + awsmcp_count=$(kubectl get awsmcp -n default $CLUSTER | grep -v NAME | wc -l) if [ $kcp_count = 1 ]; then # Self-managed control plane cluster - create_cluster_autoscaler_kubeconfig "$CLUSTER-admin@$CLUSTER" "$CLUSTER-admin" + create_cluster_autoscaler_kubeconfig "$CURRENT_CONTEXT" "$CLUSTER-admin" elif [ $awsmcp_count = 1 ]; then # EKS cluster - CURRENT_CONTEXT=$(kubectl --kubeconfig kubeconfig config current-context) - create_cluster_autoscaler_kubeconfig "$CURRENT_CONTEXT" "$CURRENT_CONTEXT" + create_cluster_autoscaler_kubeconfig "$CURRENT_CONTEXT" "$CLUSTER-user" else echo "Wrong AWS Cluster type!" exit 1 @@ -707,45 +703,3 @@ spec: kubectl --kubeconfig kubeconfig_temp apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml -n kube-system kubectl --kubeconfig kubeconfig_temp apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml -n kube-system - - name: create-endpoint-secret - inputs: - parameters: - - name: cluster_info - - name: cluster_id - container: - name: create-namespace - image: harbor.taco-cat.xyz/tks/hyperkube:v1.18.6 - command: - - /bin/bash - - '-c' - - | - CLUSTER_ID={{inputs.parameters.cluster_id}} - CLUSTER_IP=$(echo $CLUSTER_INFO | jq -r '.byoClusterEndpointHost') - - if [ "$CLUSTER_IP" = "" ]; then - echo "ERROR::Endpoint for the cluster is not given!!!" - exit -1 - fi - - cat < tks-endpoint-secret.yaml - --- - apiVersion: v1 - kind: Secret - metadata: - name: tks-endpoint-secret - namespace: ${CLUSTER_ID} - data: - grafana: $(echo ${CLUSTER_IP}:30001 | base64) # 30001 - loki: $(echo ${CLUSTER_IP}:30002 | base64) # 30002 - minio: $(echo ${CLUSTER_IP}:30003 | base64) # 30003 - prometheus: $(echo ${CLUSTER_IP}:30004 | base64) # 30004 - thanos: $(echo ${CLUSTER_IP}:30005 | base64) # 30005 (queryfrontend만 합시다...) - kiali: $(echo ${CLUSTER_IP}:30011 | base64) # 30011 - jaeger: $(echo ${CLUSTER_IP}:30012 | base64) # 30012 - EOF - kubectl apply -f tks-endpoint-secret.yaml - env: - - name: CLUSTER_INFO - value: "{{inputs.parameters.cluster_info}}" - - activeDeadlineSeconds: 30