diff --git a/api/v1alpha1/dspipeline_types.go b/api/v1alpha1/dspipeline_types.go index 4bdfde796..44578faa7 100644 --- a/api/v1alpha1/dspipeline_types.go +++ b/api/v1alpha1/dspipeline_types.go @@ -215,9 +215,8 @@ type ExternalStorage struct { Bucket string `json:"bucket"` Scheme string `json:"scheme"` *S3CredentialSecret `json:"s3CredentialsSecret"` - // +kubebuilder:default:=true // +kubebuilder:validation:Optional - Secure bool `json:"secure"` + Secure *bool `json:"secure"` // +kubebuilder:validation:Optional Port string `json:"port"` } diff --git a/config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml b/config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml index b8d4db52f..33e312e40 100644 --- a/config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml +++ b/config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml @@ -457,7 +457,6 @@ spec: scheme: type: string secure: - default: true type: boolean required: - bucket diff --git a/controllers/config/defaults.go b/controllers/config/defaults.go index fdf841b9d..7c98fb5a8 100644 --- a/controllers/config/defaults.go +++ b/controllers/config/defaults.go @@ -42,6 +42,7 @@ const ( MinioHostPrefix = "minio" MinioPort = "9000" MinioScheme = "http" + MinioSecure = false MinioDefaultBucket = "mlpipeline" MinioPVCSize = "10Gi" diff --git a/controllers/dspipeline_params.go b/controllers/dspipeline_params.go index bac9946b3..5a2d81a5b 100644 --- a/controllers/dspipeline_params.go +++ b/controllers/dspipeline_params.go @@ -63,10 +63,10 @@ type DBConnection struct { type ObjectStorageConnection struct { Bucket string CredentialsSecret *dspa.S3CredentialSecret - Secure bool Host string Port string Scheme string + Secure *bool Endpoint string // scheme://host:port AccessKeyID string SecretAccessKey string @@ -105,6 +105,10 @@ func passwordGen(n int) string { return string(b) } +func BoolPointer(b bool) *bool { + return &b +} + // SetupDBParams Populates the DB connection Parameters. // If an external secret is specified, SetupDBParams will retrieve DB credentials from it. // If DSPO is managing a dynamically created secret, then SetupDBParams generates the creds. @@ -235,7 +239,15 @@ 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 - p.ObjectStorageConnection.Secure = dsp.Spec.ObjectStorage.ExternalStorage.Secure + + if dsp.Spec.ObjectStorage.ExternalStorage.Secure == nil { + if p.ObjectStorageConnection.Scheme == "https" { + p.ObjectStorageConnection.Secure = BoolPointer(true) + } else { + p.ObjectStorageConnection.Secure = BoolPointer(false) + } + } + // Port can be empty, which is fine. p.ObjectStorageConnection.Port = dsp.Spec.ObjectStorage.ExternalStorage.Port customCreds = dsp.Spec.ObjectStorage.ExternalStorage.S3CredentialSecret @@ -265,6 +277,7 @@ func (p *DSPAParams) SetupObjectParams(ctx context.Context, dsp *dspa.DataScienc ) p.ObjectStorageConnection.Port = config.MinioPort p.ObjectStorageConnection.Scheme = config.MinioScheme + if p.Minio.S3CredentialSecret != nil { customCreds = p.Minio.S3CredentialSecret } @@ -343,6 +356,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 {