Merge pull request #977 from r2d4/feature-gates
Support enabling alpha features with feature gatespull/985/head
commit
7e313451c1
14
README.md
14
README.md
|
|
@ -178,6 +178,18 @@ Here is the documentation for each supported configuration:
|
|||
* [etcd](https://godoc.org/github.com/coreos/etcd/etcdserver#ServerConfig)
|
||||
* [scheduler](https://godoc.org/k8s.io/kubernetes/pkg/apis/componentconfig#KubeSchedulerConfiguration)
|
||||
|
||||
You can enable feature gates for alpha and experimental features with the `--feature-gates` flag on `minikube start`. As of v1.5.1, the options are:
|
||||
|
||||
* AllAlpha=true|false (ALPHA - default=false)
|
||||
* AllowExtTrafficLocalEndpoints=true|false (BETA - default=true)
|
||||
* AppArmor=true|false (BETA - default=true)
|
||||
* DynamicKubeletConfig=true|false (ALPHA - default=false)
|
||||
* DynamicVolumeProvisioning=true|false (ALPHA - default=true)
|
||||
* ExperimentalHostUserNamespaceDefaulting=true|false (ALPHA - default=false)
|
||||
* StreamingProxyRedirects=true|false (ALPHA - default=false)
|
||||
|
||||
Note: All alpha and experimental features are not guaranteed to work with minikube.
|
||||
|
||||
#### Examples
|
||||
|
||||
To change the `MaxPods` setting to 5 on the Kubelet, pass this flag: `--extra-config=kubelet.MaxPods=5`.
|
||||
|
|
@ -186,6 +198,8 @@ This feature also supports nested structs. To change the `LeaderElection.LeaderE
|
|||
|
||||
To set the `AuthorizationMode` on the `apiserver` to `RBAC`, you can use: `--extra-config=apiserver.GenericServerRunOptions.AuthorizationMode=RBAC`. You should use `--extra-config=apiserver.GenericServerRunOptions.AuthorizationRBACSuperUser=minikube` as well in that case.
|
||||
|
||||
To enable all alpha feature gates, you can use: `--feature-gates=AllAlpha=true`
|
||||
|
||||
### Stopping a Cluster
|
||||
The [minikube stop](./docs/minikube_stop.md) command can be used to stop your cluster.
|
||||
This command shuts down the minikube virtual machine, but preserves all cluster state and data.
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ func AddFlags(s *localkube.LocalkubeServer) {
|
|||
flag.IPVar(&s.NodeIP, "node-ip", s.NodeIP, "IP address of the node. If set, kubelet will use this IP address for the node.")
|
||||
flag.StringVar(&s.ContainerRuntime, "container-runtime", "", "The container runtime to be used")
|
||||
flag.StringVar(&s.NetworkPlugin, "network-plugin", "", "The name of the network plugin")
|
||||
flag.StringVar(&s.FeatureGates, "feature-gates", "", "A set of key=value pairs that describe feature gates for alpha/experimental features.")
|
||||
flag.Var(&s.ExtraConfig, "extra-config", "A set of key=value pairs that describe configuration that may be passed to different components. The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.")
|
||||
|
||||
// These two come from vendor/ packages that use flags. We should hide them
|
||||
|
|
|
|||
|
|
@ -22,8 +22,10 @@ import (
|
|||
"os/signal"
|
||||
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/kubernetes/pkg/capabilities"
|
||||
"k8s.io/kubernetes/pkg/kubelet/types"
|
||||
"k8s.io/kubernetes/pkg/util/config"
|
||||
"k8s.io/minikube/pkg/localkube"
|
||||
"k8s.io/minikube/pkg/version"
|
||||
)
|
||||
|
|
@ -65,6 +67,15 @@ func SetupServer(s *localkube.LocalkubeServer) {
|
|||
}
|
||||
}
|
||||
|
||||
//Set feature gates
|
||||
glog.Infof("Feature gates:", s.FeatureGates)
|
||||
if s.FeatureGates != "" {
|
||||
err := config.DefaultFeatureGate.Set(s.FeatureGates)
|
||||
if err != nil {
|
||||
fmt.Printf("Error setting feature gates: %s")
|
||||
}
|
||||
}
|
||||
|
||||
// Setup capabilities. This can only be done once per binary.
|
||||
allSources, _ := types.GetValidatedSources([]string{types.AllSource})
|
||||
c := capabilities.Capabilities{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ const (
|
|||
hypervVirtualSwitch = "hyperv-virtual-switch"
|
||||
kvmNetwork = "kvm-network"
|
||||
keepContext = "keep-context"
|
||||
featureGates = "feature-gates"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -110,6 +111,7 @@ func runStart(cmd *cobra.Command, args []string) {
|
|||
kubernetesConfig := cluster.KubernetesConfig{
|
||||
KubernetesVersion: viper.GetString(kubernetesVersion),
|
||||
NodeIP: ip,
|
||||
FeatureGates: viper.GetString(featureGates),
|
||||
ContainerRuntime: viper.GetString(containerRuntime),
|
||||
NetworkPlugin: viper.GetString(networkPlugin),
|
||||
ExtraOptions: extraOptions,
|
||||
|
|
@ -231,6 +233,7 @@ func init() {
|
|||
startCmd.Flags().String(kubernetesVersion, constants.DefaultKubernetesVersion, "The kubernetes version that the minikube VM will use (ex: v1.2.3) \n OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64)")
|
||||
startCmd.Flags().String(containerRuntime, "", "The container runtime to be used")
|
||||
startCmd.Flags().String(networkPlugin, "", "The name of the network plugin")
|
||||
startCmd.Flags().String(featureGates, "", "A set of key=value pairs that describe feature gates for alpha/experimental features.")
|
||||
startCmd.Flags().Var(&extraOptions, "extra-config",
|
||||
`A set of key=value pairs that describe configuration that may be passed to different components.
|
||||
The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.
|
||||
|
|
|
|||
|
|
@ -817,6 +817,8 @@ _minikube_start()
|
|||
local_nonpersistent_flags+=("--docker-env=")
|
||||
flags+=("--extra-config=")
|
||||
local_nonpersistent_flags+=("--extra-config=")
|
||||
flags+=("--feature-gates=")
|
||||
local_nonpersistent_flags+=("--feature-gates=")
|
||||
flags+=("--host-only-cidr=")
|
||||
local_nonpersistent_flags+=("--host-only-cidr=")
|
||||
flags+=("--hyperv-virtual-switch=")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ minikube start
|
|||
--extra-config ExtraOption A set of key=value pairs that describe configuration that may be passed to different components.
|
||||
The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.
|
||||
Valid components are: kubelet, apiserver, controller-manager, etcd, proxy, scheduler.
|
||||
--feature-gates string A set of key=value pairs that describe feature gates for alpha/experimental features.
|
||||
--host-only-cidr string The CIDR to be used for the minikube VM (only supported with Virtualbox driver) (default "192.168.99.1/24")
|
||||
--hyperv-virtual-switch string The hyperv virtual switch name. Defaults to first found. (only supported with HyperV driver)
|
||||
--insecure-registry stringSlice Insecure Docker registries to pass to the Docker daemon
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ type LocalkubeServer struct {
|
|||
NodeIP net.IP
|
||||
ContainerRuntime string
|
||||
NetworkPlugin string
|
||||
FeatureGates string
|
||||
ExtraConfig util.ExtraOptionSlice
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ type KubernetesConfig struct {
|
|||
NodeIP string
|
||||
ContainerRuntime string
|
||||
NetworkPlugin string
|
||||
FeatureGates string
|
||||
ExtraOptions util.ExtraOptionSlice
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,10 @@ func GenLocalkubeStartCmd(kubernetesConfig KubernetesConfig) (string, error) {
|
|||
flagVals = append(flagVals, "--network-plugin="+kubernetesConfig.NetworkPlugin)
|
||||
}
|
||||
|
||||
if kubernetesConfig.FeatureGates != "" {
|
||||
flagVals = append(flagVals, "--feature-gates="+kubernetesConfig.FeatureGates)
|
||||
}
|
||||
|
||||
for _, e := range kubernetesConfig.ExtraOptions {
|
||||
flagVals = append(flagVals, fmt.Sprintf("--extra-config=%s", e.String()))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue