diff --git a/dockerfiles/Dockerfile.e2e-test b/dockerfiles/Dockerfile.e2e-test index b0466739..703f349a 100644 --- a/dockerfiles/Dockerfile.e2e-test +++ b/dockerfiles/Dockerfile.e2e-test @@ -15,5 +15,7 @@ COPY tks /usr/local/bin/tks RUN curl -Lo /usr/bin/kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" RUN chmod +x /usr/bin/kubectl +RUN yum install -y epel-release +RUN yum install -y jq CMD ["bash"] diff --git a/git-repo/create-cluster-repo.yaml b/git-repo/create-cluster-repo.yaml index cf183856..cb7c576a 100644 --- a/git-repo/create-cluster-repo.yaml +++ b/git-repo/create-cluster-repo.yaml @@ -76,11 +76,13 @@ spec: aws) ## Fetch cluster params from cluster_info file ## val_ssh_key=$(echo $CLUSTER_INFO | jq -r '.sshKeyName') - val_region=$(echo $CLUSTER_INFO | jq -r '.region') - val_num_of_az=$(echo $CLUSTER_INFO | jq -r '.numOfAz') - val_machine_type=$(echo $CLUSTER_INFO | jq -r '.machineType') - val_min_size=$(echo $CLUSTER_INFO | jq -r '.minSizePerAz') - val_max_size=$(echo $CLUSTER_INFO | jq -r '.maxSizePerAz') + val_region=$(echo $CLUSTER_INFO | jq -r '.clusterRegion') + val_num_of_az=$(echo $CLUSTER_INFO | jq -r '.mdNumOfAz') + val_machine_type=$(echo $CLUSTER_INFO | jq -r '.mdMachineType') + val_min_size=$(echo $CLUSTER_INFO | jq -r '.mdMinSizePerAz') + val_max_size=$(echo $CLUSTER_INFO | jq -r '.mdMaxSizePerAz') + val_mp_replicas=$(echo $CLUSTER_INFO | jq -r '.mpReplicas') + val_mp_machine_type=$(echo $CLUSTER_INFO | jq -r '.mpNodeMachineType') sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml sed -i "s/sshKeyName:\ CHANGEME/sshKeyName: $val_ssh_key/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml @@ -91,6 +93,8 @@ spec: sed -i "s/mdMaxSizePerAz:\ CHANGEME/mdMaxSizePerAz: $val_max_size/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml sed -i "s/mdMachineType:\ CHANGEME/mdMachineType: $val_machine_type/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml sed -i "s/cpReplicas:\ CHANGEME/cpReplicas: 3/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml + sed -i "s/mpReplicas:\ CHANGEME/mpReplicas: $val_mp_replicas/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml + sed -i "s/mpMachineType:\ CHANGEME/mpMachineType: $val_mp_machine_type/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml ## multi-tenancy ## if [ "$CLOUD_ACCOUNT_ID" = "NULL" ]; then diff --git a/tks-cli/tks-cli.yaml b/tks-cli/tks-cli.yaml index 8137a078..80610846 100644 --- a/tks-cli/tks-cli.yaml +++ b/tks-cli/tks-cli.yaml @@ -12,7 +12,7 @@ spec: - name: login-tks-api container: name: login-tks-api - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" @@ -31,7 +31,7 @@ spec: - name: description container: name: create-organization - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" @@ -87,9 +87,10 @@ spec: - name: cloud_account_id - name: creator - name: description + - name: infra_conf container: name: create-usercluster - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" @@ -99,13 +100,22 @@ spec: - | tks login {{workflow.parameters.tks_api_url}} --organization-id ${ORGANIZATION_ID} --account-id ${ACCOUNT_ID} --password ${PASSWORD} + echo "infra_conf : {{inputs.parameters.infra_conf}}" + + CP_NODE_CNT=$(echo "{{inputs.parameters.infra_conf}}" | jq -r '.cpNodeCnt') + TKS_NODE_CNT=$(echo "{{inputs.parameters.infra_conf}}" | jq -r '.tksNodeCnt') + USER_NODE_CNT=$(echo "{{inputs.parameters.infra_conf}}" | jq -r '.userNodeCnt') + CL_NAME="{{inputs.parameters.cluster_name}}" echo "* Create $CL_NAME cluster" tks cluster create ${CL_NAME} \ --stack-template-id "{{inputs.parameters.stack_template_id}}" \ --organization-id "{{inputs.parameters.organization_id}}" \ --cloud-account-id "{{inputs.parameters.cloud_account_id}}" \ - --description "{{inputs.parameters.description}}" + --description "{{inputs.parameters.description}}" \ + --cp-node-cnt $CP_NODE_CNT \ + --tks-node-cnt $TKS_NODE_CNT \ + --user-node-cnt $USER_NODE_CNT threshold=30 for i in $(seq 1 $threshold) @@ -145,7 +155,7 @@ spec: - name: cluster_id container: name: delete-usercluster - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" @@ -188,7 +198,7 @@ spec: - name: description container: name: create-appgroup - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" @@ -238,7 +248,7 @@ spec: - name: appgroup_id container: name: delete-appgroup - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" @@ -278,7 +288,7 @@ spec: - name: name container: name: get-appgroup-id - image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.3 + image: harbor-cicd.taco-cat.xyz/tks/tks-e2e-test:v2.1.5 envFrom: - secretRef: name: "tks-api-secret" diff --git a/tks-stack/tks-stack-create-aws-msa.yaml b/tks-stack/tks-stack-create-aws-msa.yaml index cab68193..f3f1516b 100644 --- a/tks-stack/tks-stack-create-aws-msa.yaml +++ b/tks-stack/tks-stack-create-aws-msa.yaml @@ -21,6 +21,8 @@ spec: value: "aws-msa-reference" - name: creator value: "" + - name: infra_conf + value: "" templates: - name: main @@ -43,6 +45,8 @@ spec: value: "{{workflow.parameters.creator}}" - name: description value: "{{workflow.parameters.description}}" + - name: infra_conf + value: "{{workflow.parameters.infra_conf}}" - - name: call-create-appgroup-for-LMA templateRef: diff --git a/tks_info/get-tks-cluster-wftpl.yaml b/tks_info/get-tks-cluster-wftpl.yaml index 59d443b7..4b78dc07 100644 --- a/tks_info/get-tks-cluster-wftpl.yaml +++ b/tks_info/get-tks-cluster-wftpl.yaml @@ -58,15 +58,15 @@ spec: return resJson['user']['token'] - res = requests.get(TKS_API_URL+"/api/1.0/clusters/" + CLUSTER_ID, headers={"Authorization": "Bearer " + getToken(), "Content-Type" : "application/json"} ) + res = requests.get(TKS_API_URL+"/api/1.0/clusters/" + CLUSTER_ID + "/site-values", headers={"Authorization": "Bearer " + getToken(), "Content-Type" : "application/json"} ) if res.status_code != 200 : sys.exit('Failed to get cluster') print(res.text) - cluster = res.json()['cluster'] + clusterSiteValues = res.json()['clusterSiteValues'] with open("/mnt/out/cluster_info.txt", "w") as f: - #cluster_conf = str(cluster['conf']) - cluster_conf = json.dumps(cluster['conf']) + #cluster_conf = str(clusterSiteValues) + cluster_conf = json.dumps(clusterSiteValues) print(cluster_conf) f.write(cluster_conf)