From f53a4d4089d88a7a1d3a80067edf780995ef5dfe Mon Sep 17 00:00:00 2001 From: maggieneterval Date: Tue, 25 Feb 2020 10:52:14 -0500 Subject: [PATCH] feat(kubernetes): default new and unspecified accounts to V2 --- docs/commands.md | 2 +- .../providers/kubernetes/KubernetesAddAccountCommand.java | 2 +- .../config/model/v1/providers/kubernetes/KubernetesAccount.java | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/commands.md b/docs/commands.md index e4cb33a901..e97a0f9a01 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -9556,7 +9556,7 @@ This can only be set when --kinds is empty or not set. This can only be set when --namespaces is empty or not set. * `--only-spinnaker-managed`: (*Default*: `false`) (V2 Only) When true, Spinnaker will only cache/display applications that have been created by Spinnaker; as opposed to attempting to configure applications for resources already present in Kubernetes. - * `--provider-version`: There are currently two versions of the Kubernetes Provider: V1 and V2. This allows you to pick the version of the provider (not the resources it manages) to run within Spinnaker.V1 is scheduled for removal in Spinnaker 1.21; we recommend using V2 only. + * `--provider-version`: (*Default*: `v2`) There are currently two versions of the Kubernetes Provider: V1 and V2. This allows you to pick the version of the provider (not the resources it manages) to run within Spinnaker.V1 is scheduled for removal in Spinnaker 1.21; we recommend using V2 only. * `--read-permissions`: (*Default*: `[]`) A user must have at least one of these roles in order to view this account's cloud resources. * `--required-group-membership`: (*Default*: `[]`) A user must be a member of at least one specified group in order to make changes to this account's cloud resources. * `--service-account`: When true, Spinnaker attempt to authenticate against Kubernetes using a Kubernetes service account. This only works when Halyard & Spinnaker are deployed in Kubernetes. Read more about service accounts here: [https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/). diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/kubernetes/KubernetesAddAccountCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/kubernetes/KubernetesAddAccountCommand.java index 032ffdfa57..4390ac01c4 100644 --- a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/kubernetes/KubernetesAddAccountCommand.java +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/kubernetes/KubernetesAddAccountCommand.java @@ -123,7 +123,7 @@ protected String getProviderName() { @Parameter( names = "--provider-version", description = KubernetesCommandProperties.PROVIDER_VERSION_DESCRIPTION) - private ProviderVersion providerVersion; + private ProviderVersion providerVersion = ProviderVersion.V2; @Override protected Account buildAccount(String accountName) { diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/kubernetes/KubernetesAccount.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/kubernetes/KubernetesAccount.java index 07a54e6f1f..0d5ce0b290 100644 --- a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/kubernetes/KubernetesAccount.java +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/kubernetes/KubernetesAccount.java @@ -20,6 +20,7 @@ import com.netflix.spinnaker.halyard.config.config.v1.ArtifactSourcesConfig; import com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration; import com.netflix.spinnaker.halyard.config.model.v1.node.LocalFile; +import com.netflix.spinnaker.halyard.config.model.v1.node.Provider.ProviderVersion; import com.netflix.spinnaker.halyard.config.model.v1.node.SecretFile; import com.netflix.spinnaker.halyard.config.model.v1.node.ValidForSpinnakerVersion; import com.netflix.spinnaker.halyard.config.model.v1.providers.containers.ContainerAccount; @@ -32,6 +33,7 @@ @Data @EqualsAndHashCode(callSuper = true) public class KubernetesAccount extends ContainerAccount implements Cloneable { + ProviderVersion providerVersion = ProviderVersion.V2; String context; String cluster; String user;