Skip to content

Commit

Permalink
Infer secure based on the scheme provided.
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 11, 2023
1 parent b0cf003 commit f902911
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/dspipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ type ExternalStorage struct {
Bucket string `json:"bucket"`
Scheme string `json:"scheme"`
*S3CredentialSecret `json:"s3CredentialsSecret"`
// +kubebuilder:default:=true
// +kubebuilder:validation:Optional
Secure bool `json:"secure"`
// +kubebuilder:validation:Optional
Port string `json:"port"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ spec:
type: object
scheme:
type: string
secure:
default: true
type: boolean
required:
- bucket
- host
Expand Down
2 changes: 2 additions & 0 deletions config/internal/apiserver/deployment.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
secretKeyRef:
key: "{{.ObjectStorageConnection.CredentialsSecret.SecretKey}}"
name: "{{.ObjectStorageConnection.CredentialsSecret.SecretName}}"
- name: OBJECTSTORECONFIG_SECURE
value: "{{.ObjectStorageConnection.Secure}}"
- name: MINIO_SERVICE_SERVICE_HOST
value: "{{.ObjectStorageConnection.Host}}"
- name: MINIO_SERVICE_SERVICE_PORT
Expand Down
1 change: 1 addition & 0 deletions config/internal/minio/secret.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
stringData:
host: "{{.ObjectStorageConnection.Host}}"
port: "{{.ObjectStorageConnection.Port}}"
secure: "{{.ObjectStorageConnection.Secure}}"
data:
accesskey: "{{.ObjectStorageConnection.AccessKeyID}}"
secretkey: "{{.ObjectStorageConnection.SecretAccessKey}}"
1 change: 1 addition & 0 deletions controllers/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const (
MinioHostPrefix = "minio"
MinioPort = "9000"
MinioScheme = "http"
MinioSecure = false
MinioDefaultBucket = "mlpipeline"
MinioPVCSize = "10Gi"

Expand Down
9 changes: 9 additions & 0 deletions controllers/dspipeline_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type ObjectStorageConnection struct {
Host string
Port string
Scheme string
Secure bool
Endpoint string // scheme://host:port
AccessKeyID string
SecretAccessKey string
Expand Down Expand Up @@ -234,6 +235,11 @@ func (p *DSPAParams) SetupObjectParams(ctx context.Context, dsp *dspa.DataScienc
p.ObjectStorageConnection.Bucket = dsp.Spec.ObjectStorage.ExternalStorage.Bucket
p.ObjectStorageConnection.Host = dsp.Spec.ObjectStorage.ExternalStorage.Host
p.ObjectStorageConnection.Scheme = dsp.Spec.ObjectStorage.ExternalStorage.Scheme
if p.ObjectStorageConnection.Scheme == "https" {
p.ObjectStorageConnection.Secure = true
} else {
p.ObjectStorageConnection.Secure = false
}
// Port can be empty, which is fine.
p.ObjectStorageConnection.Port = dsp.Spec.ObjectStorage.ExternalStorage.Port
customCreds = dsp.Spec.ObjectStorage.ExternalStorage.S3CredentialSecret
Expand Down Expand Up @@ -263,6 +269,8 @@ func (p *DSPAParams) SetupObjectParams(ctx context.Context, dsp *dspa.DataScienc
)
p.ObjectStorageConnection.Port = config.MinioPort
p.ObjectStorageConnection.Scheme = config.MinioScheme
p.ObjectStorageConnection.Secure = config.MinioSecure

if p.Minio.S3CredentialSecret != nil {
customCreds = p.Minio.S3CredentialSecret
}
Expand Down Expand Up @@ -341,6 +349,7 @@ func (p *DSPAParams) SetupObjectParams(ctx context.Context, dsp *dspa.DataScienc
}

return nil

}

func (p *DSPAParams) SetupMLMD(ctx context.Context, dsp *dspa.DataSciencePipelinesApplication, client client.Client, log logr.Logger) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
secretKeyRef:
key: "secretkey"
name: "mlpipeline-minio-artifact"
- name: OBJECTSTORECONFIG_SECURE
value: "false"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-testdsp0.default.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
secretKeyRef:
key: "secretkey"
name: "mlpipeline-minio-artifact"
- name: OBJECTSTORECONFIG_SECURE
value: "false"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-testdsp2.default.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
secretKeyRef:
key: "secretkey"
name: "mlpipeline-minio-artifact"
- name: OBJECTSTORECONFIG_SECURE
value: "true"
- name: MINIO_SERVICE_SERVICE_HOST
value: "teststoragehost3"
- name: MINIO_SERVICE_SERVICE_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ data:
host: dGVzdHN0b3JhZ2Vob3N0Mw==
port: ODA=
secretkey: dGVzdHNlY3JldGtleXZhbHVlMw==
secure: dHJ1ZQ==
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
secretKeyRef:
key: "secretkey"
name: "mlpipeline-minio-artifact"
- name: OBJECTSTORECONFIG_SECURE
value: "false"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-testdsp4.default.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
secretKeyRef:
key: "secretkey"
name: "mlpipeline-minio-artifact"
- name: OBJECTSTORECONFIG_SECURE
value: "false"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-testdsp5.default.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
Expand Down

0 comments on commit f902911

Please sign in to comment.