@@ -124,7 +124,6 @@ onAfterScaleOut:
124124 - set:
125125 nodes: ${event.response.nodes.join(id,)}
126126 ips: ${event.response.nodes.join(extIPs,)}
127- - prepare-worker-integration
128127 - cmd [${this.nodes}]: init-instance.sh --type=worker --initial=true --base-url=$(echo '${baseUrl}' | base64 -w 0)
129128 - connect-workers: ${this.nodes}
130129 - apply-worker-config:
@@ -218,18 +217,20 @@ actions:
218217 user: root
219218 sync: false
220219
221- prepare -worker-integration:
220+ apply -worker-integration:
222221 - cmd[${nodes.k8sm.master.id}]: tar zcfv - /var/lib/kubelet/worker-data 2>/dev/null | base64 -w 0
223- - setGlobals :
222+ - set :
224223 worker_integration: ${response.out}
225-
226- apply-worker-config:
227- - cmd[${nodes.k8sm.master.id}]: screen -d -m /usr/local/sbin/worker-config -n ${this.nodes} -g ${this.group} -r ${env.region}
228224 - cmd[${this.nodes}]: |-
229225 mkdir /var/lib/worker &>/dev/null || rm -rf /var/lib/worker/*
230- echo '${globals .worker_integration}' | base64 -d | tar zxv --strip-components=4 -C /var/lib/worker
226+ echo '${this .worker_integration}' | base64 -d | tar zxv --strip-components=4 -C /var/lib/worker
231227 screen -d -m /usr/bin/bash -c '/usr/local/sbin/worker-integration.sh &>/var/log/kubernetes/k8s-worker-integration.log'
232228
229+ apply-worker-config:
230+ - cmd[${nodes.k8sm.master.id}]: screen -d -m /usr/local/sbin/worker-config -n ${this.nodes} -g ${this.group} -r ${env.region}
231+ - apply-worker-integration:
232+ nodes: ${this.nodes}
233+
233234 init-main-master:
234235 - if (${nodes.mbl.length:0}):
235236 cmd[mbl]: |-
@@ -255,7 +256,6 @@ actions:
255256 - cmd[${nodes.k8sm.master.id}]: sed -n '/kubeadm join/,/^$/{/./p}' /var/log/kubeadm-init.log | sed ':a;N;$!ba;s/\\\n//g' | grep -v 'control-plane'
256257 - setGlobals:
257258 worker_join_cmd: ${response.out}
258- - prepare-worker-integration
259259
260260 init-slave-masters:
261261 - script: |
@@ -901,7 +901,7 @@ addons:
901901 csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /new_cluster.*?authenticity_token"[[:blank:]]value="(.+?)"/' | sed -n 1p)
902902 echo "Add cluster CSRF token: ${csrf_token}"
903903 [ -n "${csrf_token}" ] || continue
904- page_content=$(curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -d "cluster[name]=Kubernetes&cluster[platform_kubernetes_attributes][authorization_type]=rbac&cluster[managed]=1" --data-urlencode "cluster[platform_kubernetes_attributes][api_url]=${this.gitlab_api_url}" --data-urlencode "cluster[platform_kubernetes_attributes][ca_cert]=${this.gitlab_ca_cert}" --data-urlencode "cluster[platform_kubernetes_attributes][token]=${this.gitlab_token}" --data-urlencode "authenticity_token=${csrf_token}" '${this.gitlab_http_endpoint}/admin/clusters/create_user')
904+ page_content=$(curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -d "cluster[name]=Kubernetes&cluster[platform_kubernetes_attributes][authorization_type]=rbac&cluster[managed]=1&cluster[namespace_per_environment]=1 " --data-urlencode "cluster[platform_kubernetes_attributes][api_url]=${this.gitlab_api_url}" --data-urlencode "cluster[platform_kubernetes_attributes][ca_cert]=${this.gitlab_ca_cert}" --data-urlencode "cluster[platform_kubernetes_attributes][token]=${this.gitlab_token}" --data-urlencode "authenticity_token=${csrf_token}" '${this.gitlab_http_endpoint}/admin/clusters/create_user')
905905 cluster_url=$(echo ${page_content} | perl -ne 'print "$1\n" if /You[[:blank:]]are[[:blank:]]being[[:blank:]]\<a[[:blank:]]href="(.+?)"\>redirected/' | sed -n 1p)
906906 echo "Kubernetes GitLab cluster: ${cluster_url}"
907907 [ -n "${cluster_url}" ] && break || continue
@@ -929,9 +929,9 @@ addons:
929929 echo 'GITLAB_REGISTRY="${this.gitlab_domain}:${this.gitlab_reg_port}"' > /var/lib/kubelet/worker-data/gitlab-integration.conf
930930 wget -nv ${baseUrl}/addons/gitlab/gitlab-integration.sh -O /var/lib/kubelet/worker-data/gitlab-integration.sh
931931 chmod +x /var/lib/kubelet/worker-data/gitlab-integration.sh
932- - prepare-worker-integration
933932 - init-globals-workers
934- - apply-worker-integration: ${globals.workers}
933+ - apply-worker-integration:
934+ nodes: ${globals.workers}
935935
936936 addon-gitlab-remove:
937937 - cmd[${nodes.k8sm.master.id}]: kubectl get ns gitlab-managed-apps &>/dev/null && echo "true" || echo "false"
0 commit comments