Skip to content

Commit

Permalink
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 Jul 24, 2024
1 parent 5eacdd6 commit 48533a7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/dspipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ type APIServer struct {
// for the api server to use instead.
CustomServerConfig *ScriptConfigMap `json:"customServerConfigMap,omitempty"`

// CustomKfpLauncherConfig is a custom config file that you can provide
// for the api server to use instead of the one provided with DSPO.
CustomKfpLauncherConfig string `json:"customKfpLauncherConfigMap,omitempty"`

// Default: true
// Deprecated: DSP V1 only, will be removed in the future.
// +kubebuilder:default:=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ 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.
type: string
customServerConfigMap:
description: CustomServerConfig is a custom config file that you
can provide for the api server to use instead.
Expand Down
17 changes: 11 additions & 6 deletions config/internal/apiserver/default/kfp_launcher_config.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
apiVersion: v1
data:
{{ if .APIServer.CustomKfpLauncherConfig }}
providers: |
{{.CustomKfpLauncherConfigMap.Data}}
{{ else }}
{{ if .ObjectStorageConnection.BasePath }}
defaultPipelineRoot: s3://{{.ObjectStorageConnection.Bucket}}/{{.ObjectStorageConnection.BasePath}}
{{ else }}
Expand All @@ -12,11 +16,12 @@ data:
defaultProviderSecretRef:
secretName: {{.ObjectStorageConnection.CredentialsSecret.SecretName}}
accessKeyKey: {{.ObjectStorageConnection.CredentialsSecret.AccessKey}}
secretKeyKey: {{.ObjectStorageConnection.CredentialsSecret.SecretKey}}
secretKeyKey: {{.ObjectStorageConnection.CredentialsSecret.SecretKey}}`
{{ end }}
kind: ConfigMap
metadata:
name: kfp-launcher
namespace: {{.Namespace}}
labels:
app: ds-pipeline-{{.Name}}
component: data-science-pipelines
name: kfp-launcher
namespace: {{.Namespace}}
labels:
app: ds-pipeline-{{.Name}}
component: data-science-pipelines
1 change: 1 addition & 0 deletions config/samples/v2/dspa-all-fields/dspa_all_fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ metadata:
spec:
dspVersion: v2
apiServer:
customKfpLauncherConfigMap: configmapname
deploy: true
image: quay.io/opendatahub/ds-pipelines-api-server:latest
argoLauncherImage: quay.io/org/kfp-launcher:latest
Expand Down
18 changes: 18 additions & 0 deletions controllers/dspipeline_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type DSPAParams struct {
WorkflowController *dspa.WorkflowController
DBConnection
ObjectStorageConnection
CustomKfpLauncherConfigMap

// TLS
// The CA bundle path used by API server
Expand All @@ -88,6 +89,10 @@ type DSPAParams struct {
DSPONamespace string
}

type CustomKfpLauncherConfigMap struct {
Data string
}

type DBConnection struct {
Host string
Port string
Expand Down Expand Up @@ -630,6 +635,19 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
}
}

if cfg := p.APIServer.CustomKfpLauncherConfig; cfg != "" {
if cm, err := util.GetConfigMap(ctx, cfg, p.Namespace, client); err != nil {
// If the custom kfp-launcher configmap is not available, that is OK
if !apierrs.IsNotFound(err) {
log.Error(err, fmt.Sprintf("Encountered error when attempting to fetch ConfigMap: [%s], Error: %v", cfg, err))
return err
}
} else {
// Consume all the required information.
dataValues := util.GetConfigMapValues(cm)
p.CustomKfpLauncherConfigMap.Data = strings.Join(dataValues, " ")
}
}
// 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 48533a7

Please sign in to comment.