Skip to content

Commit

Permalink
Merge pull request #7632 from rdrgmnzs/cherrypick_6957_release-1.15
Browse files Browse the repository at this point in the history
Cherry pick of #6957 onto release-1.15
  • Loading branch information
k8s-ci-robot authored Sep 19, 2019
2 parents 0b76ca6 + bba59e4 commit 8a3bc6f
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/cluster_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions nodeup/pkg/model/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions nodeup/pkg/model/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
39 changes: 39 additions & 0 deletions nodeup/pkg/model/tests/dockerbuilder/skipinstall/cluster.yaml
Original file line number Diff line number Diff line change
@@ -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
Empty file.
2 changes: 2 additions & 0 deletions pkg/apis/kops/dockerconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha1/dockerconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/apis/kops/v1alpha2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha2/dockerconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8a3bc6f

Please sign in to comment.