Skip to content

Commit 6e0fe0a

Browse files
Merge pull request opendatahub-io#108 from HumairAK/optional-port
Make object store port/secure scheme optional.
2 parents ea00418 + a151e3e commit 6e0fe0a

File tree

10 files changed

+83
-15
lines changed

10 files changed

+83
-15
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ Data Science Pipeline stacks onto individual OCP namespaces.
99
1. [Pre-requisites](#pre-requisites)
1010
2. [Deploy the Operator via ODH](#deploy-the-operator-via-odh)
1111
3. [Deploy the Operator standalone](#deploy-the-operator-standalone)
12-
4. [Deploy DSP instance](#deploy-dsp-instance)
13-
1. [Deploy another DSP instance](#deploy-another-dsp-instance)
12+
4. [Deploy DSPA instance](#deploy-dsp-instance)
13+
1. [Deploy another DSPA instance](#deploy-another-dsp-instance)
14+
2. [Deploy a DSPA with custom credentials](#deploy-a-dsp-with-custom-credentials)
15+
3. [Deploy a DSPA with External Object Storage](#deploy-a-dsp-with-external-object-storage)
1416
2. [DataSciencePipelinesApplication Component Overview](#datasciencepipelinesapplication-component-overview)
1517
3. [Using a DataSciencePipelinesApplication](#using-a-datasciencepipelinesapplication)
1618
1. [Using the Graphical UI](#using-the-graphical-ui)
@@ -171,6 +173,22 @@ Notice the introduction of 2 `secrets` `testdbsecret`, `teststoragesecret` and 2
171173

172174
These can be configured by the end user as needed.
173175

176+
### Deploy a DSP with external Object Storage
177+
178+
To specify a custom Object Storage (example an AWS s3 bucket) you will need to provide DSPO with your S3 credentials in
179+
the form of a k8s `Secret`, see an example of such a secret here `config/samples/external-object-storage/storage-creds.yaml`.
180+
181+
DSPO can deploy a DSPA instance and use this S3 bucket for storing its metadata and pipeline artifacts. A sample
182+
configuration for a DSPA that does this is found in `config/samples/external-object-storage`, you can update this as
183+
needed, and deploy this DSPA by running the following:
184+
185+
```bash
186+
DSP_Namespace_3=test-ds-project-4
187+
oc new-project ${DSP_Namespace_4}
188+
cd ${WORKING_DIR}/config/samples/external-object-storage
189+
kustomize build . | oc -n ${DSP_Namespace_3} apply -f -
190+
```
191+
174192
# DataSciencePipelinesApplication Component Overview
175193

176194
When a `DataSciencePipelinesApplication` is deployed, the following components are deployed in the target namespace:

api/v1alpha1/dspipeline_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,12 @@ type ExternalStorage struct {
194194
Host string `json:"host"`
195195
Bucket string `json:"bucket"`
196196
Scheme string `json:"scheme"`
197-
Port string `json:"port"`
198197
*S3CredentialSecret `json:"s3CredentialsSecret"`
198+
// +kubebuilder:default:=true
199+
// +kubebuilder:validation:Optional
200+
Secure bool `json:"secure"`
201+
// +kubebuilder:validation:Optional
202+
Port string `json:"port"`
199203
}
200204

201205
type S3CredentialSecret struct {

config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,12 @@ spec:
311311
type: object
312312
scheme:
313313
type: string
314+
secure:
315+
default: true
316+
type: boolean
314317
required:
315318
- bucket
316319
- host
317-
- port
318320
- s3CredentialsSecret
319321
- scheme
320322
type: object
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
2+
kind: DataSciencePipelinesApplication
3+
metadata:
4+
name: sample
5+
spec:
6+
objectStorage:
7+
externalStorage:
8+
bucket: rhods-dsp-dev
9+
host: s3.amazonaws.com
10+
s3CredentialsSecret:
11+
accessKey: k8saccesskey
12+
secretKey: k8ssecretkey
13+
secretName: aws-bucket-creds
14+
scheme: https
15+
# Optional
16+
mlpipelineUI:
17+
# Image field is required
18+
image: 'quay.io/opendatahub/odh-ml-pipelines-frontend-container:beta-ui'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- dspa.yaml
5+
- storage-creds.yaml
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: aws-bucket-creds
5+
labels:
6+
opendatahub.io/dashboard: 'true'
7+
opendatahub.io/managed: 'true'
8+
annotations:
9+
opendatahub.io/connection-type: s3
10+
openshift.io/display-name: AWS S3 Connection
11+
stringData:
12+
k8saccesskey: someaccesskey
13+
k8ssecretkey: somesecretkey
14+
type: Opaque

controllers/config/defaults.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ const (
4545
MinioDefaultBucket = "mlpipeline"
4646
MinioPVCSize = "10Gi"
4747

48-
ObjectStoreConnectionSecure = false
49-
ObjectStorageSecretName = "mlpipeline-minio-artifact" // hardcoded in kfp-tekton
50-
ObjectStorageAccessKey = "accesskey"
51-
ObjectStorageSecretKey = "secretkey"
48+
ObjectStorageSecretName = "mlpipeline-minio-artifact" // hardcoded in kfp-tekton
49+
ObjectStorageAccessKey = "accesskey"
50+
ObjectStorageSecretKey = "secretkey"
5251
)
5352

5453
// DSPO Config File Paths

controllers/dspipeline_params.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,15 @@ func (p *DSPAParams) SetupObjectParams(ctx context.Context, dsp *dspa.DataScienc
221221
AccessKey: config.ObjectStorageAccessKey,
222222
SecretKey: config.ObjectStorageSecretKey,
223223
}
224-
p.ObjectStorageConnection.Secure = config.ObjectStoreConnectionSecure
225224

226225
if usingExternalObjectStorage {
227226
// Assume validation for CR ensures these values exist
228227
p.ObjectStorageConnection.Bucket = dsp.Spec.ObjectStorage.ExternalStorage.Bucket
229228
p.ObjectStorageConnection.Host = dsp.Spec.ObjectStorage.ExternalStorage.Host
230-
p.ObjectStorageConnection.Port = dsp.Spec.ObjectStorage.ExternalStorage.Port
231229
p.ObjectStorageConnection.Scheme = dsp.Spec.ObjectStorage.ExternalStorage.Scheme
230+
p.ObjectStorageConnection.Secure = dsp.Spec.ObjectStorage.ExternalStorage.Secure
231+
// Port can be empty, which is fine.
232+
p.ObjectStorageConnection.Port = dsp.Spec.ObjectStorage.ExternalStorage.Port
232233
customCreds = dsp.Spec.ObjectStorage.ExternalStorage.S3CredentialSecret
233234
} else {
234235
if p.Minio == nil {
@@ -262,15 +263,22 @@ func (p *DSPAParams) SetupObjectParams(ctx context.Context, dsp *dspa.DataScienc
262263
}
263264

264265
endpoint := fmt.Sprintf(
265-
"%s://%s:%s",
266+
"%s://%s",
266267
p.ObjectStorageConnection.Scheme,
267268
p.ObjectStorageConnection.Host,
268-
p.ObjectStorageConnection.Port,
269269
)
270270

271+
if p.ObjectStorageConnection.Port != "" {
272+
endpoint = fmt.Sprintf(
273+
"%s:%s",
274+
endpoint,
275+
p.ObjectStorageConnection.Port,
276+
)
277+
}
278+
271279
p.ObjectStorageConnection.Endpoint = endpoint
272280

273-
// Secret where DB credentials reside on cluster
281+
// Secret where credentials reside on cluster
274282
var credsSecretName string
275283
var credsAccessKey string
276284
var credsSecretKey string

controllers/testdata/declarative/case_3/expected/created/apiserver_deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ spec:
129129
key: "secretkey"
130130
name: "mlpipeline-minio-artifact"
131131
- name: OBJECTSTORECONFIG_SECURE
132-
value: "false"
132+
value: "true"
133133
- name: MINIO_SERVICE_SERVICE_HOST
134134
value: "teststoragehost3"
135135
- name: MINIO_SERVICE_SERVICE_PORT

controllers/testdata/declarative/case_3/expected/created/storage_secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ data:
1111
host: dGVzdHN0b3JhZ2Vob3N0Mw==
1212
port: ODA=
1313
secretkey: dGVzdHNlY3JldGtleXZhbHVlMw==
14-
secure: ZmFsc2U=
14+
secure: dHJ1ZQ==
1515
type: Opaque

0 commit comments

Comments
 (0)