@@ -284,8 +284,13 @@ getClusterManagerConfig() {
284284 # _mysqldb_triton_machine_package
285285 # _name
286286 # _ha
287+ # _gcm_node_count
287288 _name=" $( getArgument " Name your Global Cluster Manager" " global-cluster" ) "
288289 _ha=" $( getVerification " Do you want to set up the Global Cluster Manager in HA mode" ) "
290+ if [ " $_ha " == " true" ]
291+ then
292+ _gcm_node_count=" $( getArgument " Number of cluster manager nodes for $_name Global Cluster Manager" " 2" ) "
293+ fi
289294 echo " From below options:"
290295 echo " Joyent-SDC-Public"
291296 echo " Joyent-SDC-Private"
@@ -625,7 +630,12 @@ readConfig() {
625630 then
626631 docker_engine_install_url=${line// docker_engine_install_url=/ }
627632 echo " docker-engine Install Script: $docker_engine_install_url "
633+ elif echo " $line " | grep -q ^gcm_node_count=
634+ then
635+ _gcm_node_count=${line// gcm_node_count=/ }
636+ echo " Number of cluster manager Nodes: $_gcm_node_count "
628637 fi
638+
629639 if [ " $_ha " == " true" ]
630640 then
631641 _etcd_node_count=3
@@ -653,7 +663,12 @@ setModuleClusterManager() {
653663 rancher_registry_username_line=" rancher_registry_username = \" ${rancher_registry_username} \" "
654664 rancher_registry_password_line=" rancher_registry_password = \" ${rancher_registry_password} \" "
655665 fi
656-
666+
667+ if [ " $_ha " == " false" ]
668+ then
669+ _gcm_node_count=" 1"
670+ fi
671+
657672 cd terraform
658673 cat >> create-rancher.tf << -EOF
659674
@@ -674,6 +689,7 @@ setModuleClusterManager() {
674689 master_triton_machine_package = "${_master_triton_machine_package} "
675690 mysqldb_triton_machine_package = "${_mysqldb_triton_machine_package} "
676691 ha = ${_ha}
692+ gcm_node_count = ${_gcm_node_count}
677693
678694 ${rancher_server_image_line}
679695 ${rancher_agent_image_line}
@@ -1027,8 +1043,17 @@ showClusterDetails() {
10271043 else
10281044 echo " This is a non-HA setup so there is only one cluster manager node."
10291045 fi
1046+
1047+ local __MasterCNS __name
1048+ __name=$_name
1049+ __MasterCNS=$( triton instance get " ${__name} -master-1" 2>&1 | jq ' .dns_names' 2>&1 | grep " ${__name} .svc.*.triton.zone" | tr -d ' "' | tr -d ' ' | tr -d ' ,' || true)
1050+ if [ " $__MasterCNS " ]
1051+ then
1052+ echo " http://${__MasterCNS} :8080/"
1053+ else
1054+ echo " http://${__MasterIP} :8080/"
1055+ fi
10301056 cat << -EOM
1031- http://${__MasterIP} :8080/settings/env
10321057
10331058 Next step is adding Kubernetes environments to be managed here.
10341059 To start your first environment, run:
@@ -1047,13 +1072,32 @@ showEnvironmentDetails() {
10471072 else
10481073 echo " This is a non-HA setup so Kubernetes services could run on any of the compute nodes."
10491074 fi
1075+
1076+ local __MasterCNS __name
1077+ __name=$( triton ls -l 2>&1 | grep " $__MasterIP " | awk ' {print $2}' 2>&1 | sed ' s/-master-1//g' || true)
1078+ __MasterCNS=$( triton instance get " ${__name} -master-1" 2>&1 | jq ' .dns_names' 2>&1 | grep " ${__name} .svc.*.triton.zone" | tr -d ' "' | tr -d ' ' | tr -d ' ,' || true)
1079+ if [ " $__MasterCNS " ]
1080+ then
1081+ cat << -EOM
1082+ Cluster Manager URL:
1083+ http://${__MasterCNS} :8080/settings/env
1084+ Kubernetes Hosts URL:
1085+ http://${__MasterCNS} :8080/env/$( $TERRAFORM output -state=terraform/terraform.tfstate -module=" ${_name} " -json | jq ' .environment_id.value' | tr -d ' "' ) /infra/hosts?mode=dot
1086+ Kubernetes Health:
1087+ http://${__MasterCNS} :8080/env/$( $TERRAFORM output -state=terraform/terraform.tfstate -module=" ${_name} " -json | jq ' .environment_id.value' | tr -d ' "' ) /apps/stacks?which=cattle
1088+ EOM
1089+ else
1090+ cat << -EOM
1091+ Cluster Manager URL:
1092+ http://${__MasterIP} :8080/settings/env
1093+ Kubernetes Hosts URL:
1094+ http://${__MasterIP} :8080/env/$( $TERRAFORM output -state=terraform/terraform.tfstate -module=" ${_name} " -json | jq ' .environment_id.value' | tr -d ' "' ) /infra/hosts?mode=dot
1095+ Kubernetes Health:
1096+ http://${__MasterIP} :8080/env/$( $TERRAFORM output -state=terraform/terraform.tfstate -module=" ${_name} " -json | jq ' .environment_id.value' | tr -d ' "' ) /apps/stacks?which=cattle
1097+ EOM
1098+ fi
1099+
10501100 cat << -EOM
1051- Cluster Manager URL:
1052- http://${__MasterIP} :8080/settings/env
1053- Kubernetes Hosts URL:
1054- http://${__MasterIP} :8080/env/$( $TERRAFORM output -state=terraform/terraform.tfstate -module=" ${_name} " -json | jq ' .environment_id.value' | tr -d ' "' ) /infra/hosts?mode=dot
1055- Kubernetes Health:
1056- http://${__MasterIP} :8080/env/$( $TERRAFORM output -state=terraform/terraform.tfstate -module=" ${_name} " -json | jq ' .environment_id.value' | tr -d ' "' ) /apps/stacks?which=cattle
10571101
10581102 NOTE: Nodes might take a few minutes to connect and come up.
10591103
0 commit comments