Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

최소사항 클러스터 지원을 위한 여정 #262 #251

Merged
merged 4 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app_serving/abort-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: strategy
value: "blue-green"
# tks_info service URL
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"

templates:
Expand Down
2 changes: 1 addition & 1 deletion app_serving/delete-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
value: ""
- name: organization_id
value: "ose4j7p39"
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"

templates:
Expand Down
2 changes: 1 addition & 1 deletion app_serving/promote-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: strategy
value: "blue-green"
# tks_info service URL
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"

templates:
Expand Down
2 changes: 1 addition & 1 deletion app_serving/rollback-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: helm_revision
value: ""
# tks_info service URL
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"

templates:
Expand Down
2 changes: 1 addition & 1 deletion app_serving/serve-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
- name: pv_mount_path
value: ""
# tks_info service URL
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"
- name: git_repo_url
value: "github.com/openinfradev"
Expand Down
2 changes: 1 addition & 1 deletion deploy_apps/tks-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
##########################
# For tks-info task #
##########################
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"
- name: cluster_id
value: "coyar0qx1"
Expand Down
10 changes: 5 additions & 5 deletions deploy_apps/tks-primary-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
##########################
# For tks-info task #
##########################
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api-dev.taco-cat.xyz:9110"
- name: organization_id
value: "o086tb3zc"
Expand Down Expand Up @@ -875,7 +875,7 @@ spec:
- name: PYTHONPATH
value: "/opt/protobuf/:/opt/rh/rh-python38/root/lib/python3.8/site-packages/:/opt/app-root/lib/python3.8/site-packages/"
- name: TKS_API_URL
value: "{{workflow.parameters.tks_info_host}}"
value: "{{workflow.parameters.tks_api_url}}"
envFrom:
- secretRef:
name: "tks-api-secret"
Expand All @@ -888,7 +888,7 @@ spec:
import json
import os

TKS_API_URL = "{{workflow.parameters.tks_info_host}}"
TKS_API_URL = "{{workflow.parameters.tks_api_url}}"
ORGANIZATION_ID = "{{workflow.parameters.organization_id}}"
CLUSTER_ID = "{{workflow.parameters.cluster_id}}"

Expand Down Expand Up @@ -957,7 +957,7 @@ spec:
- name: PYTHONPATH
value: "/opt/protobuf/:/opt/rh/rh-python38/root/lib/python3.8/site-packages/:/opt/app-root/lib/python3.8/site-packages/"
- name: TKS_API_URL
value: "{{workflow.parameters.tks_info_host}}"
value: "{{workflow.parameters.tks_api_url}}"
envFrom:
- secretRef:
name: "tks-api-secret"
Expand All @@ -967,7 +967,7 @@ spec:
import json
import os

TKS_API_URL = "{{workflow.parameters.tks_info_host}}"
TKS_API_URL = "{{workflow.parameters.tks_api_url}}"
ORGANIZATION_ID = "{{workflow.parameters.organization_id}}"
CLUSTER_ID = "{{inputs.parameters.cluster_id}}"

Expand Down
6 changes: 3 additions & 3 deletions deploy_apps/tks-remove-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
value: "lma"
- name: github_account
value: "decapod10"
- name: tks_info_host
- name: tks_api_url
value: "http://tks-api.tks.svc:9110"
- name: organization_id
value: "oxgpyp293"
Expand Down Expand Up @@ -169,7 +169,7 @@ spec:
- name: collectClusterList
inputs:
parameters:
- name: tks_info_host
- name: tks_api_url
- name: app_group_id
outputs:
parameters:
Expand Down Expand Up @@ -198,7 +198,7 @@ spec:
import git
import requests

TKS_API_URL = "{{workflow.parameters.tks_info_host}}"
TKS_API_URL = "{{workflow.parameters.tks_api_url}}"
CLUSTER_ID = "{{workflow.parameters.cluster_id}}"


Expand Down
2 changes: 1 addition & 1 deletion deploy_apps/tks-remove-servicemesh-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
#===============================
# For tks-info task
#===============================
- name: tks_info_host
- name: tks_api_url
value: "127.0.0.1"
- name: cluster_id
value: "Cabbead61"
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 @@ -21,7 +21,7 @@ spec:
#===============================
# For tks-info task
#===============================
- name: tks_info_host
- name: tks_api_url
value: "127.0.0.1"
- name: cluster_id
value: "Cabbead61"
Expand Down
44 changes: 23 additions & 21 deletions git-repo/create-cluster-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- name: cluster_info
container:
name: 'createClusterRepo'
image: harbor.taco-cat.xyz/tks/ghcli-alpine:3.0.1
image: harbor.taco-cat.xyz/tks/ghcli-yq:1.0.0
imagePullPolicy: IfNotPresent
command:
- /bin/bash
Expand Down Expand Up @@ -90,40 +90,42 @@ spec:
cp -r ${CONTRACT_ID}/${TEMPLATE_NAME} ${CLUSTER_ID}/${CLUSTER_ID}

## Replace site-values with fetched params ##
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.clusterName=\"$CLUSTER_ID\"" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
echo $INFRA_PROVIDER
case $INFRA_PROVIDER in
aws)
## Fetch cluster params from cluster_info file ##
val_ssh_key=$(echo $CLUSTER_INFO | jq -r '.sshKeyName')
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
sed -i "s/clusterRegion:\ CHANGEME/clusterRegion: $val_region/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
sed -i "s/mdNumOfAz:\ CHANGEME/mdNumOfAz: $val_num_of_az/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
sed -i "s/mdMinSizePerAz:\ CHANGEME/mdMinSizePerAz: $val_min_size/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
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

val_tksCpNode=$(echo $CLUSTER_INFO | jq -r '.tksCpNode')
val_tksInfraNode=$(echo $CLUSTER_INFO | jq -r '.tksInfraNode')
val_tksInfraNodeMax=$(echo $CLUSTER_INFO | jq -r '.tksInfraNodeMax')
val_tksInfraNodeType=$(echo $CLUSTER_INFO | jq -r '.tksInfraNodeType')
val_tksUserNode=$(echo $CLUSTER_INFO | jq -r '.tksUserNode')
val_tksUserNodeMax=$(echo $CLUSTER_INFO | jq -r '.tksUserNodeMax')
val_tksUserNodeType=$(echo $CLUSTER_INFO | jq -r '.tksUserNodeType')

yq -i e ".global.sshKeyName=\"$val_ssh_key\"" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.clusterRegion=\"$val_region\"" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml

yq -i e ".global.tksCpNode=$val_tksCpNode" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.tksInfraNode=$val_tksInfraNode" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.tksInfraNodeMax=$val_tksInfraNodeMax" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.tksInfraNodeType=\"$val_tksInfraNodeType\"" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.tksUserNode=$val_tksUserNode" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.tksUserNodeMax=$val_tksUserNodeMax" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.tksUserNodeType=\"$val_tksUserNodeType\"" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml

## multi-tenancy ##
if [ "$CLOUD_ACCOUNT_ID" = "NULL" ]; then
sed -i '/multitenancyId/,+2d' $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
else
sed -i "s/cloudAccountID:\ CHANGEME/cloudAccountID: $CLOUD_ACCOUNT_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
yq -i e ".global.cloudAccountID=\"$CLOUD_ACCOUNT_ID\"" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
fi
;;

byoh)
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster/site-values.yaml
echo "BYOH"
;;

Expand Down
2 changes: 1 addition & 1 deletion tests/tks-e2e-aws-msa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
- name: description
value: "e2e-test"
- name: infra_conf
value: '{\"cpNodeCnt\":3,\"tksNodeCnt\":3,\"userNodeCnt\":1}'
value: '{\"tksCpNode\":1,\"tksInfraNode\":1,\"tksUserNode\":1}'
- - name: call-validate-cluster
templateRef:
name: tks-validate-usercluster
Expand Down
2 changes: 1 addition & 1 deletion tests/tks-e2e-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
- name: description
value: "e2e-test"
- name: infra_conf
value: '{\"cpNodeCnt\":3,\"tksNodeCnt\":3,\"userNodeCnt\":1}'
value: '{\"tksCpNode\":1,\"tksInfraNode\":1,\"tksUserNode\":1}'
- - name: call-validate-cluster
templateRef:
name: tks-validate-usercluster
Expand Down
26 changes: 13 additions & 13 deletions tks-cli/tks-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- name: login-tks-api
container:
name: login-tks-api
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand All @@ -31,7 +31,7 @@ spec:
- name: description
container:
name: create-organization
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand Down Expand Up @@ -91,7 +91,7 @@ spec:
- name: infra_conf
container:
name: create-usercluster
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand All @@ -103,9 +103,9 @@ spec:

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')
TKS_CP_NODE=$(echo "{{inputs.parameters.infra_conf}}" | jq -r '.tksCpNode')
TKS_INFRA_NODE=$(echo "{{inputs.parameters.infra_conf}}" | jq -r '.tksInfraNode')
TKS_USER_NODE=$(echo "{{inputs.parameters.infra_conf}}" | jq -r '.tksUserNode')

CL_NAME="{{inputs.parameters.cluster_name}}"
echo "* Create $CL_NAME cluster"
Expand All @@ -114,9 +114,9 @@ spec:
--organization-id "{{inputs.parameters.organization_id}}" \
--cloud-account-id "{{inputs.parameters.cloud_account_id}}" \
--description "{{inputs.parameters.description}}" \
--cp-node-cnt $CP_NODE_CNT \
--tks-node-cnt $TKS_NODE_CNT \
--user-node-cnt $USER_NODE_CNT
--tks-cp-node $TKS_CP_NODE \
--tks-infra-node $TKS_INFRA_NODE \
--tks-user-node $TKS_USER_NODE

threshold=60
for i in $(seq 1 $threshold)
Expand Down Expand Up @@ -156,7 +156,7 @@ spec:
- name: cluster_id
container:
name: delete-usercluster
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand Down Expand Up @@ -199,7 +199,7 @@ spec:
- name: description
container:
name: create-appgroup
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand Down Expand Up @@ -249,7 +249,7 @@ spec:
- name: appgroup_id
container:
name: delete-appgroup
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand Down Expand Up @@ -289,7 +289,7 @@ spec:
- name: name
container:
name: get-appgroup-id
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v2.1.7
image: harbor.taco-cat.xyz/tks/tks-e2e-test:v3.1.1
envFrom:
- secretRef:
name: "tks-api-secret"
Expand Down
Loading