diff --git a/flyteadmin/flyteadmin_config.yaml b/flyteadmin/flyteadmin_config.yaml index ef3bda2383..118687ae87 100644 --- a/flyteadmin/flyteadmin_config.yaml +++ b/flyteadmin/flyteadmin_config.yaml @@ -25,6 +25,10 @@ server: iss: "https://idp.com" aud: "api://default" idpUserInfoEndpoint: "/v1/userinfo" + thirdPartyConfig: + flyteClient: + clientId: yourPublicAppClientId + redirectUri: yourRegisteredLoginRedirectUri flyteadmin: runScheduler: false roleNameKey: "iam.amazonaws.com/role" diff --git a/flyteadmin/pkg/config/config.go b/flyteadmin/pkg/config/config.go index d25640d81d..02b0f49b7d 100644 --- a/flyteadmin/pkg/config/config.go +++ b/flyteadmin/pkg/config/config.go @@ -12,12 +12,13 @@ const SectionKey = "server" //go:generate pflags ServerConfig --default-var=defaultServerConfig type ServerConfig struct { - HTTPPort int `json:"httpPort" pflag:",On which http port to serve admin"` - GrpcPort int `json:"grpcPort" pflag:",On which grpc port to serve admin"` - GrpcServerReflection bool `json:"grpcServerReflection" pflag:",Enable GRPC Server Reflection"` - KubeConfig string `json:"kube-config" pflag:",Path to kubernetes client config file."` - Master string `json:"master" pflag:",The address of the Kubernetes API server."` - Security ServerSecurityOptions `json:"security"` + HTTPPort int `json:"httpPort" pflag:",On which http port to serve admin"` + GrpcPort int `json:"grpcPort" pflag:",On which grpc port to serve admin"` + GrpcServerReflection bool `json:"grpcServerReflection" pflag:",Enable GRPC Server Reflection"` + KubeConfig string `json:"kube-config" pflag:",Path to kubernetes client config file."` + Master string `json:"master" pflag:",The address of the Kubernetes API server."` + Security ServerSecurityOptions `json:"security"` + ThirdPartyConfig ThirdPartyConfigOptions `json:"thirdPartyConfig"` } type ServerSecurityOptions struct { diff --git a/flyteadmin/pkg/config/third_party_config.go b/flyteadmin/pkg/config/third_party_config.go new file mode 100644 index 0000000000..785c6e4452 --- /dev/null +++ b/flyteadmin/pkg/config/third_party_config.go @@ -0,0 +1,12 @@ +package config + +// This struct encapsulates config options for bootstrapping various Flyte applications with config values +// For example, FlyteClientConfig contains application-specific values to initialize the config required by flyte client +type ThirdPartyConfigOptions struct { + FlyteClientConfig FlyteClientConfig `json:"flyteClient"` +} + +type FlyteClientConfig struct { + ClientID string `json:"clientId" pflag:",public identifier for the app which handles authorization for a Flyte deployment"` + RedirectURI string `json:"redirectUri" pflag:",This is the callback uri registered with the app which handles authorization for a Flyte deployment"` +} diff --git a/flyteadmin/pkg/rpc/config/flyte_client.go b/flyteadmin/pkg/rpc/config/flyte_client.go index 6216cc9029..eaf78731c6 100644 --- a/flyteadmin/pkg/rpc/config/flyte_client.go +++ b/flyteadmin/pkg/rpc/config/flyte_client.go @@ -18,8 +18,8 @@ const ( func HandleFlyteCliConfigFunc(ctx context.Context, cfg *config.ServerConfig) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { configValues := map[string]string{ - clientID: cfg.Security.Oauth.ClientID, - redirectURI: cfg.Security.Oauth.CallbackURL, + clientID: cfg.ThirdPartyConfig.FlyteClientConfig.ClientID, + redirectURI: cfg.ThirdPartyConfig.FlyteClientConfig.RedirectURI, authMetadataKey: cfg.Security.Oauth.GrpcAuthorizationHeader, } configJSON, err := json.Marshal(configValues) diff --git a/flyteadmin/pkg/rpc/config/flyte_client_test.go b/flyteadmin/pkg/rpc/config/flyte_client_test.go index d0e06116a8..47b2bd3333 100644 --- a/flyteadmin/pkg/rpc/config/flyte_client_test.go +++ b/flyteadmin/pkg/rpc/config/flyte_client_test.go @@ -20,11 +20,15 @@ func TestHandleFlyteCliConfigFunc(t *testing.T) { handleFlyteCliConfigFunc := HandleFlyteCliConfigFunc(context.Background(), &config.ServerConfig{ Security: config.ServerSecurityOptions{ Oauth: authConfig.OAuthOptions{ - ClientID: testClientID, - CallbackURL: testRedirectURI, GrpcAuthorizationHeader: testAuthMetadataKey, }, }, + ThirdPartyConfig: config.ThirdPartyConfigOptions{ + FlyteClientConfig: config.FlyteClientConfig{ + ClientID: testClientID, + RedirectURI: testRedirectURI, + }, + }, }) responseRecorder := httptest.NewRecorder()