Skip to content

Commit 5c31ac9

Browse files
committed
K8S-540 disable incompatible addons
1 parent 9cd8f7f commit 5c31ac9

File tree

2 files changed

+1
-268
lines changed

2 files changed

+1
-268
lines changed

manifest.jps

Lines changed: 0 additions & 267 deletions
Original file line numberDiff line numberDiff line change
@@ -778,225 +778,6 @@ addons:
778778
java.lang.Thread.sleep(3000);
779779
return { type: "info", message: "Kubernetes Cluster " + current + " upgrade to " + version + " has been started.\n\nThe update process may take several minutes depending on number of nodes and deployed services." };
780780

781-
- id: gitlab-k8s-addon
782-
type: update
783-
permanent: true
784-
baseUrl: https://raw.githubusercontent.com/jelastic-jps/kubernetes/v1.20.4
785-
name: GitLab Integration
786-
description: Add Kubernetes GitLab integrations
787-
logo: /images/k8s-gitlab.png
788-
settings:
789-
fields:
790-
- type: displayfield
791-
hideLabel: true
792-
markup: This addon provides Kubernetes and GitLab integration. Please select the Gitlab environment from the list.
793-
- type: displayfield
794-
hideLabel: true
795-
- type: envlist
796-
name: envlist
797-
valueField: shortdomain
798-
caption: GitLab environment
799-
800-
buttons:
801-
- caption: Configure
802-
settings: gitlab
803-
action: addon-gitlab-config
804-
loadingText: Configuration...
805-
confirmText: Are you sure?
806-
successText: GitLab integration successfully configured!
807-
- caption: Remove Integration
808-
action: addon-gitlab-remove
809-
confirmText: Any existing Kubernetes and GitLab integration will be removed. Continue?
810-
successText: GitLab integration successfully removed!
811-
812-
actions:
813-
addon-gitlab-config:
814-
- log: '${settings.envlist}'
815-
- cmd[${nodes.k8sm.master.id}]: kubectl get configmaps -n gitlab-managed-apps gitlab-configuration &>/dev/null && echo "true" || echo "false"
816-
- set:
817-
gitlab_installed: ${response.out}
818-
- if ('${this.gitlab_installed}' == 'true'):
819-
return:
820-
type: info
821-
message: This cluster already has GitLab integration!
822-
- env.control.GetEnvInfo:
823-
envName: ${settings.envlist}
824-
- set:
825-
gitlab_domain: ${response.env.domain}
826-
- env.control.ExecCmdByGroup [cp]:
827-
envName: ${settings.envlist}
828-
commandList:
829-
- command: echo ${ROOT_PASSWORD}
830-
- set:
831-
gitlab_pass: ${response.out}
832-
- env.control.ExecCmdByGroup [cp]:
833-
envName: ${settings.envlist}
834-
commandList:
835-
- command: echo ${HTTPS_PORT}
836-
- set:
837-
gitlab_port: ${response.out}
838-
gitlab_http_endpoint: "https://${this.gitlab_domain}:${this.gitlab_port}"
839-
- env.control.ExecCmdByGroup [cp]:
840-
envName: ${settings.envlist}
841-
commandList:
842-
- command: echo ${REGISTRY_PORT}
843-
- set:
844-
gitlab_reg_port: ${response.out}
845-
- env.control.ExecCmdByGroup [cp]:
846-
envName: ${settings.envlist}
847-
commandList:
848-
- command: cat /srv/docker/gitlab/certs/ca.crt | base64 -w 0
849-
- set:
850-
gitlab_ca_instance: ${response.out}
851-
- if ('${this.gitlab_pass}' == '' || '${this.gitlab_port}' == ''):
852-
return:
853-
type: warning
854-
message: Cannot determine GitLab credentials!
855-
- cmd[${nodes.k8sm.master.id}]: kubectl apply -f ${baseUrl}/addons/gitlab/gitlab-service-account.yaml
856-
- cmd[${nodes.k8sm.master.id}]: kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep gitlab-admin | awk '{print $1}') | grep '^token:' | awk '{print $2}'
857-
- set:
858-
gitlab_token: ${response.out}
859-
- cmd[${nodes.k8sm.master.id}]: kubectl cluster-info | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" | grep 'Kubernetes master' | awk '/http/ {print $NF}'
860-
- set:
861-
gitlab_api_url: ${response.out}
862-
- cmd[${nodes.k8sm.master.id}]: kubectl get secret $(kubectl get secrets | grep default-token | cut -d " " -f 1) -o jsonpath="{['data']['ca\.crt']}" | base64 --decode
863-
- set:
864-
gitlab_ca_cert: ${response.out}
865-
- cmd[${nodes.k8sm.master.id}]: |-
866-
# Login
867-
page_content=$(curl -sk -c gitlab-jar.txt '${this.gitlab_http_endpoint}/users/sign_in')
868-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /new_user.*?authenticity_token"[[:blank:]]value="(.+?)"/' | sed -n 1p)
869-
echo "Sign-in CSRF token: ${csrf_token}"
870-
[ -n "${csrf_token}" ] || exit 1
871-
curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -f -d "user[login]=root&user[password]=${this.gitlab_pass}" --data-urlencode "authenticity_token=${csrf_token}" '${this.gitlab_http_endpoint}/users/sign_in'
872-
- cmd[${nodes.k8sm.master.id}]: |-
873-
# Cluster
874-
page_content=$(curl -sk -b gitlab-jar.txt -c gitlab-jar.txt '${this.gitlab_http_endpoint}/admin/clusters')
875-
echo ${page_content} | perl -ne 'print "$1\n" if /data-qa-cluster-name="Kubernetes"[[:blank:]]href="\/admin\/clusters\/(.+?)"/' | sed -n 1p
876-
- if ('${response.out}'):
877-
return:
878-
type: warning
879-
message: GitLab instance already has active integration!
880-
- cmd[${nodes.k8sm.master.id}]: |-
881-
# Settings
882-
page_content=$(curl -sk -b gitlab-jar.txt -c gitlab-jar.txt '${this.gitlab_http_endpoint}/admin/application_settings/network')
883-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /meta[[:blank:]]name="csrf-token"[[:blank:]]content="(.+?)"/' | sed -n 1p)
884-
echo "Application settings CSRF token: ${csrf_token}"
885-
[ -n "${csrf_token}" ] || exit 2
886-
curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -f -d "_method=patch&application_setting[allow_local_requests_from_web_hooks_and_services]=1&application_setting[allow_local_requests_from_system_hooks]=1&application_setting[dns_rebinding_protection_enabled]=1" --data-urlencode "authenticity_token=${csrf_token}" '${this.gitlab_http_endpoint}/admin/application_settings/network' || exit 2
887-
curl -sk -b gitlab-jar.txt -c gitlab-jar.txt -f '${this.gitlab_http_endpoint}/admin/application_settings/network' &>/dev/null
888-
- cmd[${nodes.k8sm.master.id}]: |-
889-
# Cluster
890-
for i in {1..5}; do
891-
sleep 10
892-
echo "Attempt ${i} of GitLab Kubernetes cluster creation"
893-
page_content=$(curl -sk -b gitlab-jar.txt -c gitlab-jar.txt '${this.gitlab_http_endpoint}/admin/clusters/new')
894-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /new_cluster.*?authenticity_token"[[:blank:]]value="(.+?)"/' | sed -n 1p)
895-
echo "Add cluster CSRF token: ${csrf_token}"
896-
[ -n "${csrf_token}" ] || continue
897-
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')
898-
cluster_url=$(echo ${page_content} | perl -ne 'print "$1\n" if /You[[:blank:]]are[[:blank:]]being[[:blank:]]\<a[[:blank:]]href="(.+?)"\>redirected/' | sed -n 1p)
899-
echo "Kubernetes GitLab cluster: ${cluster_url}"
900-
[ -n "${cluster_url}" ] && break || continue
901-
done
902-
echo "${page_content}"
903-
[ -n "${cluster_url}" ] || exit 4
904-
cluster_id=$(echo ${cluster_url} | perl -ne 'print "$1\n" if /\/admin\/clusters\/(\d+)$/')
905-
[ -n "${cluster_id}" ] || exit 4
906-
kubectl create ns gitlab-managed-apps
907-
kubectl create configmap gitlab-configuration --from-literal cluster_url="${cluster_url}" --from-literal cluster_id="${cluster_id}" --from-literal cluster_env="${settings.envlist}" -n gitlab-managed-apps
908-
- cmd[${nodes.k8sm.master.id}]: kubectl get configmaps -n gitlab-managed-apps gitlab-configuration -o jsonpath='{.data.cluster_url}'
909-
- set:
910-
gitlab_cluster_url: ${response.out}
911-
- cmd[${nodes.k8sm.master.id}]: |-
912-
# Runner
913-
page_content=$(curl -sk -b gitlab-jar.txt -c gitlab-jar.txt "${this.gitlab_cluster_url}")
914-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /csrf-param.*?csrf-token"[[:blank:]]content="(.+?)"/' | sed -n 1p)
915-
echo "Runner CSRF token: ${csrf_token}"
916-
[ -n "${csrf_token}" ] || exit 5
917-
curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -f -H "X-CSRF-Token: ${csrf_token}" "${this.gitlab_cluster_url}/applications/runner" || exit 5
918-
wait-deployment.sh runner-gitlab-runner gitlab-managed-apps 1 720
919-
- cmd[${nodes.k8sm.master.id}]: |-
920-
# Integration
921-
echo '${this.gitlab_ca_instance}' | base64 -d > /var/lib/kubelet/worker-data/gitlab-cacert.crt
922-
echo 'GITLAB_REGISTRY="${this.gitlab_domain}:${this.gitlab_reg_port}"' > /var/lib/kubelet/worker-data/gitlab-integration.conf
923-
wget -nv ${baseUrl}/addons/gitlab/gitlab-integration.sh -O /var/lib/kubelet/worker-data/gitlab-integration.sh
924-
chmod +x /var/lib/kubelet/worker-data/gitlab-integration.sh
925-
- prepare-worker-integration
926-
- init-globals-workers
927-
- apply-worker-integration: ${globals.workers}
928-
929-
addon-gitlab-remove:
930-
- cmd[${nodes.k8sm.master.id}]: kubectl get ns gitlab-managed-apps &>/dev/null && echo "true" || echo "false"
931-
- set:
932-
gitlab_installed: ${response.out}
933-
- if ('${this.gitlab_installed}' == 'false'):
934-
return:
935-
type: info
936-
message: This cluster has no active GitLab integration!
937-
- cmd[${nodes.k8sm.master.id}]: kubectl get configmaps -n gitlab-managed-apps gitlab-configuration -o jsonpath='{.data.cluster_env}'
938-
- set:
939-
gitlab_cluster_env: ${response.out}
940-
- cmd[${nodes.k8sm.master.id}]: kubectl get configmaps -n gitlab-managed-apps gitlab-configuration -o jsonpath='{.data.cluster_id}'
941-
- set:
942-
gitlab_cluster_id: ${response.out}
943-
- env.control.GetEnvInfo:
944-
envName: ${this.gitlab_cluster_env}
945-
- set:
946-
gitlab_domain: ${response.env.domain}
947-
- env.control.ExecCmdByGroup [cp]:
948-
envName: ${this.gitlab_cluster_env}
949-
commandList:
950-
- command: echo ${ROOT_PASSWORD}
951-
- set:
952-
gitlab_pass: ${response.out}
953-
- env.control.ExecCmdByGroup [cp]:
954-
envName: ${this.gitlab_cluster_env}
955-
commandList:
956-
- command: echo ${HTTPS_PORT}
957-
- set:
958-
gitlab_port: ${response.out}
959-
gitlab_http_endpoint: "https://${this.gitlab_domain}:${this.gitlab_port}"
960-
- if ('${this.gitlab_pass}' == '' || '${this.gitlab_port}' == ''):
961-
return:
962-
type: warning
963-
message: Cannot determine GitLab credentials!
964-
- cmd[${nodes.k8sm.master.id}]: |-
965-
# Login
966-
page_content=$(curl -sk -c gitlab-jar.txt '${this.gitlab_http_endpoint}/users/sign_in')
967-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /new_user.*?authenticity_token"[[:blank:]]value="(.+?)"/' | sed -n 1p)
968-
echo "Sign-in CSRF token: ${csrf_token}"
969-
[ -n "${csrf_token}" ] || exit 1
970-
curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -f -d "user[login]=root&user[password]=${this.gitlab_pass}" --data-urlencode "authenticity_token=${csrf_token}" '${this.gitlab_http_endpoint}/users/sign_in'
971-
- cmd[${nodes.k8sm.master.id}]: |-
972-
# Runner
973-
page_content=$(curl -sk -b gitlab-jar.txt -c gitlab-jar.txt '${this.gitlab_http_endpoint}/admin/clusters/${this.gitlab_cluster_id}')
974-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /csrf-param.*?csrf-token"[[:blank:]]content="(.+?)"/' | sed -n 1p)
975-
echo "Remove runner CSRF token: ${csrf_token}"
976-
[ -n "${csrf_token}" ] || exit 5
977-
curl -X DELETE -sk -b gitlab-jar.txt -c gitlab-jar.txt -H "X-CSRF-Token: ${csrf_token}" '${this.gitlab_http_endpoint}/admin/clusters/${this.gitlab_cluster_id}/applications/runner'
978-
- cmd[${nodes.k8sm.master.id}]: |-
979-
while true; do kubectl -n gitlab-managed-apps get deploy runner-gitlab-runner --no-headers && sleep 5 || break; done
980-
- cmd[${nodes.k8sm.master.id}]: |-
981-
# Cluster
982-
sleep 10
983-
page_content=$(curl -sk -b gitlab-jar.txt -c gitlab-jar.txt '${this.gitlab_http_endpoint}/admin/clusters/${this.gitlab_cluster_id}')
984-
csrf_token=$(echo ${page_content} | perl -ne 'print "$1\n" if /csrf-param.*?csrf-token"[[:blank:]]content="(.+?)"/' | sed -n 1p)
985-
echo "Remove cluster CSRF token: ${csrf_token}"
986-
[ -n "${csrf_token}" ] || exit 5
987-
curl -X POST -sk -b gitlab-jar.txt -c gitlab-jar.txt -d "_method=delete&no_cleanup=true&confirm_cluster_name_input=Kubernetes" --data-urlencode "authenticity_token=${csrf_token}" '${this.gitlab_http_endpoint}/admin/clusters/${this.gitlab_cluster_id}'
988-
- cmd[${nodes.k8sm.master.id}]: |-
989-
sleep 10
990-
rm -f /var/lib/kubelet/worker-data/gitlab-*
991-
kubectl delete ns gitlab-managed-apps
992-
kubectl delete -f ${baseUrl}/addons/gitlab/gitlab-service-account.yaml
993-
- init-globals-workers
994-
- cmd[${globals.workers}]: |-
995-
wget -nv ${baseUrl}/addons/gitlab/gitlab-integration-remove.sh -O /var/lib/worker/gitlab-integration-remove.sh
996-
chmod +x /var/lib/worker/gitlab-integration-remove.sh
997-
/var/lib/worker/gitlab-integration-remove.sh | tee -a /var/log/kubernetes/k8s-worker-integration.log
998-
rm -f /var/lib/worker/gitlab-*
999-
1000781
- id: certman-k8s-addon
1001782
type: update
1002783
permanent: true
@@ -1096,54 +877,6 @@ addons:
1096877

1097878
Enter [Rancher dashboard](${env.url}), and set your login credentials there.
1098879

1099-
- id: regcreds-k8s-addon
1100-
type: update
1101-
permanent: true
1102-
baseUrl: https://raw.githubusercontent.com/jelastic-jps/kubernetes/v1.20.4
1103-
name: DockerHub Registry Credentials
1104-
description: |
1105-
Leverage DockerHub images pull rate limits: assign DockerHub user credentials to Kubernetes deployments cluster-wide
1106-
logo: /images/k8s-regcreds.png
1107-
settings:
1108-
fields:
1109-
- type: displayfield
1110-
hideLabel: true
1111-
markup: Please specify DockerHub user's valid credentials in the fields below. All previously stored DockerHub user credentials (if any) will be overwritten!
1112-
- type: displayfield
1113-
hideLabel: true
1114-
- type: string
1115-
required: true
1116-
regex: "^((?!\\s).)*$"
1117-
regexText: Incorrect username
1118-
caption: Username
1119-
name: creds_username
1120-
- type: string
1121-
required: true
1122-
inputType: password
1123-
caption: Password
1124-
name: creds_password
1125-
- type: string
1126-
required: true
1127-
vtype: email
1128-
caption: E-mail
1129-
name: creds_email
1130-
buttons:
1131-
- caption: DockerHub Credentials
1132-
settings: regcreds
1133-
action: addon-regcreds-config
1134-
loadingText: Setting up...
1135-
successText: DockerHub registry user credentials have been successfully set!
1136-
1137-
actions:
1138-
addon-regcreds-config:
1139-
- cmd[${nodes.k8sm.master.id}]: |-
1140-
kubectl apply -f ${baseUrl}/addons/registry-creds/registry-creds-system.yaml
1141-
wait-deployment.sh registry-creds-registry-creds-controller registry-creds-system 1 600
1142-
kubectl delete -f ${baseUrl}/addons/registry-creds/dockerhub-secret.yaml
1143-
kubectl -n kube-system delete secret dockerhub-credentials-secret
1144-
kubectl -n kube-system create secret docker-registry dockerhub-credentials-secret --docker-username='${settings.creds_username}' --docker-password='${settings.creds_password}' --docker-email='${settings.creds_email}'
1145-
kubectl apply -f ${baseUrl}/addons/registry-creds/dockerhub-secret.yaml
1146-
1147880
success: |
1148881
${globals.default_success:}
1149882
${globals.monitoring_success:}

scripts/beforeinstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var resp = {
1313
scalingMode: "stateless",
1414
nodeGroup: "k8sm",
1515
isRedeploySupport: false,
16-
addons: ["conf-k8s-addon", "upgrade-k8s-addon", "monitor-k8s-addon", "gitlab-k8s-addon", "certman-k8s-addon", "rancher-k8s-addon", "regcreds-k8s-addon"],
16+
addons: ["conf-k8s-addon", "upgrade-k8s-addon", "monitor-k8s-addon", "certman-k8s-addon", "rancher-k8s-addon"],
1717
displayName: "Master",
1818
extip: false
1919
}, {

0 commit comments

Comments
 (0)