From 3428695c9ac1737cb92400d2ed38a6eaa709d770 Mon Sep 17 00:00:00 2001 From: vmudadla Date: Thu, 11 Apr 2024 11:25:55 -0500 Subject: [PATCH] Updated DBExtraParams --- controllers/config/defaults.go | 4 +++- controllers/dspipeline_params.go | 13 ++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/controllers/config/defaults.go b/controllers/config/defaults.go index 77a73574c..1f7c02ba0 100644 --- a/controllers/config/defaults.go +++ b/controllers/config/defaults.go @@ -189,6 +189,8 @@ var ( MlmdWriterResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi")) ) +type DBExtraParams map[string]string + func createResourceRequirement(RequestsCPU resource.Quantity, RequestsMemory resource.Quantity, LimitsCPU resource.Quantity, LimitsMemory resource.Quantity) dspav1alpha1.ResourceRequirements { return dspav1alpha1.ResourceRequirements{ Requests: &dspav1alpha1.Resources{ @@ -225,7 +227,7 @@ func GetCABundleFileMountPath() string { return fmt.Sprintf("%s/%s", CustomCABundleRootMountPath, CustomDSPTrustedCAConfigMapKey) } -func GetDefaultDBExtraParams(params interface{}, log logr.Logger) (string, error) { +func GetDefaultDBExtraParams(params DBExtraParams, log logr.Logger) (string, error) { extraParamsJson, err := json.Marshal(params) if err != nil { log.Info(fmt.Sprintf("Error marshaling TLS configuration to JSON: %v", err)) diff --git a/controllers/dspipeline_params.go b/controllers/dspipeline_params.go index 5f9f26aa9..d009527e9 100644 --- a/controllers/dspipeline_params.go +++ b/controllers/dspipeline_params.go @@ -89,11 +89,6 @@ type DBConnection struct { Password string ExtraParams string } - -type DBExtraParams struct { - TLS string `json:"tls"` -} - type ObjectStorageConnection struct { Bucket string CredentialsSecret *dspa.S3CredentialSecret @@ -264,8 +259,8 @@ func (p *DSPAParams) SetupDBParams(ctx context.Context, dsp *dspa.DataSciencePip // Assume default external connection is tls enabled // user can override this via CustomExtraParams field - tlsParams := DBExtraParams{ - TLS: "true", + tlsParams := config.DBExtraParams{ + "tls": "true", } dbExtraParams, err := config.GetDefaultDBExtraParams(tlsParams, log) if err != nil { @@ -313,8 +308,8 @@ func (p *DSPAParams) SetupDBParams(ctx context.Context, dsp *dspa.DataSciencePip p.DBConnection.Username = p.MariaDB.Username p.DBConnection.DBName = p.MariaDB.DBName // By Default OOB mariadb is not tls enabled - tlsParams := DBExtraParams{ - TLS: "false", + tlsParams := config.DBExtraParams{ + "tls": "false", } dbExtraParams, err := config.GetDefaultDBExtraParams(tlsParams, log) if err != nil {