Skip to content

Commit

Permalink
Update druid
Browse files Browse the repository at this point in the history
Signed-off-by: Tapajit Chandra Paul <tapajit@appscode.com>
  • Loading branch information
tapojit047 committed Oct 28, 2024
1 parent 1e6004a commit 5401916
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions apis/kubedb/v1alpha2/druid_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha2
import (
"context"
"fmt"
"path/filepath"
"strconv"
"strings"

Expand Down Expand Up @@ -583,6 +584,18 @@ func (d *Druid) SetDefaults() {
}
d.Spec.Monitor.SetDefaults()
}

if d.Spec.EnableSSL {
d.SetTLSDefaults()
}
}

func (d *Druid) SetTLSDefaults() {
if d.Spec.TLS == nil || d.Spec.TLS.IssuerRef == nil {
return
}
d.Spec.TLS.Certificates = kmapi.SetMissingSecretNameForCertificate(d.Spec.TLS.Certificates, string(DruidServerCert), d.CertificateName(DruidServerCert))
d.Spec.TLS.Certificates = kmapi.SetMissingSecretNameForCertificate(d.Spec.TLS.Certificates, string(DruidClientCert), d.CertificateName(DruidClientCert))
}

func (d *Druid) SetDefaultsToMetadataStorage() {
Expand Down Expand Up @@ -785,3 +798,16 @@ func (d *Druid) GetZooKeeperName() string {
func (d *Druid) GetInitConfigMapName() string {
return d.OffShootName() + "-init-script"
}

// CertSecretVolumeName returns the CertSecretVolumeName
// Values will be like: client-certs, server-certs etc.
func (d *Druid) CertSecretVolumeName(alias DruidCertificateAlias) string {
return string(alias) + "-certs"
}

// CertSecretVolumeMountPath returns the CertSecretVolumeMountPath
// if configDir is "/var/druid/ssl",
// mountPath will be, "/var/druid/ssl/<alias>".
func (d *Druid) CertSecretVolumeMountPath(configDir string, cert string) string {
return filepath.Join(configDir, cert)
}

0 comments on commit 5401916

Please sign in to comment.