From 8905542ebb1fc29315cd39479776e4a8135ef311 Mon Sep 17 00:00:00 2001 From: Dmitry Shmulevich Date: Fri, 10 Nov 2017 12:41:25 -0800 Subject: [PATCH 1/6] initial commit --- parts/kubernetesmastercustomdata.yml | 4 ++ pkg/acsengine/defaults.go | 2 +- pkg/acsengine/engine.go | 1 + pkg/api/converterfromapi.go | 4 ++ pkg/api/convertertoapi.go | 5 ++ pkg/api/types.go | 70 +++++++++++++++------------- pkg/api/vlabs/types.go | 70 +++++++++++++++------------- 7 files changed, 91 insertions(+), 65 deletions(-) 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/defaults.go b/pkg/acsengine/defaults.go index 789d172994..e853b8a075 100644 --- a/pkg/acsengine/defaults.go +++ b/pkg/acsengine/defaults.go @@ -187,7 +187,7 @@ func setOrchestratorDefaults(cs *api.ContainerService) { o.OrchestratorVersion) if o.OrchestratorType == api.Kubernetes { k8sVersion := o.OrchestratorVersion - + fmt.Printf("-->%v\n", o.KubernetesConfig.DisabledAddons) if o.KubernetesConfig == nil { o.KubernetesConfig = &api.KubernetesConfig{} } diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index 576e7a40e5..bf81a9d9cf 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -925,6 +925,7 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat addonYamls = kubernetesAddonYamls } for placeholder, filename := range addonYamls { + fmt.Printf("Adding %s\n", filename) addonTextContents := getBase64CustomScript(filename) str = strings.Replace(str, placeholder, addonTextContents, -1) } diff --git a/pkg/api/converterfromapi.go b/pkg/api/converterfromapi.go index e632ebaa42..4d631e8127 100644 --- a/pkg/api/converterfromapi.go +++ b/pkg/api/converterfromapi.go @@ -676,6 +676,10 @@ func convertKubernetesConfigToVLabs(api *KubernetesConfig, vlabs *vlabs.Kubernet vlabs.TillerMemoryLimit = api.TillerMemoryLimit } +func convertDisabledAddonsToVLabs(api *DisabledAddons, vlabs *vlabs.DisabledAddons) { + vlabs.Dashboard = api.Dashboard +} + func convertMasterProfileToV20160930(api *MasterProfile, v20160930 *v20160930.MasterProfile) { v20160930.Count = api.Count v20160930.DNSPrefix = api.DNSPrefix diff --git a/pkg/api/convertertoapi.go b/pkg/api/convertertoapi.go index 78bae36e17..dc5d20b4a1 100644 --- a/pkg/api/convertertoapi.go +++ b/pkg/api/convertertoapi.go @@ -616,6 +616,11 @@ func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *Kubernetes api.TillerCPULimit = vlabs.TillerCPULimit api.TillerMemoryRequests = vlabs.TillerMemoryRequests api.TillerMemoryLimit = vlabs.TillerMemoryLimit + 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 4e004c007e..6c819025e1 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -156,41 +156,47 @@ 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"` + 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"` + 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 8393175d0f..eebc385c60 100644 --- a/pkg/api/vlabs/types.go +++ b/pkg/api/vlabs/types.go @@ -174,41 +174,47 @@ 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"` + 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"` + DisabledAddons DisabledAddons `json:"disabledAddons,omitempty"` } // DcosConfig Configuration for DC/OS From 3b5491856744062a975dbf23c4c2757172e3b51f Mon Sep 17 00:00:00 2001 From: Dmitry Shmulevich Date: Fri, 10 Nov 2017 13:20:03 -0800 Subject: [PATCH 2/6] next --- pkg/acsengine/defaults.go | 2 +- pkg/acsengine/engine.go | 5 ++++- pkg/api/converterfromapi.go | 3 +++ pkg/api/convertertoapi.go | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/acsengine/defaults.go b/pkg/acsengine/defaults.go index e853b8a075..8450bd9f08 100644 --- a/pkg/acsengine/defaults.go +++ b/pkg/acsengine/defaults.go @@ -187,7 +187,7 @@ func setOrchestratorDefaults(cs *api.ContainerService) { o.OrchestratorVersion) if o.OrchestratorType == api.Kubernetes { k8sVersion := o.OrchestratorVersion - fmt.Printf("-->%v\n", o.KubernetesConfig.DisabledAddons) + fmt.Printf("setOrchestratorDefaults --> %+v\n", o.KubernetesConfig.DisabledAddons) if o.KubernetesConfig == nil { o.KubernetesConfig = &api.KubernetesConfig{} } diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index bf81a9d9cf..0174b177f9 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -238,7 +238,7 @@ func (t *TemplateGenerator) GenerateTemplate(containerService *api.ContainerServ templateRaw = "" parametersRaw = "" err = nil - + fmt.Println("-> in GenerateTemplate") var templ *template.Template properties := containerService.Properties @@ -924,6 +924,9 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat } else { addonYamls = kubernetesAddonYamls } + if profile.OrchestratorProfile.KubernetesConfig.DisabledAddons.Dashboard { + delete(addonYamls, "MASTER_ADDON_KUBERNETES_DASHBOARD_DEPLOYMENT_B64_GZIP_STR") + } for placeholder, filename := range addonYamls { fmt.Printf("Adding %s\n", filename) addonTextContents := getBase64CustomScript(filename) diff --git a/pkg/api/converterfromapi.go b/pkg/api/converterfromapi.go index 4d631e8127..0c5a8fa6a2 100644 --- a/pkg/api/converterfromapi.go +++ b/pkg/api/converterfromapi.go @@ -674,6 +674,9 @@ func convertKubernetesConfigToVLabs(api *KubernetesConfig, vlabs *vlabs.Kubernet vlabs.TillerCPULimit = api.TillerCPULimit vlabs.TillerMemoryRequests = api.TillerMemoryRequests vlabs.TillerMemoryLimit = api.TillerMemoryLimit + convertDisabledAddonsToVLabs(&api.DisabledAddons, &vlabs.DisabledAddons) + fmt.Printf("convertKubernetesConfigToVLabs: %+v\n", vlabs.DisabledAddons) + } func convertDisabledAddonsToVLabs(api *DisabledAddons, vlabs *vlabs.DisabledAddons) { diff --git a/pkg/api/convertertoapi.go b/pkg/api/convertertoapi.go index dc5d20b4a1..866563d0a2 100644 --- a/pkg/api/convertertoapi.go +++ b/pkg/api/convertertoapi.go @@ -1,6 +1,7 @@ package api import ( + "fmt" "strings" "github.com/Azure/acs-engine/pkg/api/common" @@ -617,6 +618,7 @@ func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *Kubernetes api.TillerMemoryRequests = vlabs.TillerMemoryRequests api.TillerMemoryLimit = vlabs.TillerMemoryLimit convertVLabsDisabledAddons(&vlabs.DisabledAddons, &api.DisabledAddons) + fmt.Printf("convertVLabsKubernetesConfig: %+v\n", api.DisabledAddons) } func convertVLabsDisabledAddons(vlabs *vlabs.DisabledAddons, api *DisabledAddons) { From 2e65ccfe439572d50254931fd755c0bceff9fdfb Mon Sep 17 00:00:00 2001 From: Dmitry Shmulevich Date: Fri, 10 Nov 2017 14:44:04 -0800 Subject: [PATCH 3/6] added example for deployment without dashboard --- .../kubernetes-no-dashboard.json | 40 +++++++++++++++++++ pkg/acsengine/defaults.go | 2 +- pkg/acsengine/engine.go | 3 +- pkg/api/converterfromapi.go | 2 - pkg/api/convertertoapi.go | 2 - 5 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 examples/kubernetes-config/kubernetes-no-dashboard.json 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/pkg/acsengine/defaults.go b/pkg/acsengine/defaults.go index 8450bd9f08..789d172994 100644 --- a/pkg/acsengine/defaults.go +++ b/pkg/acsengine/defaults.go @@ -187,7 +187,7 @@ func setOrchestratorDefaults(cs *api.ContainerService) { o.OrchestratorVersion) if o.OrchestratorType == api.Kubernetes { k8sVersion := o.OrchestratorVersion - fmt.Printf("setOrchestratorDefaults --> %+v\n", o.KubernetesConfig.DisabledAddons) + if o.KubernetesConfig == nil { o.KubernetesConfig = &api.KubernetesConfig{} } diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index 0174b177f9..96eb6ea2c1 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -238,7 +238,7 @@ func (t *TemplateGenerator) GenerateTemplate(containerService *api.ContainerServ templateRaw = "" parametersRaw = "" err = nil - fmt.Println("-> in GenerateTemplate") + var templ *template.Template properties := containerService.Properties @@ -928,7 +928,6 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat delete(addonYamls, "MASTER_ADDON_KUBERNETES_DASHBOARD_DEPLOYMENT_B64_GZIP_STR") } for placeholder, filename := range addonYamls { - fmt.Printf("Adding %s\n", filename) addonTextContents := getBase64CustomScript(filename) str = strings.Replace(str, placeholder, addonTextContents, -1) } diff --git a/pkg/api/converterfromapi.go b/pkg/api/converterfromapi.go index 0c5a8fa6a2..f12178f6d8 100644 --- a/pkg/api/converterfromapi.go +++ b/pkg/api/converterfromapi.go @@ -675,8 +675,6 @@ func convertKubernetesConfigToVLabs(api *KubernetesConfig, vlabs *vlabs.Kubernet vlabs.TillerMemoryRequests = api.TillerMemoryRequests vlabs.TillerMemoryLimit = api.TillerMemoryLimit convertDisabledAddonsToVLabs(&api.DisabledAddons, &vlabs.DisabledAddons) - fmt.Printf("convertKubernetesConfigToVLabs: %+v\n", vlabs.DisabledAddons) - } func convertDisabledAddonsToVLabs(api *DisabledAddons, vlabs *vlabs.DisabledAddons) { diff --git a/pkg/api/convertertoapi.go b/pkg/api/convertertoapi.go index 866563d0a2..dc5d20b4a1 100644 --- a/pkg/api/convertertoapi.go +++ b/pkg/api/convertertoapi.go @@ -1,7 +1,6 @@ package api import ( - "fmt" "strings" "github.com/Azure/acs-engine/pkg/api/common" @@ -618,7 +617,6 @@ func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *Kubernetes api.TillerMemoryRequests = vlabs.TillerMemoryRequests api.TillerMemoryLimit = vlabs.TillerMemoryLimit convertVLabsDisabledAddons(&vlabs.DisabledAddons, &api.DisabledAddons) - fmt.Printf("convertVLabsKubernetesConfig: %+v\n", api.DisabledAddons) } func convertVLabsDisabledAddons(vlabs *vlabs.DisabledAddons, api *DisabledAddons) { From 15c2ccc68d2fc7f77a87934c88c2caa5c80cf9d5 Mon Sep 17 00:00:00 2001 From: Dmitry Shmulevich Date: Fri, 10 Nov 2017 15:25:03 -0800 Subject: [PATCH 4/6] added check for no dashboard in validation; update doc --- docs/clusterdefinition.md | 1 + .../kubernetes-no-dashboard.json.env | 2 ++ pkg/acsengine/engine.go | 11 ++++---- test/cluster-tests/kubernetes/test.sh | 26 +++++++++++-------- 4 files changed, 23 insertions(+), 17 deletions(-) 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.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/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index 96eb6ea2c1..5b7c7c4fae 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" @@ -908,7 +907,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 @@ -919,7 +918,7 @@ 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 @@ -934,8 +933,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 { @@ -955,7 +954,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/test/cluster-tests/kubernetes/test.sh b/test/cluster-tests/kubernetes/test.sh index f4f88c50c6..784cbee556 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 From b9118a7183edd2d9a3b10b6d1780c26960d7bd8c Mon Sep 17 00:00:00 2001 From: Dmitry Shmulevich Date: Fri, 10 Nov 2017 15:59:55 -0800 Subject: [PATCH 5/6] fix test --- test/cluster-tests/kubernetes/test.sh | 46 ++++++++++++++------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/test/cluster-tests/kubernetes/test.sh b/test/cluster-tests/kubernetes/test.sh index 784cbee556..e6fe85a577 100755 --- a/test/cluster-tests/kubernetes/test.sh +++ b/test/cluster-tests/kubernetes/test.sh @@ -167,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 From 1a761528dbdea9a7c54d4af74f9dea9ba662c237 Mon Sep 17 00:00:00 2001 From: Jack Francis Date: Sun, 12 Nov 2017 12:41:01 -0800 Subject: [PATCH 6/6] added to regression set --- test/acse-conf/acse-regression.json | 4 ++++ 1 file changed, 4 insertions(+) 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"