From c92aea4a9cfdedfe79183ad1b45c2febc05ced23 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 15 Feb 2023 11:40:55 -0800 Subject: [PATCH 1/3] don't merge defaults when querying other types Signed-off-by: Yee Hing Tong --- flyteadmin_config.yaml | 28 +++++++++++-------- .../impl/resources/resource_manager.go | 3 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/flyteadmin_config.yaml b/flyteadmin_config.yaml index 6cef756f4..964f83a81 100644 --- a/flyteadmin_config.yaml +++ b/flyteadmin_config.yaml @@ -6,7 +6,7 @@ server: httpPort: 8088 grpcPort: 8089 grpcServerReflection: true - kube-config: /Users/ytong/.flyte/state/kubeconfig + kube-config: /Users/ytong/.flyte/sandbox/kubeconfig security: secure: false useAuth: false @@ -62,10 +62,11 @@ flyteadmin: useOffloadedWorkflowClosure: false database: postgres: - port: 5432 + port: 30001 username: postgres - host: localhost - dbname: flyteadmin + password: postgres + host: 127.0.0.1 + dbname: flyte options: "sslmode=disable" scheduler: eventScheduler: @@ -115,14 +116,17 @@ Logger: show-source: true level: 6 storage: - type: minio - connection: - access-key: minio - auth-type: accesskey - secret-key: miniostorage - disable-ssl: true - endpoint: "http://localhost:30084" - region: my-region + type: stow + stow: + kind: s3 + config: + region: us-east-1 + disable_ssl: true + v2_signing: true + endpoint: http://localhost:30002 + auth_type: accesskey + access_key_id: minio + secret_key: miniostorage signedUrl: stowConfigOverride: endpoint: http://localhost:30084 diff --git a/pkg/manager/impl/resources/resource_manager.go b/pkg/manager/impl/resources/resource_manager.go index a02cd024a..d65658991 100644 --- a/pkg/manager/impl/resources/resource_manager.go +++ b/pkg/manager/impl/resources/resource_manager.go @@ -213,9 +213,8 @@ func (m *ResourceManager) GetProjectAttributes(ctx context.Context, request admi configLevelDefaults := m.config.GetTopLevelConfig().GetAsWorkflowExecutionConfig() if err != nil { ec, ok := err.(errors.FlyteAdminError) - if ok && ec.Code() == codes.NotFound { + if ok && ec.Code() == codes.NotFound && request.ResourceType == admin.MatchableResource_WORKFLOW_EXECUTION_CONFIG { // TODO: Will likely be removed after overarching settings project is done - // Proceed with the default CreateOrUpdate call since there's no existing model to update. return &admin.ProjectAttributesGetResponse{ Attributes: &admin.ProjectAttributes{ Project: request.Project, From 31877101adc2798b5b6fd3abaf4f463f7e3b565a Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 15 Feb 2023 16:03:48 -0800 Subject: [PATCH 2/3] add unit test Signed-off-by: Yee Hing Tong --- .../impl/resources/resource_manager_test.go | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pkg/manager/impl/resources/resource_manager_test.go b/pkg/manager/impl/resources/resource_manager_test.go index ad886e52e..2fc389bfc 100644 --- a/pkg/manager/impl/resources/resource_manager_test.go +++ b/pkg/manager/impl/resources/resource_manager_test.go @@ -2,7 +2,6 @@ package resources import ( "context" - runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" @@ -645,6 +644,26 @@ func TestGetProjectAttributes_ConfigLookup(t *testing.T) { }, }, response)) }) + + t.Run("config not merged if not wec", func(t *testing.T) { + appConfig := runtimeInterfaces.ApplicationConfig{ + MaxParallelism: 3, + K8SServiceAccount: "testserviceaccount", + Labels: map[string]string{"lab1": "name"}, + OutputLocationPrefix: "s3://test-bucket", + } + config.SetTopLevelConfig(appConfig) + request := admin.ProjectAttributesGetRequest{ + Project: project, + ResourceType: admin.MatchableResource_EXECUTION_QUEUE, + } + + _, err := manager.GetProjectAttributes(context.Background(), request) + assert.Error(t, err) + ec, ok := err.(errors.FlyteAdminError) + assert.True(t, ok) + assert.Equal(t, codes.NotFound, ec.Code()) + }) } func TestDeleteProjectAttributes(t *testing.T) { From 543a957147f37a6e3b6c753c4462c599cb648d81 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 15 Feb 2023 18:04:51 -0800 Subject: [PATCH 3/3] nit Signed-off-by: Yee Hing Tong --- pkg/manager/impl/resources/resource_manager_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/manager/impl/resources/resource_manager_test.go b/pkg/manager/impl/resources/resource_manager_test.go index 2fc389bfc..8c587937c 100644 --- a/pkg/manager/impl/resources/resource_manager_test.go +++ b/pkg/manager/impl/resources/resource_manager_test.go @@ -2,6 +2,7 @@ package resources import ( "context" + runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"