diff --git a/.github/workflows/flyteidl-buf-publish.yml b/.github/workflows/flyteidl-buf-publish.yml index 5eef90fe7d..cbb530421c 100644 --- a/.github/workflows/flyteidl-buf-publish.yml +++ b/.github/workflows/flyteidl-buf-publish.yml @@ -3,6 +3,7 @@ name: Publish flyteidl Buf Package on: push: branches: + - artifacts-shell - artifacts - master paths: diff --git a/flyteadmin/pkg/artifacts/registry.go b/flyteadmin/pkg/artifacts/registry.go index 9a0555f490..72e73086ba 100644 --- a/flyteadmin/pkg/artifacts/registry.go +++ b/flyteadmin/pkg/artifacts/registry.go @@ -78,8 +78,17 @@ func (a *ArtifactRegistry) GetClient() artifact.ArtifactRegistryClient { return a.client } -func NewArtifactRegistry(ctx context.Context, _ *Config, _ ...grpc.DialOption) *ArtifactRegistry { - cfg := admin2.GetConfig(ctx) +// NewArtifactRegistry todo: update this to return error, and proper cfg handling. +// if nil, should either call the default config or return an error +func NewArtifactRegistry(ctx context.Context, connCfg *admin2.Config, _ ...grpc.DialOption) *ArtifactRegistry { + + var cfg = connCfg + if connCfg == nil { + //cfg = admin2.GetConfig(ctx) + return &ArtifactRegistry{ + client: nil, + } + } clients, err := admin2.NewClientsetBuilder().WithConfig(cfg).Build(ctx) if err != nil { logger.Errorf(ctx, "Failed to create Artifact client") diff --git a/flyteadmin/pkg/rpc/adminservice/base.go b/flyteadmin/pkg/rpc/adminservice/base.go index 46db18d878..02a9ec3695 100644 --- a/flyteadmin/pkg/rpc/adminservice/base.go +++ b/flyteadmin/pkg/rpc/adminservice/base.go @@ -3,6 +3,7 @@ package adminservice import ( "context" "fmt" + admin2 "github.com/flyteorg/flyte/flyteidl/clients/go/admin" "runtime/debug" "github.com/golang/protobuf/proto" @@ -115,9 +116,8 @@ func NewAdminServer(ctx context.Context, pluginRegistry *plugins.Registry, confi var artifactRegistry *artifacts.ArtifactRegistry if configuration.ApplicationConfiguration().GetTopLevelConfig().FeatureGates.EnableArtifacts { - artifactRegistry = artifacts.NewArtifactRegistry(ctx, configuration.ApplicationConfiguration().GetArtifactsConfig()) - } else { - artifactRegistry = nil + adminClientCfg := admin2.GetConfig(ctx) + artifactRegistry = artifacts.NewArtifactRegistry(ctx, adminClientCfg) } launchPlanManager := manager.NewLaunchPlanManager( diff --git a/flyteadmin/pkg/runtime/application_config_provider.go b/flyteadmin/pkg/runtime/application_config_provider.go index 58cbdcdffb..a16c27e694 100644 --- a/flyteadmin/pkg/runtime/application_config_provider.go +++ b/flyteadmin/pkg/runtime/application_config_provider.go @@ -1,7 +1,6 @@ package runtime import ( - artifactsClient "github.com/flyteorg/flyte/flyteadmin/pkg/artifacts" "github.com/flyteorg/flyte/flyteadmin/pkg/common" "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flytestdlib/config" @@ -16,7 +15,6 @@ const notifications = "notifications" const domains = "domains" const externalEvents = "externalEvents" const cloudEvents = "cloudEvents" -const artifact = "artifacts" const metricPort = 10254 const KB = 1024 @@ -86,8 +84,6 @@ var cloudEventsConfig = config.MustRegisterSection(cloudEvents, &interfaces.Clou Type: common.Local, }) -var artifactsConfig = config.MustRegisterSection(artifact, &artifactsClient.Config{}) - // Implementation of an interfaces.ApplicationConfiguration type ApplicationConfigurationProvider struct{} @@ -123,10 +119,6 @@ func (p *ApplicationConfigurationProvider) GetCloudEventsConfig() *interfaces.Cl return cloudEventsConfig.GetConfig().(*interfaces.CloudEventsConfig) } -func (p *ApplicationConfigurationProvider) GetArtifactsConfig() *artifactsClient.Config { - return artifactsConfig.GetConfig().(*artifactsClient.Config) -} - func NewApplicationConfigurationProvider() interfaces.ApplicationConfiguration { return &ApplicationConfigurationProvider{} } diff --git a/flyteadmin/pkg/runtime/interfaces/application_configuration.go b/flyteadmin/pkg/runtime/interfaces/application_configuration.go index dfc558a13b..3a459209f5 100644 --- a/flyteadmin/pkg/runtime/interfaces/application_configuration.go +++ b/flyteadmin/pkg/runtime/interfaces/application_configuration.go @@ -4,7 +4,6 @@ import ( "github.com/golang/protobuf/ptypes/wrappers" "golang.org/x/time/rate" - artifactsClient "github.com/flyteorg/flyte/flyteadmin/pkg/artifacts" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flyte/flytestdlib/config" @@ -592,5 +591,4 @@ type ApplicationConfiguration interface { GetDomainsConfig() *DomainsConfig GetExternalEventsConfig() *ExternalEventsConfig GetCloudEventsConfig() *CloudEventsConfig - GetArtifactsConfig() *artifactsClient.Config } diff --git a/flyteadmin/pkg/runtime/mocks/mock_application_provider.go b/flyteadmin/pkg/runtime/mocks/mock_application_provider.go index 1fad7729f9..f657685364 100644 --- a/flyteadmin/pkg/runtime/mocks/mock_application_provider.go +++ b/flyteadmin/pkg/runtime/mocks/mock_application_provider.go @@ -1,7 +1,6 @@ package mocks import ( - artifactsClient "github.com/flyteorg/flyte/flyteadmin/pkg/artifacts" "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flytestdlib/database" ) @@ -15,7 +14,6 @@ type MockApplicationProvider struct { domainsConfig interfaces.DomainsConfig externalEventsConfig interfaces.ExternalEventsConfig cloudEventConfig interfaces.CloudEventsConfig - artifactsConfig artifactsClient.Config } func (p *MockApplicationProvider) GetDbConfig() *database.DbConfig { @@ -81,7 +79,3 @@ func (p *MockApplicationProvider) SetCloudEventsConfig(cloudEventConfig interfac func (p *MockApplicationProvider) GetCloudEventsConfig() *interfaces.CloudEventsConfig { return &p.cloudEventConfig } - -func (p *MockApplicationProvider) GetArtifactsConfig() *artifactsClient.Config { - return &p.artifactsConfig -} diff --git a/flyteidl/protos/flyteidl/artifact/artifacts.proto b/flyteidl/protos/flyteidl/artifact/artifacts.proto index 89f6e6d2e9..8330d49646 100644 --- a/flyteidl/protos/flyteidl/artifact/artifacts.proto +++ b/flyteidl/protos/flyteidl/artifact/artifacts.proto @@ -13,7 +13,6 @@ import "flyteidl/core/identifier.proto"; import "flyteidl/core/artifact_id.proto"; import "flyteidl/core/interface.proto"; import "flyteidl/event/cloudevents.proto"; -// TODO remove me message Artifact { core.ArtifactID artifact_id = 1;