Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/command/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error {
if err != nil {
return errors.Wrap(err, "Experimental field")
}
orchestrator, err := GetOrchestrator(hasExperimental, opts.Common.Orchestrator, cli.configFile.Orchestrator)
orchestrator, err := GetOrchestrator(opts.Common.Orchestrator, cli.configFile.Orchestrator)
if err != nil {
return err
}
Expand Down Expand Up @@ -244,7 +244,7 @@ type ClientInfo struct {

// HasKubernetes checks if kubernetes orchestrator is enabled
func (c ClientInfo) HasKubernetes() bool {
return c.HasExperimental && (c.Orchestrator == OrchestratorKubernetes || c.Orchestrator == OrchestratorAll)
return c.Orchestrator == OrchestratorKubernetes || c.Orchestrator == OrchestratorAll
}

// HasSwarm checks if swarm orchestrator is enabled
Expand Down
19 changes: 0 additions & 19 deletions cli/command/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,28 +176,14 @@ func TestOrchestratorSwitch(t *testing.T) {
{
doc: "default",
configfile: `{
"experimental": "enabled"
}`,
expectedOrchestrator: "swarm",
expectedKubernetes: false,
expectedSwarm: true,
},
{
doc: "kubernetesIsExperimental",
configfile: `{
"experimental": "disabled",
"orchestrator": "kubernetes"
}`,
envOrchestrator: "kubernetes",
flagOrchestrator: "kubernetes",
expectedOrchestrator: "swarm",
expectedKubernetes: false,
expectedSwarm: true,
},
{
doc: "kubernetesConfigFile",
configfile: `{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's a couple more "experimental": "enabled" below; think those can be removed as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

"experimental": "enabled",
"orchestrator": "kubernetes"
}`,
expectedOrchestrator: "kubernetes",
Expand All @@ -207,7 +193,6 @@ func TestOrchestratorSwitch(t *testing.T) {
{
doc: "kubernetesEnv",
configfile: `{
"experimental": "enabled"
}`,
envOrchestrator: "kubernetes",
expectedOrchestrator: "kubernetes",
Expand All @@ -217,7 +202,6 @@ func TestOrchestratorSwitch(t *testing.T) {
{
doc: "kubernetesFlag",
configfile: `{
"experimental": "enabled"
}`,
flagOrchestrator: "kubernetes",
expectedOrchestrator: "kubernetes",
Expand All @@ -227,7 +211,6 @@ func TestOrchestratorSwitch(t *testing.T) {
{
doc: "allOrchestratorFlag",
configfile: `{
"experimental": "enabled"
}`,
flagOrchestrator: "all",
expectedOrchestrator: "all",
Expand All @@ -237,7 +220,6 @@ func TestOrchestratorSwitch(t *testing.T) {
{
doc: "envOverridesConfigFile",
configfile: `{
"experimental": "enabled",
"orchestrator": "kubernetes"
}`,
envOrchestrator: "swarm",
Expand All @@ -248,7 +230,6 @@ func TestOrchestratorSwitch(t *testing.T) {
{
doc: "flagOverridesEnv",
configfile: `{
"experimental": "enabled"
}`,
envOrchestrator: "kubernetes",
flagOrchestrator: "swarm",
Expand Down
6 changes: 1 addition & 5 deletions cli/command/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ func normalize(value string) (Orchestrator, error) {

// GetOrchestrator checks DOCKER_ORCHESTRATOR environment variable and configuration file
// orchestrator value and returns user defined Orchestrator.
func GetOrchestrator(isExperimental bool, flagValue, value string) (Orchestrator, error) {
// Non experimental CLI has kubernetes disabled
if !isExperimental {
return defaultOrchestrator, nil
}
func GetOrchestrator(flagValue, value string) (Orchestrator, error) {
// Check flag
if o, err := normalize(flagValue); o != orchestratorUnset {
return o, err
Expand Down
1 change: 0 additions & 1 deletion cli/command/stack/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func NewStackCommand(dockerCli command.Cli) *cobra.Command {
flags := cmd.PersistentFlags()
flags.String("kubeconfig", "", "Kubernetes config file")
flags.SetAnnotation("kubeconfig", "kubernetes", nil)
flags.SetAnnotation("kubeconfig", "experimentalCLI", nil)
return cmd
}

Expand Down
1 change: 0 additions & 1 deletion cli/command/stack/kubernetes/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func NewOptions(flags *flag.FlagSet) Options {
func AddNamespaceFlag(flags *flag.FlagSet) {
flags.String("namespace", "", "Kubernetes namespace to use")
flags.SetAnnotation("namespace", "kubernetes", nil)
flags.SetAnnotation("namespace", "experimentalCLI", nil)
}

// WrapCli wraps command.Cli with kubernetes specifics
Expand Down
2 changes: 0 additions & 2 deletions cli/command/stack/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
flags.StringVar(&opts.Format, "format", "", "Pretty-print stacks using a Go template")
flags.StringSliceVar(&opts.Namespaces, "namespace", []string{}, "Kubernetes namespaces to use")
flags.SetAnnotation("namespace", "kubernetes", nil)
flags.SetAnnotation("namespace", "experimentalCLI", nil)
flags.BoolVarP(&opts.AllNamespaces, "all-namespaces", "", false, "List stacks from all Kubernetes namespaces")
flags.SetAnnotation("all-namespaces", "kubernetes", nil)
flags.SetAnnotation("all-namespaces", "experimentalCLI", nil)
return cmd
}

Expand Down
1 change: 0 additions & 1 deletion cli/command/system/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func NewVersionCommand(dockerCli command.Cli) *cobra.Command {
flags.StringVarP(&opts.format, "format", "f", "", "Format the output using the given Go template")
flags.StringVarP(&opts.kubeConfig, "kubeconfig", "k", "", "Kubernetes config file")
flags.SetAnnotation("kubeconfig", "kubernetes", nil)
flags.SetAnnotation("kubeconfig", "experimentalCLI", nil)

return cmd
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ func newDockerCommand(dockerCli *command.DockerCli) *cobra.Command {

// Install persistent flags
persistentFlags := cmd.PersistentFlags()
persistentFlags.StringVar(&opts.Common.Orchestrator, "orchestrator", "", "Orchestrator to use (swarm|kubernetes|all) (experimental)")
persistentFlags.SetAnnotation("orchestrator", "experimentalCLI", nil)
persistentFlags.StringVar(&opts.Common.Orchestrator, "orchestrator", "", "Orchestrator to use (swarm|kubernetes|all)")

setFlagErrorFunc(dockerCli, cmd, flags, opts)

Expand Down