Skip to content

Commit

Permalink
Merge pull request #104 from openinfradev/revert_clusternaming
Browse files Browse the repository at this point in the history
Revert "use the first group of the cluster UUID as the cluster name"
  • Loading branch information
ktkfree authored Jul 12, 2022
2 parents 99feb2f + 0225b94 commit 3062fb7
Show file tree
Hide file tree
Showing 22 changed files with 73 additions and 98 deletions.
2 changes: 1 addition & 1 deletion app_serving/serve-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
arguments:
parameters:
- name: cluster_id
value: "011b88fa-4d53-439f-9336-67845f994051"
value: "C011b88fa"
- name: app_name
value: "sample-petclinic"
- name: app_repo
Expand Down
4 changes: 2 additions & 2 deletions deploy_apps/tks-ingress-controller-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ spec:
parameters:
# Use cluster_id here
- name: site_name
value: "011b88fa-4d53-439f-9336-67845f994051"
value: "C011b88fa"
- name: manifest_repo_url
value: ""
- name: revision
value: main
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.site_name)}}"
value: "{{workflow.parameters.site_name}}"

volumes:
- name: config
Expand Down
13 changes: 5 additions & 8 deletions deploy_apps/tks-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ spec:
- name: revision
value: "main"
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.site_name)}}"
value: "{{workflow.parameters.site_name}}"
##########################
# For tks-info task #
##########################
- name: tks_info_host
value: "tks-info.tks.svc"
- name: cluster_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Cabbead61"
- name: app_group_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Aabbead61"
volumes:
- name: tks-proto-vol
configMap:
Expand Down Expand Up @@ -137,9 +137,7 @@ spec:
echo "[$date] $level $msg"
}
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /etc/kubeconfig
Expand Down Expand Up @@ -185,8 +183,7 @@ spec:
- /bin/bash
- '-c'
- |
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /etc/kubeconfig
Expand Down
11 changes: 5 additions & 6 deletions deploy_apps/tks-remove-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ spec:
- name: tks_info_host
value: "tks-info.tks.svc"
- name: cluster_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Cabbead61"
- name: app_group_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Aabbead61"
##########################
# For removeLMA task #
##########################
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}"
value: "{{workflow.parameters.cluster_id}}"
- name: filter
value: "app={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}-{{workflow.parameters.app_group}}"
value: "app={{workflow.parameters.cluster_id}}-{{workflow.parameters.app_group}}"
volumes:
- name: tks-proto-vol
configMap:
Expand Down Expand Up @@ -114,8 +114,7 @@ spec:
kube_params=""
if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /etc/kubeconfig
Expand Down
11 changes: 5 additions & 6 deletions deploy_apps/tks-remove-servicemesh-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ spec:
- name: tks_info_host
value: "127.0.0.1"
- name: cluster_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Cabbead61"
- name: app_group_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Aabbead61"
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}"
value: "{{workflow.parameters.cluster_id)}}"
- name: filter
value: "app={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}-{{workflow.parameters.app_group}}"
value: "app={{workflow.parameters.cluster_id}}-{{workflow.parameters.app_group}}"
volumes:
- name: tks-proto-vol
configMap:
Expand Down Expand Up @@ -71,8 +71,7 @@ spec:
kube_params=""
if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /etc/kubeconfig
kube_params+="--kubeconfig=/etc/kubeconfig"
Expand Down
19 changes: 9 additions & 10 deletions deploy_apps/tks-service-mesh-dashboard-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ spec:
arguments:
parameters:
- name: cluster_id
value: "5b2220b0-39c5-4752-8ecd-d8269c88a3c7"
value: "C5b2220b0"
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}"
value: "{{workflow.parameters.cluster_id}}"
- name: aws_load_balancer
value: "ac11209ffe23043339efa1d0ad7c763a-4743f43cd92ad9c0.elb.ap-northeast-2.amazonaws.com"
- name: zone_id
Expand Down Expand Up @@ -828,8 +828,7 @@ spec:
kube_params=""
if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /tmp/kubeconfig
kube_params+="--kubeconfig=/tmp/kubeconfig"
Expand Down Expand Up @@ -937,8 +936,7 @@ spec:
kube_params=""
if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /tmp/kubeconfig
kube_params+="--kubeconfig=/tmp/kubeconfig"
Expand Down Expand Up @@ -1021,8 +1019,7 @@ spec:
kube_params=""
if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then
CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
kube_secret=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
echo -e "kube_secret:\n$kube_secret" | head -n 5
cat <<< "$kube_secret" > /tmp/kubeconfig
kube_params+="--kubeconfig=/tmp/kubeconfig"
Expand Down Expand Up @@ -1152,8 +1149,7 @@ spec:
- |
mkdir ~/.kube
cp /kube/value ~/.kube/config_adm
USER_CLUSTER_NAME={{=sprig.substr(0, 8, workflow.parameters.cluster_id)}}
KUBECONFIG_USERCLUSTER=$(kubectl --kubeconfig ~/.kube/config_adm get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
KUBECONFIG_USERCLUSTER=$(kubectl --kubeconfig ~/.kube/config_adm get secret -n ${CLUSTER_ID} ${CLUSTER_ID}-kubeconfig -o=jsonpath='{.data.value}' | base64 -d)
echo -e "kubeconfig_workload:\n$KUBECONFIG_USERCLUSTER" | head -n 5
cat <<< "$KUBECONFIG_USERCLUSTER" > ~/.kube/config_user
Expand Down Expand Up @@ -1207,6 +1203,9 @@ spec:
volumeMounts:
- name: kubeconfig-adm
mountPath: "/kube"
env:
- name: CLUSTER_ID
value: "{{workflow.parameters.cluster_id}}"
activeDeadlineSeconds: 900
retryStrategy:
limit: 2
Expand Down
6 changes: 3 additions & 3 deletions deploy_apps/tks-service-mesh-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ spec:
- name: revision
value: "main"
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.site_name)}}"
value: "{{workflow.parameters.site_name}}"
#===============================
# For tks-info task
#===============================
- name: tks_info_host
value: "127.0.0.1"
- name: cluster_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Cabbead61"
- name: app_group_id
value: "abbead61-ff2a-4af4-8f41-d2c44c745de7"
value: "Aabbead61"
volumes:
- name: tks-proto-vol
configMap:
Expand Down
9 changes: 3 additions & 6 deletions github_repo/create-cluster-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,13 @@ spec:
INFRA_PROVIDER=${infra_provider_group#tks-cluster-}
echo ${INFRA_PROVIDER} | tee /mnt/out/infra_provider.txt
# We se only the first UUID group for the cluster name and namespace.
CLUSTER_NAME=${CLUSTER_ID%%-*}
cp -r ${CONTRACT_ID}/${TEMPLATE_NAME} ${CLUSTER_ID}/${CLUSTER_ID}
cp -r ${CONTRACT_ID}/_github ${CLUSTER_ID}/.github
echo $CLUSTER_INFO
## Replace site-values with fetched params ##
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_NAME/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-common/site-values.yaml
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-common/site-values.yaml
case $INFRA_PROVIDER in
aws)
## Fetch cluster params from cluster_info file ##
Expand All @@ -64,7 +61,7 @@ spec:
val_max_size=$(echo $CLUSTER_INFO | sed 's/.*\(max_size_per_az:\ \S*\).*/\1/' | cut -d ':' -f2 | xargs)
echo "max_size_per_az: $val_max_size"
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_NAME/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-aws/site-values.yaml
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-aws/site-values.yaml
sed -i "s/sshKeyName:\ CHANGEME/sshKeyName: $val_ssh_key/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-aws/site-values.yaml
sed -i "s/clusterRegion:\ CHANGEME/clusterRegion: $val_region/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-aws/site-values.yaml
sed -i "s/mdNumOfAz:\ CHANGEME/mdNumOfAz: $val_num_of_az/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-aws/site-values.yaml
Expand All @@ -74,7 +71,7 @@ spec:
;;
byoh)
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_NAME/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-byoh/site-values.yaml
sed -i "s/clusterName:\ cluster.local/clusterName:\ $CLUSTER_ID/g" $CLUSTER_ID/$CLUSTER_ID/tks-cluster-byoh/site-values.yaml
echo "BYOH"
;;
Expand Down
4 changes: 2 additions & 2 deletions sealed_secrets/deploy-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ spec:
activeDeadlineSeconds: 120
inputs:
parameters:
- name: repo_url # Eg, "tks-management/011b88fa-4d53-439f-9336-67845f994051/25db54c6-d6cb-459b-9148-1b02ac545753"
- name: repo_url # Eg, "demo-decapod10/C011b88fa/C011b88fa
- name: secret_path # Eg, "sealed-cert/secret.yaml"
- name: namespace # Eg, "default"
- name: kubeconfig_secret_name # Eg, "25db54c6-d6cb-459b-9148-1b02ac545753-kubeconfig"
- name: kubeconfig_secret_name # Eg, "C011b88fa-kubeconfig"
container:
image: k8s.gcr.io/hyperkube:v1.18.8
imagePullPolicy: IfNotPresent
Expand Down
2 changes: 1 addition & 1 deletion sealed_secrets/setup-sealed-secrets-on-admincluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
- name: site_name
value: "decapod-reference"
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.site_name)}}"
value: "{{workflow.parameters.site_name}}"
- name: revision
value: "main"
## Uncomment following lines and customize to fetch any secrets you want ##
Expand Down
2 changes: 1 addition & 1 deletion sealed_secrets/setup-sealed-secrets-on-usercluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
- name: site_name
value: "decapod-reference"
- name: app_prefix
value: "{{=sprig.substr(0, 8, workflow.parameters.site_name)}}"
value: "{{workflow.parameters.site_name}}"
- name: revision
value: "main"
templates:
Expand Down
8 changes: 3 additions & 5 deletions tests/validate-service-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
arguments:
parameters:
- name: cluster_id
value: "93460371-6dbe-4a10-a574-97e35c049e10"
value: "C93460371"
templates:
- name: main
steps:
Expand All @@ -35,8 +35,7 @@ spec:
- /bin/bash
- -c
- |
CLUSTER_NAME={{=sprig.substr(0, 8, inputs.parameters.cluster_id)}}
KUBECONFIG_=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
KUBECONFIG_=$(kubectl get secret -n {{inputs.parameters.cluster_id}} {{inputs.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
cat <<< "$KUBECONFIG_" > /etc/kubeconfig_temp
export KUBECONFIG='/etc/kubeconfig_temp'
Expand Down Expand Up @@ -83,8 +82,7 @@ spec:
- /bin/bash
- -c
- |
CLUSTER_NAME={{=sprig.substr(0, 8, inputs.parameters.cluster_id)}}
KUBECONFIG_=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
KUBECONFIG_=$(kubectl get secret -n {{inputs.parameters.cluster_id}} {{inputs.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
cat <<< "$KUBECONFIG_" > /etc/kubeconfig_temp
export KUBECONFIG='/etc/kubeconfig_temp'
Expand Down
6 changes: 2 additions & 4 deletions tests/validate-usercluster-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
arguments:
parameters:
- name: cluster_id
value: "011b88fa-4d53-439f-9336-67845f994051"
value: "C011b88fa"
- name: sonobuoy_mode
value: "quick"
templates:
Expand Down Expand Up @@ -36,9 +36,7 @@ spec:
- /bin/bash
- '-exc'
- |
CLUSTER_NAME={{=sprig.substr(0, 8, inputs.parameters.cluster_id)}}
KUBECONFIG_=$(kubectl get secret -n $CLUSTER_NAME $CLUSTER_NAME-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
KUBECONFIG_=$(kubectl get secret -n {{inputs.parameters.cluster_id}} {{inputs.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d)
cat <<< "$KUBECONFIG_" > /etc/kubeconfig_temp
export KUBECONFIG='/etc/kubeconfig_temp'
Expand Down
2 changes: 1 addition & 1 deletion tks-cluster/aws-infrastructure-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
arguments:
parameters:
- name: cluster_id
value: "1eee74fd-1f06-4a2a-9bd0-d7909985a86c"
value: "C1eee74fd"

volumes:
- name: config
Expand Down
4 changes: 2 additions & 2 deletions tks-cluster/create-aws-infrastructure-w-terraform-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
arguments:
parameters:
- name: cluster_id
value: "d0e77f68-d3ef-47d8-9f5a-535d7015530f"
value: "Cd0e77f68"

volumes:
- name: config
Expand Down Expand Up @@ -436,4 +436,4 @@ spec:
- name: config
mountPath: "/kube"
- name: artifacts
mountPath: "/artifacts"
mountPath: "/artifacts"
Loading

0 comments on commit 3062fb7

Please sign in to comment.