Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
distinct outbound test for mooncake clusters (#4169)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Nov 5, 2018
1 parent f490623 commit 7082f9a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesagentresourcesvmas.t
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
{{if IsOpenShift }}
"script": "{{ Base64 (OpenShiftGetNodeSh .) }}"
{{else}}
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 40 1 3 nc -vz k8s.gcr.io 443 || retrycmd_if_failure 40 1 3 nc -vz gcr.azk8s.cn 80 || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' GPU_NODE={{IsNSeriesSKU .}} /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1{{if CSERunInBackground }} &{{end}}\"')]"
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 75 1 3 nc -vz {{if IsMooncake}}gcr.azk8s.cn 80{{else}}k8s.gcr.io 443 || retrycmd_if_failure 75 1 3 nc -vz 8.8.8.8 443{{end}} || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' GPU_NODE={{IsNSeriesSKU .}} /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1{{if CSERunInBackground }} &{{end}}\"')]"
{{end}}
}
}
Expand Down
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesagentresourcesvmss.t
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"autoUpgradeMinorVersion": true,
"settings": {},
"protectedSettings": {
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 40 1 3 nc -vz k8s.gcr.io 443 || retrycmd_if_failure 40 1 3 nc -vz gcr.azk8s.cn 80 || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' GPU_NODE={{IsNSeriesSKU .}} /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1{{if CSERunInBackground }} &{{end}}\"')]"
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 75 1 3 nc -vz {{if IsMooncake}}gcr.azk8s.cn 80{{else}}k8s.gcr.io 443 || retrycmd_if_failure 75 1 3 nc -vz 8.8.8.8 443{{end}} || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' GPU_NODE={{IsNSeriesSKU .}} /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1{{if CSERunInBackground }} &{{end}}\"')]"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesmasterresources.t
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@
{{if IsOpenShift}}
"script": "{{ Base64 OpenShiftGetMasterSh }}"
{{else}}
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 40 1 3 nc -vz k8s.gcr.io 443 || retrycmd_if_failure 40 1 3 nc -vz gcr.azk8s.cn 80 || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' ',variables('provisionScriptParametersMaster'), ' /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1\"')]"
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 75 1 3 nc -vz {{if IsMooncake}}gcr.azk8s.cn 80{{else}}k8s.gcr.io 443 || retrycmd_if_failure 75 1 3 nc -vz 8.8.8.8 443{{end}} || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' ',variables('provisionScriptParametersMaster'), ' /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1\"')]"
{{end}}
}
}
Expand Down
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesmasterresourcesvmss.t
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"autoUpgradeMinorVersion": true,
"settings": {},
"protectedSettings": {
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 40 1 3 nc -vz k8s.gcr.io 443 || retrycmd_if_failure 40 1 3 nc -vz gcr.azk8s.cn 80 || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' ',variables('provisionScriptParametersMaster'), ' /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1\"')]"
"commandToExecute": "[concat('retrycmd_if_failure() { r=$1; w=$2; t=$3; shift && shift && shift; for i in $(seq 1 $retries); do timeout $t ${@}; [ $? -eq 0 ] && break || if [ $i -eq $r ]; then return 1; else sleep $w; fi; done }; ERR_OUTBOUND_CONN_FAIL=50; retrycmd_if_failure 75 1 3 nc -vz {{if IsMooncake}}gcr.azk8s.cn 80{{else}}k8s.gcr.io 443 || retrycmd_if_failure 75 1 3 nc -vz 8.8.8.8 443{{end}} || exit $ERR_OUTBOUND_CONN_FAIL; for i in $(seq 1 1200); do if [ -f /opt/azure/containers/provision.sh ]; then break; fi; if [ $i -eq 1200 ]; then exit 100; else sleep 1; fi; done; ', variables('provisionScriptParametersCommon'),' ',variables('provisionScriptParametersMaster'), ' /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1\"')]"
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/acsengine/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,3 @@ const (
swarmWinAgentResourcesVMSS = "swarm/swarmwinagentresourcesvmss.t"
windowsParams = "windowsparams.t"
)

const (
azurePublicCloud = "AzurePublicCloud"
)
6 changes: 5 additions & 1 deletion pkg/acsengine/template_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,11 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat
},
"UseAksExtension": func() bool {
cloudSpecConfig := cs.GetCloudSpecConfig()
return cloudSpecConfig.CloudName == azurePublicCloud
return cloudSpecConfig.CloudName == api.AzurePublicCloud
},
"IsMooncake": func() bool {
cloudSpecConfig := cs.GetCloudSpecConfig()
return cloudSpecConfig.CloudName == api.AzureChinaCloud
},
"UseInstanceMetadata": func() bool {
return helpers.IsTrueBoolPointer(cs.Properties.OrchestratorProfile.KubernetesConfig.UseInstanceMetadata)
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/azenvtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ var (

//AzureCloudSpec is the default configurations for global azure.
AzureCloudSpec = AzureEnvironmentSpecConfig{
CloudName: azurePublicCloud,
CloudName: AzurePublicCloud,
//DockerSpecConfig specify the docker engine download repo
DockerSpecConfig: DefaultDockerSpecConfig,
//KubernetesSpecConfig is the default kubernetes container image url.
Expand Down Expand Up @@ -228,7 +228,7 @@ var (

//AzureChinaCloudSpec is the configurations for Azure China (Mooncake)
AzureChinaCloudSpec = AzureEnvironmentSpecConfig{
CloudName: azureChinaCloud,
CloudName: AzureChinaCloud,
//DockerSpecConfig specify the docker engine download repo
DockerSpecConfig: DockerSpecConfig{
DockerEngineRepo: "https://mirror.azk8s.cn/docker-engine/apt/repo/",
Expand Down Expand Up @@ -269,9 +269,9 @@ var (

// AzureCloudSpecEnvMap is the environment configuration map for all the Azure cloid environments.
AzureCloudSpecEnvMap = map[string]AzureEnvironmentSpecConfig{
azureChinaCloud: AzureChinaCloudSpec,
AzureChinaCloud: AzureChinaCloudSpec,
azureGermanCloud: AzureGermanCloudSpec,
azureUSGovernmentCloud: AzureUSGovernmentCloud,
azurePublicCloud: AzureCloudSpec,
AzurePublicCloud: AzureCloudSpec,
}
)
6 changes: 4 additions & 2 deletions pkg/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ const (
)

const (
azurePublicCloud = "AzurePublicCloud"
azureChinaCloud = "AzureChinaCloud"
// AzurePublicCloud is a const string reference identifier for public cloud
AzurePublicCloud = "AzurePublicCloud"
// AzureChinaCloud is a const string reference identifier for china cloud
AzureChinaCloud = "AzureChinaCloud"
azureGermanCloud = "AzureGermanCloud"
azureUSGovernmentCloud = "AzureUSGovernmentCloud"
)

0 comments on commit 7082f9a

Please sign in to comment.