From 704f8ebea5b02b5bb789999b47843d60796f41da Mon Sep 17 00:00:00 2001 From: "terry.hung" Date: Sat, 2 Nov 2024 03:44:23 +0800 Subject: [PATCH] fix: align the default config output (#5947) Signed-off-by: terry.hung --- flytectl/pkg/configutil/configutil.go | 11 ----------- flytectl/pkg/configutil/configutil_test.go | 18 +++++------------- flytectl/pkg/sandbox/start.go | 7 +------ 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/flytectl/pkg/configutil/configutil.go b/flytectl/pkg/configutil/configutil.go index df2f099da5..c018052d91 100644 --- a/flytectl/pkg/configutil/configutil.go +++ b/flytectl/pkg/configutil/configutil.go @@ -16,17 +16,6 @@ const ( console: endpoint: {{.Console}} {{- end}} -{{- if .DataConfig}} -# This is not a needed configuration, only useful if you want to explore the data in sandbox. For non sandbox, please -# do not use this configuration, instead prefer to use aws, gcs, azure sessions. Flytekit, should use fsspec to -# auto select the right backend to pull data as long as the sessions are configured. For Sandbox, this is special, as -# minio is s3 compatible and we ship with minio in sandbox. -storage: - connection: - endpoint: {{.DataConfig.Endpoint}} - access-key: {{.DataConfig.AccessKey}} - secret-key: {{.DataConfig.SecretKey}} -{{- end}} ` ) diff --git a/flytectl/pkg/configutil/configutil_test.go b/flytectl/pkg/configutil/configutil_test.go index ccdf5035ef..10f8553247 100644 --- a/flytectl/pkg/configutil/configutil_test.go +++ b/flytectl/pkg/configutil/configutil_test.go @@ -1,6 +1,7 @@ package configutil import ( + "io" "io/ioutil" "os" "testing" @@ -20,7 +21,7 @@ func TestSetupConfig(t *testing.T) { } err = SetupConfig(file.Name(), AdminConfigTemplate, templateValue) assert.NoError(t, err) - configBytes, err := ioutil.ReadAll(file) + configBytes, err := io.ReadAll(file) assert.NoError(t, err) expected := `admin: # For GRPC endpoints you might want to use dns:///flyte.myexample.com @@ -62,21 +63,12 @@ console: } err = SetupConfig(file.Name(), AdminConfigTemplate, templateValue) assert.NoError(t, err) - configBytes, err = ioutil.ReadAll(file) + configBytes, err = io.ReadAll(file) assert.NoError(t, err) expected = `admin: # For GRPC endpoints you might want to use dns:///flyte.myexample.com endpoint: dns:///admin.example.com insecure: true -# This is not a needed configuration, only useful if you want to explore the data in sandbox. For non sandbox, please -# do not use this configuration, instead prefer to use aws, gcs, azure sessions. Flytekit, should use fsspec to -# auto select the right backend to pull data as long as the sessions are configured. For Sandbox, this is special, as -# minio is s3 compatible and we ship with minio in sandbox. -storage: - connection: - endpoint: http://localhost:9000 - access-key: my-access-key - secret-key: my-secret-key ` assert.Equal(t, expected, string(configBytes)) @@ -91,8 +83,8 @@ func TestConfigCleanup(t *testing.T) { if os.IsNotExist(err) { _ = os.MkdirAll(f.FilePathJoin(f.UserHomeDir(), ".flyte"), 0755) } - _ = ioutil.WriteFile(FlytectlConfig, []byte("string"), 0600) - _ = ioutil.WriteFile(Kubeconfig, []byte("string"), 0600) + _ = os.WriteFile(FlytectlConfig, []byte("string"), 0600) + _ = os.WriteFile(Kubeconfig, []byte("string"), 0600) err = ConfigCleanup() assert.Nil(t, err) diff --git a/flytectl/pkg/sandbox/start.go b/flytectl/pkg/sandbox/start.go index 8689aca6f2..6681baf5e1 100644 --- a/flytectl/pkg/sandbox/start.go +++ b/flytectl/pkg/sandbox/start.go @@ -175,13 +175,8 @@ func startSandbox(ctx context.Context, cli docker.Docker, g github.GHRepoService } templateValues := configutil.ConfigTemplateSpec{ - Host: "localhost:30080", + Host: "dns:///localhost:30080", Insecure: true, - DataConfig: &configutil.DataConfig{ - Endpoint: "http://localhost:30002", - AccessKey: "minio", - SecretKey: "miniostorage", - }, } if err := configutil.SetupConfig(configutil.FlytectlConfig, configutil.GetTemplate(), templateValues); err != nil { return nil, err