Skip to content

Commit

Permalink
DSPO to manage credential secrets if using deployed storage/db
Browse files Browse the repository at this point in the history
  • Loading branch information
gmfrasca committed Jun 14, 2023
1 parent 0055509 commit 24a957a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
10 changes: 10 additions & 0 deletions config/internal/mariadb/secret.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: "{{.DBConnection.CredentialsSecret.Name}}"
namespace: {{.Namespace}}
labels:
app: mariadb-{{.Name}}
component: data-science-pipelines
data:
password: {{.DBConnection.Password}}
15 changes: 15 additions & 0 deletions config/internal/minio/secret.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Secret
metadata:
name: "{{.ObjectStorageConnection.CredentialsSecret.SecretName}}"
namespace: {{.Namespace}}
labels:
app: minio-{{.Name}}
component: data-science-pipelines
stringData:
host: "{{.ObjectStorageConnection.Host}}"
port: "{{.ObjectStorageConnection.Port}}"
secure: "{{.ObjectStorageConnection.Secure}}"
data:
accesskey: "{{.ObjectStorageConnection.AccessKeyID}}"
secretkey: "{{.ObjectStorageConnection.SecretAccessKey}}"
5 changes: 3 additions & 2 deletions controllers/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import (
dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
)

var dbTemplates = []string{
var mariadbTemplates = []string{
"mariadb/deployment.yaml.tmpl",
"mariadb/pvc.yaml.tmpl",
"mariadb/sa.yaml.tmpl",
"mariadb/service.yaml.tmpl",
"mariadb/secret.yaml.tmpl",
}

func (r *DSPAReconciler) ReconcileDatabase(ctx context.Context, dsp *dspav1alpha1.DataSciencePipelinesApplication,
Expand All @@ -45,7 +46,7 @@ func (r *DSPAReconciler) ReconcileDatabase(ctx context.Context, dsp *dspav1alpha
log.Info("Using externalDB, bypassing database deployment.")
} else if deployMariaDB {
log.Info("Applying mariaDB resources.")
for _, template := range dbTemplates {
for _, template := range mariadbTemplates {
err := r.Apply(dsp, params, template)
if err != nil {
return err
Expand Down
5 changes: 3 additions & 2 deletions controllers/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
)

var storageTemplates = []string{
var minioTemplates = []string{
"minio/deployment.yaml.tmpl",
"minio/pvc.yaml.tmpl",
"minio/service.yaml.tmpl",
"minio/secret.yaml.tmpl",
}

// ReconcileStorage will set up Storage Connection.
Expand All @@ -45,7 +46,7 @@ func (r *DSPAReconciler) ReconcileStorage(ctx context.Context, dsp *dspav1alpha1
log.Info("Using externalStorage, bypassing object storage deployment.")
} else if deployMinio {
log.Info("Applying object storage resources.")
for _, template := range storageTemplates {
for _, template := range minioTemplates {
err := r.Apply(dsp, params, template)
if err != nil {
return err
Expand Down

0 comments on commit 24a957a

Please sign in to comment.