Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Only merge system defaults when querying workflow execution config fo…
Browse files Browse the repository at this point in the history
…r project attributes (#522)

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
  • Loading branch information
wild-endeavor authored Feb 16, 2023
1 parent 96a660e commit 4181112
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
28 changes: 16 additions & 12 deletions flyteadmin/flyteadmin_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions flyteadmin/pkg/manager/impl/resources/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions flyteadmin/pkg/manager/impl/resources/resource_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,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) {
Expand Down

0 comments on commit 4181112

Please sign in to comment.