From 234cf4cc28e3ceb58a7baea467e4c547a2e5e3d8 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Tue, 15 May 2018 14:24:04 -0400 Subject: [PATCH] remove docker from provisioning install Signed-off-by: Jess Frazelle --- parts/k8s/kubernetesagentcustomdata.yml | 5 +++++ parts/k8s/kubernetesmastercustomdata.yml | 5 +++++ pkg/api/types.go | 10 ++++++++++ pkg/api/vlabs/types.go | 10 ++++++++++ 4 files changed, 30 insertions(+) diff --git a/parts/k8s/kubernetesagentcustomdata.yml b/parts/k8s/kubernetesagentcustomdata.yml index 03b779854a..c2011e5a68 100644 --- a/parts/k8s/kubernetesagentcustomdata.yml +++ b/parts/k8s/kubernetesagentcustomdata.yml @@ -8,6 +8,7 @@ write_files: content: !!binary | {{WrapAsVariable "provisionSource"}} +{{if .RequiresDocker}} {{if not .IsCoreOS}} - path: "/etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf" permissions: "0644" @@ -36,6 +37,7 @@ write_files: "max-file": "5" } } +{{end}} - path: "/etc/kubernetes/certs/ca.crt" permissions: "0644" @@ -117,7 +119,10 @@ AGENT_ARTIFACTS_CONFIG_PLACEHOLDER content: | #!/bin/bash /usr/bin/mkdir -p /etc/kubernetes/manifests + + {{if .RequiresDocker}} usermod -aG docker {{WrapAsVariable "username"}} + {{end}} systemctl enable rpcbind systemctl enable rpc-statd diff --git a/parts/k8s/kubernetesmastercustomdata.yml b/parts/k8s/kubernetesmastercustomdata.yml index 05d65d2291..0b0a70fd67 100644 --- a/parts/k8s/kubernetesmastercustomdata.yml +++ b/parts/k8s/kubernetesmastercustomdata.yml @@ -14,6 +14,7 @@ write_files: content: !!binary | {{WrapAsVariable "provisionSource"}} +{{if .OrchestratorProfile.KubernetesConfig.RequiresDocker}} {{if not .MasterProfile.IsCoreOS}} - path: "/etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf" permissions: "0644" @@ -46,6 +47,7 @@ write_files: "max-file": "5" } } +{{end}} - path: "/etc/kubernetes/certs/ca.crt" permissions: "0644" @@ -351,7 +353,10 @@ MASTER_ARTIFACTS_CONFIG_PLACEHOLDER systemctl restart etcd-member retrycmd_if_failure 5 5 10 curl --retry 5 --retry-delay 10 --retry-max-time 10 --max-time 60 http://127.0.0.1:2379/v2/machines mkdir -p /etc/kubernetes/manifests + + {{if .OrchestratorProfile.KubernetesConfig.RequiresDocker}} usermod -aG docker {{WrapAsVariable "username"}} + {{end}} {{if EnableAggregatedAPIs}} sudo bash /etc/kubernetes/generate-proxy-certs.sh diff --git a/pkg/api/types.go b/pkg/api/types.go index 96ab750156..ded71a2f14 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -737,6 +737,11 @@ func (a *AgentPoolProfile) HasDisks() bool { return len(a.DiskSizesGB) > 0 } +// RequiresDocker returns if the kubernetes settings require docker to be installed. +func (a *AgentPoolProfile) RequiresDocker() bool { + return a.KubernetesConfig.ContainerRuntime == "docker" +} + // HasSecrets returns true if the customer specified secrets to install func (w *WindowsProfile) HasSecrets() bool { return len(w.Secrets) > 0 @@ -885,3 +890,8 @@ func (k *KubernetesConfig) PrivateJumpboxProvision() bool { } return false } + +// RequiresDocker returns if the kubernetes settings require docker to be installed. +func (k *KubernetesConfig) RequiresDocker() bool { + return k.ContainerRuntime == "docker" +} diff --git a/pkg/api/vlabs/types.go b/pkg/api/vlabs/types.go index 19cc93c05b..48ed67dd6f 100644 --- a/pkg/api/vlabs/types.go +++ b/pkg/api/vlabs/types.go @@ -579,7 +579,17 @@ func (a *AgentPoolProfile) SetSubnet(subnet string) { a.subnet = subnet } +// RequiresDocker returns if the kubernetes settings require docker to be installed. +func (a *AgentPoolProfile) RequiresDocker() bool { + return a.KubernetesConfig.ContainerRuntime == "docker" +} + // IsSwarmMode returns true if this template is for Swarm Mode orchestrator func (o *OrchestratorProfile) IsSwarmMode() bool { return o.OrchestratorType == SwarmMode } + +// RequiresDocker returns if the kubernetes settings require docker to be installed. +func (k *KubernetesConfig) RequiresDocker() bool { + return k.ContainerRuntime == "docker" +}