From bd006fc9976fa181e0a093ea148bcd58dfe3115a Mon Sep 17 00:00:00 2001 From: dmitsh Date: Sun, 12 Nov 2017 14:39:04 -0800 Subject: [PATCH] allow disabling dashboard addon in kubernetes cluster (#1754) * initial commit * next * added example for deployment without dashboard * added check for no dashboard in validation; update doc * fix test * added to regression set --- docs/clusterdefinition.md | 1 + .../kubernetes-no-dashboard.json | 40 +++++++++++ .../kubernetes-no-dashboard.json.env | 2 + parts/kubernetesmastercustomdata.yml | 4 ++ pkg/acsengine/engine.go | 14 ++-- pkg/api/converterfromapi.go | 7 +- pkg/api/convertertoapi.go | 7 +- pkg/api/types.go | 72 ++++++++++--------- pkg/api/vlabs/types.go | 72 ++++++++++--------- test/acse-conf/acse-regression.json | 4 ++ test/cluster-tests/kubernetes/test.sh | 72 ++++++++++--------- 11 files changed, 188 insertions(+), 107 deletions(-) create mode 100644 examples/kubernetes-config/kubernetes-no-dashboard.json create mode 100644 examples/kubernetes-config/kubernetes-no-dashboard.json.env diff --git a/docs/clusterdefinition.md b/docs/clusterdefinition.md index 7cc3e880ff..9c6836811f 100644 --- a/docs/clusterdefinition.md +++ b/docs/clusterdefinition.md @@ -41,6 +41,7 @@ Here are the valid values for the orchestrator types: |maxPods|no|The maximum number of pods per node. The minimum valid value, necessary for running kube-system pods, is 5. Default value is 30 when networkPolicy equals azure, 110 otherwise.| |gcHighThreshold|no|Sets the --image-gc-high-threshold value on the kublet configuration. Default is 85. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) | |gcLowThreshold|no|Sets the --image-gc-low-threshold value on the kublet configuration. Default is 80. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) | +|disabledAddons.dashboard|no|Disable dashboard addon (boolean - default == false, i.e. not disabled)| ### masterProfile `masterProfile` describes the settings for master configuration. diff --git a/examples/kubernetes-config/kubernetes-no-dashboard.json b/examples/kubernetes-config/kubernetes-no-dashboard.json new file mode 100644 index 0000000000..100d736fda --- /dev/null +++ b/examples/kubernetes-config/kubernetes-no-dashboard.json @@ -0,0 +1,40 @@ +{ + "apiVersion": "vlabs", + "properties": { + "orchestratorProfile": { + "orchestratorType": "Kubernetes", + "kubernetesConfig": { + "disabledAddons": { + "dashboard": true + } + } + }, + "masterProfile": { + "count": 1, + "dnsPrefix": "", + "vmSize": "Standard_D2_v2" + }, + "agentPoolProfiles": [ + { + "name": "agentpool1", + "count": 1, + "vmSize": "Standard_D2_v2", + "availabilityProfile": "AvailabilitySet" + } + ], + "linuxProfile": { + "adminUsername": "azureUser", + "ssh": { + "publicKeys": [ + { + "keyData": "" + } + ] + } + }, + "servicePrincipalProfile": { + "clientId": "", + "secret": "" + } + } +} diff --git a/examples/kubernetes-config/kubernetes-no-dashboard.json.env b/examples/kubernetes-config/kubernetes-no-dashboard.json.env new file mode 100644 index 0000000000..ada2f9672e --- /dev/null +++ b/examples/kubernetes-config/kubernetes-no-dashboard.json.env @@ -0,0 +1,2 @@ +EXPECTED_DASHBOARD=0 + diff --git a/parts/kubernetesmastercustomdata.yml b/parts/kubernetesmastercustomdata.yml index 4491fec1dd..14e16471e2 100644 --- a/parts/kubernetesmastercustomdata.yml +++ b/parts/kubernetesmastercustomdata.yml @@ -131,12 +131,14 @@ write_files: content: !!binary | MASTER_ADDON_KUBE_PROXY_DAEMONSET_B64_GZIP_STR +{{if not .OrchestratorProfile.KubernetesConfig.DisabledAddons.Dashboard}} - path: /etc/kubernetes/addons/kubernetes-dashboard-deployment.yaml permissions: "0644" encoding: gzip owner: "root" content: !!binary | MASTER_ADDON_KUBERNETES_DASHBOARD_DEPLOYMENT_B64_GZIP_STR +{{end}} - path: /etc/kubernetes/addons/kube-heapster-deployment.yaml permissions: "0644" @@ -273,7 +275,9 @@ write_files: sed -i "s||{{WrapAsVariable "kubernetesHyperkubeSpec"}}|g; s||{{WrapAsVariable "kubeClusterCidr"}}|g" "/etc/kubernetes/addons/kube-proxy-daemonset.yaml" sed -i "s||{{WrapAsVariable "kubernetesKubeDNSSpec"}}|g; s||{{WrapAsVariable "kubernetesDNSMasqSpec"}}|g; s||{{WrapAsVariable "kubernetesExecHealthzSpec"}}|g" "/etc/kubernetes/addons/kube-dns-deployment.yaml" sed -i "s||{{WrapAsVariable "kubernetesHeapsterSpec"}}|g; s||{{WrapAsVariable "kubernetesAddonResizerSpec"}}|g" "/etc/kubernetes/addons/kube-heapster-deployment.yaml" +{{if not .OrchestratorProfile.KubernetesConfig.DisabledAddons.Dashboard}} sed -i "s||{{WrapAsVariable "kubernetesDashboardSpec"}}|g" "/etc/kubernetes/addons/kubernetes-dashboard-deployment.yaml" +{{end}} sed -i "s||{{WrapAsVariable "kubernetesTillerSpec"}}|g" "/etc/kubernetes/addons/kube-tiller-deployment.yaml" sed -i "s||{{WrapAsVariable "kubernetesTillerCPURequests"}}|g" "/etc/kubernetes/addons/kube-tiller-deployment.yaml" sed -i "s||{{WrapAsVariable "kubernetesTillerMemoryRequests"}}|g" "/etc/kubernetes/addons/kube-tiller-deployment.yaml" diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index 37c19bd7d7..3a17519f3e 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -20,7 +20,6 @@ import ( //log "github.com/sirupsen/logrus" "github.com/Azure/acs-engine/pkg/api" - "github.com/Azure/acs-engine/pkg/api/common" "github.com/Azure/acs-engine/pkg/i18n" "github.com/Masterminds/semver" "github.com/ghodss/yaml" @@ -909,7 +908,7 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat // add artifacts and addons var artifiacts map[string]string - if profile.OrchestratorProfile.OrchestratorVersion == common.KubernetesVersion1Dot5Dot8 { + if strings.HasPrefix(profile.OrchestratorProfile.OrchestratorVersion, "1.5.") { artifiacts = kubernetesAritfacts15 } else { artifiacts = kubernetesAritfacts @@ -920,11 +919,14 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat } var addonYamls map[string]string - if profile.OrchestratorProfile.OrchestratorVersion == common.KubernetesVersion1Dot5Dot8 { + if strings.HasPrefix(profile.OrchestratorProfile.OrchestratorVersion, "1.5.") { addonYamls = kubernetesAddonYamls15 } else { addonYamls = kubernetesAddonYamls } + if profile.OrchestratorProfile.KubernetesConfig.DisabledAddons.Dashboard { + delete(addonYamls, "MASTER_ADDON_KUBERNETES_DASHBOARD_DEPLOYMENT_B64_GZIP_STR") + } for placeholder, filename := range addonYamls { addonTextContents := getBase64CustomScript(filename) str = strings.Replace(str, placeholder, addonTextContents, -1) @@ -932,8 +934,8 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat // add calico manifests if profile.OrchestratorProfile.KubernetesConfig.NetworkPolicy == "calico" { - if profile.OrchestratorProfile.OrchestratorVersion == common.KubernetesVersion1Dot5Dot8 || - profile.OrchestratorProfile.OrchestratorVersion == common.KubernetesVersion1Dot6Dot11 { + if strings.HasPrefix(profile.OrchestratorProfile.OrchestratorVersion, "1.5.") || + strings.HasPrefix(profile.OrchestratorProfile.OrchestratorVersion, "1.6.") { calicoAddonYamls = calicoAddonYamls15 } for placeholder, filename := range calicoAddonYamls { @@ -953,7 +955,7 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat // add artifacts var artifiacts map[string]string - if cs.Properties.OrchestratorProfile.OrchestratorVersion == common.KubernetesVersion1Dot5Dot8 { + if strings.HasPrefix(cs.Properties.OrchestratorProfile.OrchestratorVersion, "1.5.") { artifiacts = kubernetesAritfacts15 } else { artifiacts = kubernetesAritfacts diff --git a/pkg/api/converterfromapi.go b/pkg/api/converterfromapi.go index d04088c0b3..04f5517323 100644 --- a/pkg/api/converterfromapi.go +++ b/pkg/api/converterfromapi.go @@ -670,11 +670,16 @@ func convertKubernetesConfigToVLabs(api *KubernetesConfig, vlabs *vlabs.Kubernet vlabs.GCHighThreshold = api.GCHighThreshold vlabs.GCLowThreshold = api.GCLowThreshold vlabs.EtcdVersion = api.EtcdVersion + vlabs.EtcdDiskSizeGB = api.EtcdDiskSizeGB vlabs.TillerCPURequests = api.TillerCPURequests vlabs.TillerCPULimit = api.TillerCPULimit vlabs.TillerMemoryRequests = api.TillerMemoryRequests vlabs.TillerMemoryLimit = api.TillerMemoryLimit - vlabs.EtcdDiskSizeGB = api.EtcdDiskSizeGB + convertDisabledAddonsToVLabs(&api.DisabledAddons, &vlabs.DisabledAddons) +} + +func convertDisabledAddonsToVLabs(api *DisabledAddons, vlabs *vlabs.DisabledAddons) { + vlabs.Dashboard = api.Dashboard } func convertMasterProfileToV20160930(api *MasterProfile, v20160930 *v20160930.MasterProfile) { diff --git a/pkg/api/convertertoapi.go b/pkg/api/convertertoapi.go index e6a671c768..9d86b63ce1 100644 --- a/pkg/api/convertertoapi.go +++ b/pkg/api/convertertoapi.go @@ -612,11 +612,16 @@ func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *Kubernetes api.GCHighThreshold = vlabs.GCHighThreshold api.GCLowThreshold = vlabs.GCLowThreshold api.EtcdVersion = vlabs.EtcdVersion + api.EtcdDiskSizeGB = vlabs.EtcdDiskSizeGB api.TillerCPURequests = vlabs.TillerCPURequests api.TillerCPULimit = vlabs.TillerCPULimit api.TillerMemoryRequests = vlabs.TillerMemoryRequests api.TillerMemoryLimit = vlabs.TillerMemoryLimit - api.EtcdDiskSizeGB = vlabs.EtcdDiskSizeGB + convertVLabsDisabledAddons(&vlabs.DisabledAddons, &api.DisabledAddons) +} + +func convertVLabsDisabledAddons(vlabs *vlabs.DisabledAddons, api *DisabledAddons) { + api.Dashboard = vlabs.Dashboard } func convertV20160930MasterProfile(v20160930 *v20160930.MasterProfile, api *MasterProfile) { diff --git a/pkg/api/types.go b/pkg/api/types.go index 1a7a08011b..675f5098ba 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -156,42 +156,48 @@ type OrchestratorVersionProfile struct { Upgrades []*OrchestratorProfile `json:"upgrades,omitempty"` } +// DisabledAddons specifies which addons are disabled +type DisabledAddons struct { + Dashboard bool `json:"dashboard,omitempty"` +} + // KubernetesConfig contains the Kubernetes config structure, containing // Kubernetes specific configuration type KubernetesConfig struct { - KubernetesImageBase string `json:"kubernetesImageBase,omitempty"` - ClusterSubnet string `json:"clusterSubnet,omitempty"` - NonMasqueradeCidr string `json:"nonMasqueradeCidr,omitempty"` - NetworkPolicy string `json:"networkPolicy,omitempty"` - MaxPods int `json:"maxPods,omitempty"` - DockerBridgeSubnet string `json:"dockerBridgeSubnet,omitempty"` - DNSServiceIP string `json:"dnsServiceIP,omitempty"` - ServiceCIDR string `json:"serviceCidr,omitempty"` - NodeStatusUpdateFrequency string `json:"nodeStatusUpdateFrequency,omitempty"` - CtrlMgrNodeMonitorGracePeriod string `json:"ctrlMgrNodeMonitorGracePeriod,omitempty"` - CtrlMgrPodEvictionTimeout string `json:"ctrlMgrPodEvictionTimeout,omitempty"` - CtrlMgrRouteReconciliationPeriod string `json:"ctrlMgrRouteReconciliationPeriod,omitempty"` - CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty"` - CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty"` - CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty"` - CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty"` - CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty"` - CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty"` - CloudProviderRateLimitQPS float64 `json:"cloudProviderRateLimitQPS,omitempty"` - CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"` - UseManagedIdentity bool `json:"useManagedIdentity,omitempty"` - CustomHyperkubeImage string `json:"customHyperkubeImage,omitempty"` - UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty"` - EnableRbac bool `json:"enableRbac,omitempty"` - EnableAggregatedAPIs bool `json:"enableAggregatedAPIs,omitempty"` - GCHighThreshold int `json:"gchighthreshold,omitempty"` - GCLowThreshold int `json:"gclowthreshold,omitempty"` - EtcdVersion string `json:"etcdVersion,omitempty"` - TillerCPURequests string `json:"tillerCPURequests,omitempty"` - TillerCPULimit string `json:"tillerCPULimit,omitempty"` - TillerMemoryRequests string `json:"tillerMemoryRequests,omitempty"` - TillerMemoryLimit string `json:"tillerMemoryLimit,omitempty"` - EtcdDiskSizeGB string `json:"etcdDiskSizeGB,omitempty"` + KubernetesImageBase string `json:"kubernetesImageBase,omitempty"` + ClusterSubnet string `json:"clusterSubnet,omitempty"` + NonMasqueradeCidr string `json:"nonMasqueradeCidr,omitempty"` + NetworkPolicy string `json:"networkPolicy,omitempty"` + MaxPods int `json:"maxPods,omitempty"` + DockerBridgeSubnet string `json:"dockerBridgeSubnet,omitempty"` + DNSServiceIP string `json:"dnsServiceIP,omitempty"` + ServiceCIDR string `json:"serviceCidr,omitempty"` + NodeStatusUpdateFrequency string `json:"nodeStatusUpdateFrequency,omitempty"` + CtrlMgrNodeMonitorGracePeriod string `json:"ctrlMgrNodeMonitorGracePeriod,omitempty"` + CtrlMgrPodEvictionTimeout string `json:"ctrlMgrPodEvictionTimeout,omitempty"` + CtrlMgrRouteReconciliationPeriod string `json:"ctrlMgrRouteReconciliationPeriod,omitempty"` + CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty"` + CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty"` + CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty"` + CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty"` + CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty"` + CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty"` + CloudProviderRateLimitQPS float64 `json:"cloudProviderRateLimitQPS,omitempty"` + CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"` + UseManagedIdentity bool `json:"useManagedIdentity,omitempty"` + CustomHyperkubeImage string `json:"customHyperkubeImage,omitempty"` + UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty"` + EnableRbac bool `json:"enableRbac,omitempty"` + EnableAggregatedAPIs bool `json:"enableAggregatedAPIs,omitempty"` + GCHighThreshold int `json:"gchighthreshold,omitempty"` + GCLowThreshold int `json:"gclowthreshold,omitempty"` + EtcdVersion string `json:"etcdVersion,omitempty"` + EtcdDiskSizeGB string `json:"etcdDiskSizeGB,omitempty"` + TillerCPURequests string `json:"tillerCPURequests,omitempty"` + TillerCPULimit string `json:"tillerCPULimit,omitempty"` + TillerMemoryRequests string `json:"tillerMemoryRequests,omitempty"` + TillerMemoryLimit string `json:"tillerMemoryLimit,omitempty"` + DisabledAddons DisabledAddons `json:"disabledAddons,omitempty"` } // DcosConfig Configuration for DC/OS diff --git a/pkg/api/vlabs/types.go b/pkg/api/vlabs/types.go index 9e0d4db5e8..958035498e 100644 --- a/pkg/api/vlabs/types.go +++ b/pkg/api/vlabs/types.go @@ -174,42 +174,48 @@ func (o *OrchestratorProfile) UnmarshalJSON(b []byte) error { return nil } +// DisabledAddons specifies which addons are disabled +type DisabledAddons struct { + Dashboard bool `json:"dashboard,omitempty"` +} + // KubernetesConfig contains the Kubernetes config structure, containing // Kubernetes specific configuration type KubernetesConfig struct { - KubernetesImageBase string `json:"kubernetesImageBase,omitempty"` - ClusterSubnet string `json:"clusterSubnet,omitempty"` - DNSServiceIP string `json:"dnsServiceIP,omitempty"` - ServiceCidr string `json:"serviceCidr,omitempty"` - NetworkPolicy string `json:"networkPolicy,omitempty"` - NonMasqueradeCidr string `json:"nonMasqueradeCidr,omitempty"` - MaxPods int `json:"maxPods,omitempty"` - DockerBridgeSubnet string `json:"dockerBridgeSubnet,omitempty"` - NodeStatusUpdateFrequency string `json:"nodeStatusUpdateFrequency,omitempty"` - CtrlMgrNodeMonitorGracePeriod string `json:"ctrlMgrNodeMonitorGracePeriod,omitempty"` - CtrlMgrPodEvictionTimeout string `json:"ctrlMgrPodEvictionTimeout,omitempty"` - CtrlMgrRouteReconciliationPeriod string `json:"ctrlMgrRouteReconciliationPeriod,omitempty"` - CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty"` - CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty"` - CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty"` - CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty"` - CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty"` - CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty"` - CloudProviderRateLimitQPS float64 `json:"cloudProviderRateLimitQPS,omitempty"` - CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"` - UseManagedIdentity bool `json:"useManagedIdentity,omitempty"` - CustomHyperkubeImage string `json:"customHyperkubeImage,omitempty"` - UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty"` - EnableRbac bool `json:"enableRbac,omitempty"` - EnableAggregatedAPIs bool `json:"enableAggregatedAPIs,omitempty"` - GCHighThreshold int `json:"gchighthreshold,omitempty"` - GCLowThreshold int `json:"gclowthreshold,omitempty"` - EtcdVersion string `json:"etcdVersion,omitempty"` - TillerCPURequests string `json:"tillerCPURequests,omitempty"` - TillerCPULimit string `json:"tillerCPULimit,omitempty"` - TillerMemoryRequests string `json:"tillerMemoryRequests,omitempty"` - TillerMemoryLimit string `json:"tillerMemoryLimit,omitempty"` - EtcdDiskSizeGB string `json:"etcdDiskSizeGB,omitempty"` + KubernetesImageBase string `json:"kubernetesImageBase,omitempty"` + ClusterSubnet string `json:"clusterSubnet,omitempty"` + DNSServiceIP string `json:"dnsServiceIP,omitempty"` + ServiceCidr string `json:"serviceCidr,omitempty"` + NetworkPolicy string `json:"networkPolicy,omitempty"` + NonMasqueradeCidr string `json:"nonMasqueradeCidr,omitempty"` + MaxPods int `json:"maxPods,omitempty"` + DockerBridgeSubnet string `json:"dockerBridgeSubnet,omitempty"` + NodeStatusUpdateFrequency string `json:"nodeStatusUpdateFrequency,omitempty"` + CtrlMgrNodeMonitorGracePeriod string `json:"ctrlMgrNodeMonitorGracePeriod,omitempty"` + CtrlMgrPodEvictionTimeout string `json:"ctrlMgrPodEvictionTimeout,omitempty"` + CtrlMgrRouteReconciliationPeriod string `json:"ctrlMgrRouteReconciliationPeriod,omitempty"` + CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty"` + CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty"` + CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty"` + CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty"` + CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty"` + CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty"` + CloudProviderRateLimitQPS float64 `json:"cloudProviderRateLimitQPS,omitempty"` + CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"` + UseManagedIdentity bool `json:"useManagedIdentity,omitempty"` + CustomHyperkubeImage string `json:"customHyperkubeImage,omitempty"` + UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty"` + EnableRbac bool `json:"enableRbac,omitempty"` + EnableAggregatedAPIs bool `json:"enableAggregatedAPIs,omitempty"` + GCHighThreshold int `json:"gchighthreshold,omitempty"` + GCLowThreshold int `json:"gclowthreshold,omitempty"` + EtcdVersion string `json:"etcdVersion,omitempty"` + EtcdDiskSizeGB string `json:"etcdDiskSizeGB,omitempty"` + TillerCPURequests string `json:"tillerCPURequests,omitempty"` + TillerCPULimit string `json:"tillerCPULimit,omitempty"` + TillerMemoryRequests string `json:"tillerMemoryRequests,omitempty"` + TillerMemoryLimit string `json:"tillerMemoryLimit,omitempty"` + DisabledAddons DisabledAddons `json:"disabledAddons,omitempty"` } // DcosConfig Configuration for DC/OS diff --git a/test/acse-conf/acse-regression.json b/test/acse-conf/acse-regression.json index 62eca94b76..3f76898a27 100644 --- a/test/acse-conf/acse-regression.json +++ b/test/acse-conf/acse-regression.json @@ -73,6 +73,10 @@ "cluster_definition": "kubernetes-config/kubernetes-clustersubnet.json", "category": "network" }, + { + "cluster_definition": "kubernetes-config/kubernetes-no-dashboard.json", + "category": "config" + }, { "cluster_definition": "v20170131/swarmmode.json", "category": "version" diff --git a/test/cluster-tests/kubernetes/test.sh b/test/cluster-tests/kubernetes/test.sh index f4f88c50c6..e6fe85a577 100755 --- a/test/cluster-tests/kubernetes/test.sh +++ b/test/cluster-tests/kubernetes/test.sh @@ -101,7 +101,7 @@ fi ###### Check existence and status of essential pods -# we test other essential pods (kube-dns, kube-proxy, kubernetes-dashboard) separately +# we test other essential pods (kube-dns, kube-proxy) separately pods="heapster kube-addon-manager kube-apiserver kube-controller-manager kube-scheduler tiller" log "Checking $pods" @@ -138,16 +138,20 @@ if (( ${running} != ${EXPECTED_DNS} )); then fi ###### Check for Kube-Dashboard -log "Checking Kube-Dashboard" -count=60 -while (( $count > 0 )); do - log " ... counting down $count" - running=$(kubectl get pods --namespace=kube-system | grep kubernetes-dashboard | grep Running | wc | awk '{print $1}') - if (( ${running} == ${EXPECTED_DASHBOARD} )); then break; fi - sleep 5; count=$((count-1)) -done -if (( ${running} != ${EXPECTED_DASHBOARD} )); then - log "K8S: gave up waiting for kubernetes-dashboard"; exit 1 +if (( ${EXPECTED_DASHBOARD} != 0 )); then + log "Checking Kube-Dashboard" + count=60 + while (( $count > 0 )); do + log " ... counting down $count" + running=$(kubectl get pods --namespace=kube-system | grep kubernetes-dashboard | grep Running | wc | awk '{print $1}') + if (( ${running} == ${EXPECTED_DASHBOARD} )); then break; fi + sleep 5; count=$((count-1)) + done + if (( ${running} != ${EXPECTED_DASHBOARD} )); then + log "K8S: gave up waiting for kubernetes-dashboard"; exit 1 + fi +else + log "Expecting no dashboard" fi ###### Check for Kube-Proxys @@ -163,30 +167,32 @@ if (( ${running} != ${KUBE_PROXY_COUNT} )); then log "K8S: gave up waiting for kube-proxy"; exit 1 fi -# get master public hostname -master=$(kubectl config view | grep server | cut -f 3- -d "/" | tr -d " ") -# get dashboard port -port=$(kubectl get svc --namespace=kube-system | grep dashboard | awk '{print $4}' | sed -n 's/^80:\(.*\)\/TCP$/\1/p') -# get internal IPs of the nodes -ips=$(kubectl get nodes --all-namespaces -o yaml | grep -B 1 InternalIP | grep address | awk '{print $3}') - -for ip in $ips; do - log "Probing IP address ${ip}" - count=60 - success="n" - while (( $count > 0 )); do - log " ... counting down $count" - ret=$(ssh -i "${OUTPUT}/id_rsa" -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "azureuser@${master}" "curl --max-time 60 http://${ip}:${port}" || echo "curl_error") - if [[ ! $ret =~ .*curl_error.* ]]; then - success="y" - break +if (( ${EXPECTED_DASHBOARD} != 0 )); then + # get master public hostname + master=$(kubectl config view | grep server | cut -f 3- -d "/" | tr -d " ") + # get dashboard port + port=$(kubectl get svc --namespace=kube-system | grep dashboard | awk '{print $4}' | sed -n 's/^80:\(.*\)\/TCP$/\1/p') + # get internal IPs of the nodes + ips=$(kubectl get nodes --all-namespaces -o yaml | grep -B 1 InternalIP | grep address | awk '{print $3}') + + for ip in $ips; do + log "Probing IP address ${ip}" + count=60 + success="n" + while (( $count > 0 )); do + log " ... counting down $count" + ret=$(ssh -i "${OUTPUT}/id_rsa" -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "azureuser@${master}" "curl --max-time 60 http://${ip}:${port}" || echo "curl_error") + if [[ ! $ret =~ .*curl_error.* ]]; then + success="y" + break + fi + sleep 5; count=$((count-1)) + done + if [[ "${success}" == "n" ]]; then + log "K8S: gave up verifying proxy"; exit 1 fi - sleep 5; count=$((count-1)) done - if [[ "${success}" == "n" ]]; then - log "K8S: gave up verifying proxy"; exit 1 - fi -done +fi if [ $EXPECTED_LINUX_AGENTS -gt 0 ] ; then test_linux_deployment