forked from kubernetes/kops
/
dockerconfig.go
27 lines (21 loc) · 1.03 KB
/
dockerconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package api
import (
"k8s.io/kubernetes/pkg/util/validation/field"
)
type DockerConfig struct {
Bridge *string `json:"bridge,omitempty" flag:"bridge"`
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
// Storage maps to the docker storage flag
// But nodeup will also process a comma-separate list, selecting the first supported option
Storage *string `json:"storage,omitempty" flag:"storage-driver"`
InsecureRegistry *string `json:"insecureRegistry,omitempty" flag:"insecure-registry"`
MTU *int `json:"mtu,omitempty" flag:"mtu"`
}
var validDockerConfigStorageValues = []string{"aufs", "btrfs", "devicemapper", "overlay", "overlay2", "zfs"}
func ValidateDockerConfig(config *DockerConfig, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, IsValidValue(fldPath.Child("storage"), config.Storage, validDockerConfigStorageValues)...)
return allErrs
}