From f7e9e71ee12ee7e56d73159e00d6de04afecd23e Mon Sep 17 00:00:00 2001 From: soharab-ic <156293296+soharab-ic@users.noreply.github.com> Date: Wed, 22 May 2024 14:06:36 +0530 Subject: [PATCH] Set latest envVersion 3 as default (#2945) Signed-off-by: Md Soharab Ansari --- pkg/fission-cli/cmd/environment/create.go | 9 --------- pkg/fission-cli/flag/flag.go | 2 +- test/e2e/cli/cli_test.go | 2 ++ 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/fission-cli/cmd/environment/create.go b/pkg/fission-cli/cmd/environment/create.go index 4d99e4d0..e45d537e 100644 --- a/pkg/fission-cli/cmd/environment/create.go +++ b/pkg/fission-cli/cmd/environment/create.go @@ -138,11 +138,6 @@ func createEnvironmentFromCmd(input cli.Input) (*fv1.Environment, error) { envVersion = 1 } - if input.IsSet(flagkey.EnvPoolsize) { - // TODO: remove silently version 3 assignment, we need to warn user to set it explicitly. - envVersion = 3 - } - if !input.IsSet(flagkey.EnvPoolsize) { console.Info("poolsize setting default to 3") } @@ -154,10 +149,6 @@ func createEnvironmentFromCmd(input cli.Input) (*fv1.Environment, error) { envBuilderImg := input.String(flagkey.EnvBuilderImage) if len(envBuilderImg) > 0 { - if !input.IsSet(flagkey.EnvVersion) { - // TODO: remove set env version to 2 silently, we need to warn user to set it explicitly. - envVersion = 2 - } if len(envBuildCmd) == 0 { envBuildCmd = "build" } diff --git a/pkg/fission-cli/flag/flag.go b/pkg/fission-cli/flag/flag.go index ca303d64..308f01e5 100644 --- a/pkg/fission-cli/flag/flag.go +++ b/pkg/fission-cli/flag/flag.go @@ -182,7 +182,7 @@ var ( EnvKeepArchive = Flag{Type: Bool, Name: flagkey.EnvKeeparchive, Usage: "Keep the archive instead of extracting it into a directory (mainly for the JVM environment because .jar is one kind of zip archive)"} EnvExternalNetwork = Flag{Type: Bool, Name: flagkey.EnvExternalNetwork, Usage: "Allow pod to access external network (only works when istio feature is enabled)"} EnvTerminationGracePeriod = Flag{Type: Int64, Name: flagkey.EnvGracePeriod, Aliases: []string{"period"}, Usage: "Grace time (in seconds) for pod to perform connection draining before termination (only non-negative values considered)", DefaultValue: 360} - EnvVersion = Flag{Type: Int, Name: flagkey.EnvVersion, Usage: "Environment API version (1 means v1 interface)", DefaultValue: 1} + EnvVersion = Flag{Type: Int, Name: flagkey.EnvVersion, Usage: "Environment API version (1 means v1 interface)", DefaultValue: 3} EnvImagePullSecret = Flag{Type: String, Name: flagkey.EnvImagePullSecret, Usage: "Secret for Kubernetes to pull an image from a private registry"} EnvExecutorType = Flag{Type: String, Name: flagkey.EnvExecutorType, Usage: "Executor type of pod in environment; one of 'poolmgr', 'newdeploy', 'container'"} EnvForce = Flag{Type: Bool, Name: flagkey.EnvForce, Short: "f", Usage: "Force delete env even if one or more functions exist", DefaultValue: false} diff --git a/test/e2e/cli/cli_test.go b/test/e2e/cli/cli_test.go index c472be75..989d9f31 100644 --- a/test/e2e/cli/cli_test.go +++ b/test/e2e/cli/cli_test.go @@ -46,6 +46,7 @@ func TestFissionCLI(t *testing.T) { require.NoError(t, err) t.Run("environment", func(t *testing.T) { + defaultEnvVersion := 3 t.Run("create", func(t *testing.T) { _, err := cli.ExecCommand(f, ctx, "env", "create", "--name", "test-env", "--image", "fission/python-env") require.NoError(t, err) @@ -55,6 +56,7 @@ func TestFissionCLI(t *testing.T) { require.NotNil(t, env) require.Equal(t, "test-env", env.Name) require.Equal(t, "fission/python-env", env.Spec.Runtime.Image) + require.Equal(t, defaultEnvVersion, env.Spec.Version) }) t.Run("list", func(t *testing.T) {