Skip to content

Commit

Permalink
RHOAIENG-4528 - Customizable kfp-launcher with a config map
Browse files Browse the repository at this point in the history
Signed-off-by: Achyut Madhusudan <amadhusu@redhat.com>
  • Loading branch information
Achyut Madhusudan committed Apr 19, 2024
1 parent d659f6d commit 3c04640
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 11 deletions.
13 changes: 13 additions & 0 deletions api/v1alpha1/dspipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ type APIServer struct {
// for the api server to use instead.
CustomServerConfig *ScriptConfigMap `json:"customServerConfigMap,omitempty"`

// Include custom kfp-launcher ConfigMap with the deployment of this DSP API Server. Default: false
// +kubebuilder:validation:Optional
EnableCustomKfpLauncher bool `json:"enableCustomKfpLauncher"`
// CustomKfpLauncherConfig is a custom config file that you can provide
// for the api server to use instead of the one provided with DSPO.
CustomKfpLauncherConfig *KfpLauncherConfigMap `json:"customKfpLauncherConfigMap,omitempty"`

// Default: true
// Deprecated: DSP V1 only, will be removed in the future.
// +kubebuilder:default:=true
Expand Down Expand Up @@ -157,6 +164,12 @@ type ScriptConfigMap struct {
Key string `json:"key,omitempty"`
}

type KfpLauncherConfigMap struct {
Name string `json:"name,omitempty"`
DefaultPipelineRoot string `json:"defaultPipelineRoot,omitempty"`
Providers string `json:"providers,omitempty"`
}

type PersistenceAgent struct {
// Enable DS Pipelines Operator management of Persisence Agent. Setting Deploy to false disables operator reconciliation. Default: true
// +kubebuilder:default:=true
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ spec:
description: 'Default: true Deprecated: DSP V1 only, will be removed
in the future.'
type: boolean
customKfpLauncherConfigMap:
description: CustomKfpLauncherConfig is a custom config file that
you can provide for the api server to use instead of the one
provided with DSPO.
properties:
defaultPipelineRoot:
type: string
name:
type: string
providers:
type: string
type: object
customServerConfigMap:
description: CustomServerConfig is a custom config file that you
can provide for the api server to use instead.
Expand All @@ -126,6 +138,10 @@ spec:
Server. Setting Deploy to false disables operator reconciliation.
Default: true'
type: boolean
enableCustomKfpLauncher:
description: 'Include custom kfp-launcher ConfigMap with the deployment
of this DSP API Server. Default: false'
type: boolean
enableOauth:
default: true
description: 'Create an Openshift Route for this DSP API Server.
Expand Down
27 changes: 16 additions & 11 deletions config/internal/apiserver/default/kfp_launcher_config.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
apiVersion: v1
data:
{{ if .ObjectStorageConnection.BasePath }}
defaultPipelineRoot: s3://{{.ObjectStorageConnection.Bucket}}/{{.ObjectStorageConnection.BasePath}}
{{ if .APIServer.EnableCustomKfpLauncher }}
defaultPipelineRoot: {{.APIServer.CustomKfpLauncherConfig.DefaultPipelineRoot}}
providers: '[{{.APIServer.CustomKfpLauncherConfig.Providers}}]'
{{ else }}
defaultPipelineRoot: s3://{{.ObjectStorageConnection.Bucket}}
{{ if .ObjectStorageConnection.BasePath }}
defaultPipelineRoot: s3://{{.ObjectStorageConnection.Bucket}}/{{.ObjectStorageConnection.BasePath}}
{{ else }}
defaultPipelineRoot: s3://{{.ObjectStorageConnection.Bucket}}
{{ end }}
providers: |
s3:
endpoint: {{.ObjectStorageConnection.Endpoint}}
region: {{.ObjectStorageConnection.Region}}
defaultProviderSecretRef:
secretName: {{.ObjectStorageConnection.CredentialsSecret.SecretName}}
accessKeyKey: {{.ObjectStorageConnection.CredentialsSecret.AccessKey}}
secretKeyKey: {{.ObjectStorageConnection.CredentialsSecret.SecretKey}}
{{ end }}
providers: |
s3:
endpoint: {{.ObjectStorageConnection.Endpoint}}
region: {{.ObjectStorageConnection.Region}}
defaultProviderSecretRef:
secretName: {{.ObjectStorageConnection.CredentialsSecret.SecretName}}
accessKeyKey: {{.ObjectStorageConnection.CredentialsSecret.AccessKey}}
secretKeyKey: {{.ObjectStorageConnection.CredentialsSecret.SecretKey}}
kind: ConfigMap
metadata:
name: kfp-launcher
Expand Down
4 changes: 4 additions & 0 deletions controllers/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const (
CustomServerConfigMapNameKey = "config.json"
DSPServicePrefix = "ds-pipeline"

CustomKfpLauncherConfigMapName = "kfp-launcher"
CustomKfpLauncherConfigMapDefaultPipelineRoot = "defaultPipelineRoot"
CustomKfpLauncherConfigMapProviders = "providers"

DefaultDBSecretNamePrefix = "ds-pipeline-db-"
DefaultDBSecretKey = "password"
GeneratedDBPasswordLength = 12
Expand Down
27 changes: 27 additions & 0 deletions controllers/dspipeline_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,33 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
}
}

if p.APIServer.CustomKfpLauncherConfig == nil {
p.APIServer.CustomKfpLauncherConfig = &dspa.KfpLauncherConfigMap{
Name: config.CustomKfpLauncherConfigMapName,
DefaultPipelineRoot: config.CustomKfpLauncherConfigMapDefaultPipelineRoot,
Providers: config.CustomKfpLauncherConfigMapProviders,
}
} else {
customKfpLauncherCFGMapName := p.APIServer.CustomKfpLauncherConfig.Name
customKfpLauncherConfigMap, err := util.GetConfigMap(ctx, customKfpLauncherCFGMapName, p.Namespace, client)
if err != nil {
// If the custom kfp-launcher configmap is not available, that is OK
if !apierrs.IsNotFound(err) {
log.Info(fmt.Sprintf("Encountered error when attempting to fetch ConfigMap: [%s], Error: %v", customKfpLauncherCFGMapName, err))
return err
}
} else {
// Consume both defaultPipelineRoot and providers.
defaultPipelineRootValue := util.GetConfigMapValue(p.APIServer.CustomKfpLauncherConfig.DefaultPipelineRoot, customKfpLauncherConfigMap)
providersValue := util.GetConfigMapValue(p.APIServer.CustomKfpLauncherConfig.Providers, customKfpLauncherConfigMap)
p.APIServer.CustomKfpLauncherConfig = &dspa.KfpLauncherConfigMap{
Name: config.CustomKfpLauncherConfigMapName,
DefaultPipelineRoot: defaultPipelineRootValue,
Providers: providersValue,
}
}
}

// Track whether the "ca-bundle.crt" configmap key from odh-trusted-ca bundle
// was found, this will be used to decide whether we need to account for this
// ourselves later or not.
Expand Down

0 comments on commit 3c04640

Please sign in to comment.