Merge pull request #6957 from austinmoore-/skip-docker-install

Skip Docker install
This commit is contained in:
Kubernetes Prow Robot 2019-09-18 14:55:00 -07:00 committed by GitHub
commit 30c6f65300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 81 additions and 1 deletions

View File

@ -733,6 +733,18 @@ spec:
- https://registry.example.com
```
#### Skip Install
If you want nodeup to skip the Docker installation tasks, you can do so with:
```yaml
spec:
docker:
skipInstall: true
```
**NOTE:** When this field is set to `true`, it is entirely up to the user to install and configure Docker.
#### storage
The Docker [Storage Driver](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-storage-driver) can be specified in order to override the default. Be sure the driver you choose is supported by your operating system and docker version.

View File

@ -826,6 +826,10 @@ func (b *DockerBuilder) dockerVersion() string {
// Build is responsible for configuring the docker daemon
func (b *DockerBuilder) Build(c *fi.ModelBuilderContext) error {
if b.skipInstall() {
klog.Infof("SkipInstall is set to true; won't install Docker")
return nil
}
// @check: neither coreos or containeros need provision docker.service, just the docker daemon options
switch b.Distribution {
@ -1188,3 +1192,15 @@ func (b *DockerBuilder) buildSysconfig(c *fi.ModelBuilderContext) error {
return nil
}
// skipInstall determines if kops should skip the installation and configuration of Docker
func (b *DockerBuilder) skipInstall() bool {
d := b.Cluster.Spec.Docker
// don't skip install if the user hasn't specified anything
if d == nil {
return false
}
return d.SkipInstall
}

View File

@ -126,6 +126,10 @@ func TestDockerBuilder_LogFlags(t *testing.T) {
runDockerBuilderTest(t, "logflags")
}
func TestDockerBuilder_SkipInstall(t *testing.T) {
runDockerBuilderTest(t, "skipinstall")
}
func TestDockerBuilder_BuildFlags(t *testing.T) {
logDriver := "json-file"
grid := []struct {

View File

@ -0,0 +1,39 @@
apiVersion: kops/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2016-12-10T22:42:27Z"
name: minimal.example.com
spec:
kubernetesApiAccess:
- 0.0.0.0/0
channel: stable
cloudProvider: aws
configBase: memfs://clusters.example.com/minimal.example.com
docker:
skipInstall: true
etcdClusters:
- etcdMembers:
- instanceGroup: master-us-test-1a
name: master-us-test-1a
name: main
- etcdMembers:
- instanceGroup: master-us-test-1a
name: master-us-test-1a
name: events
kubernetesVersion: v1.4.6
masterInternalName: api.internal.minimal.example.com
masterPublicName: api.minimal.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
topology:
masters: public
nodes: public
subnets:
- cidr: 172.20.32.0/19
name: us-test-1a
type: Public
zone: us-test-1a

View File

@ -58,6 +58,8 @@ type DockerConfig struct {
MTU *int32 `json:"mtu,omitempty" flag:"mtu"`
// RegistryMirrors is a referred list of docker registry mirror
RegistryMirrors []string `json:"registryMirrors,omitempty" flag:"registry-mirror,repeat"`
// SkipInstall when set to true will prevent kops from installing and modifying Docker in any way
SkipInstall bool `json:"skipInstall,omitempty"`
// Storage is the docker storage driver to use
Storage *string `json:"storage,omitempty" flag:"storage-driver"`
// StorageOpts is a series of options passed to the storage driver

View File

@ -58,6 +58,8 @@ type DockerConfig struct {
MTU *int32 `json:"mtu,omitempty" flag:"mtu"`
// RegistryMirrors is a referred list of docker registry mirror
RegistryMirrors []string `json:"registryMirrors,omitempty" flag:"registry-mirror,repeat"`
// SkipInstall when set to true will prevent kops from installing and modifying Docker in any way
SkipInstall bool `json:"skipInstall,omitempty"`
// Storage is the docker storage driver to use
Storage *string `json:"storage,omitempty" flag:"storage-driver"`
// StorageOpts is a series of options passed to the storage driver

View File

@ -2138,6 +2138,7 @@ func autoConvert_v1alpha1_DockerConfig_To_kops_DockerConfig(in *DockerConfig, ou
out.MetricsAddress = in.MetricsAddress
out.MTU = in.MTU
out.RegistryMirrors = in.RegistryMirrors
out.SkipInstall = in.SkipInstall
out.Storage = in.Storage
out.StorageOpts = in.StorageOpts
out.UserNamespaceRemap = in.UserNamespaceRemap
@ -2171,6 +2172,7 @@ func autoConvert_kops_DockerConfig_To_v1alpha1_DockerConfig(in *kops.DockerConfi
out.MetricsAddress = in.MetricsAddress
out.MTU = in.MTU
out.RegistryMirrors = in.RegistryMirrors
out.SkipInstall = in.SkipInstall
out.Storage = in.Storage
out.StorageOpts = in.StorageOpts
out.UserNamespaceRemap = in.UserNamespaceRemap

View File

@ -134,7 +134,6 @@ type ClusterSpec struct {
FileAssets []FileAssetSpec `json:"fileAssets,omitempty"`
// EtcdClusters stores the configuration for each cluster
EtcdClusters []*EtcdClusterSpec `json:"etcdClusters,omitempty"`
// Component configurations
Docker *DockerConfig `json:"docker,omitempty"`
KubeDNS *KubeDNSConfig `json:"kubeDNS,omitempty"`

View File

@ -58,6 +58,8 @@ type DockerConfig struct {
MTU *int32 `json:"mtu,omitempty" flag:"mtu"`
// RegistryMirrors is a referred list of docker registry mirror
RegistryMirrors []string `json:"registryMirrors,omitempty" flag:"registry-mirror,repeat"`
// SkipInstall when set to true will prevent kops from installing and modifying Docker in any way
SkipInstall bool `json:"skipInstall,omitempty"`
// Storage is the docker storage driver to use
Storage *string `json:"storage,omitempty" flag:"storage-driver"`
// StorageOpts is a series of options passed to the storage driver

View File

@ -2245,6 +2245,7 @@ func autoConvert_v1alpha2_DockerConfig_To_kops_DockerConfig(in *DockerConfig, ou
out.MetricsAddress = in.MetricsAddress
out.MTU = in.MTU
out.RegistryMirrors = in.RegistryMirrors
out.SkipInstall = in.SkipInstall
out.Storage = in.Storage
out.StorageOpts = in.StorageOpts
out.UserNamespaceRemap = in.UserNamespaceRemap
@ -2278,6 +2279,7 @@ func autoConvert_kops_DockerConfig_To_v1alpha2_DockerConfig(in *kops.DockerConfi
out.MetricsAddress = in.MetricsAddress
out.MTU = in.MTU
out.RegistryMirrors = in.RegistryMirrors
out.SkipInstall = in.SkipInstall
out.Storage = in.Storage
out.StorageOpts = in.StorageOpts
out.UserNamespaceRemap = in.UserNamespaceRemap