Skip to content

Commit

Permalink
Expose Medusas ssl_verify option
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvoncek committed Jan 11, 2024
1 parent b02da26 commit 9067008
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis/medusa/v1alpha1/medusa_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ type Storage struct {
// +optional
Secure bool `json:"secure,omitempty"`

// When using SSL, whether to also verify the certificate.
// +optional
SslVerify bool `json:"sslVerify,omitempty"`

// Age after which orphan sstables can be deleted from the storage backend.
// Protects from race conditions between purge and ongoing backups.
// Defaults to 10 days.
Expand Down
5 changes: 5 additions & 0 deletions pkg/medusa/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func CreateMedusaIni(kc *k8ss.K8ssandraCluster) string {
{{- else }}
secure = True
{{- end }}
{{- if not .Spec.Medusa.StorageProperties.SslVerify }}
ssl_verify = False
{{- else }}
ssl_verify = True
{{- end }}
{{- if .Spec.Medusa.StorageProperties.BackupGracePeriodInDays }}
backup_grace_period_in_days = {{ .Spec.Medusa.StorageProperties.BackupGracePeriodInDays }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions pkg/medusa/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ func testMedusaIniSecured(t *testing.T) {
Region: "us-east-1",
Port: 9001,
Secure: true,
SslVerify: true,
BackupGracePeriodInDays: 7,
},
CassandraUserSecretRef: corev1.LocalObjectReference{
Expand All @@ -212,6 +213,7 @@ func testMedusaIniSecured(t *testing.T) {
assert.Contains(t, medusaIni, "region = us-east-1")
assert.Contains(t, medusaIni, "port = 9001")
assert.Contains(t, medusaIni, "secure = True")
assert.Contains(t, medusaIni, "ssl_verify = True")
assert.Contains(t, medusaIni, "backup_grace_period_in_days = 7")
}

Expand Down Expand Up @@ -276,6 +278,7 @@ func testMedusaIniUnsecured(t *testing.T) {
assert.Contains(t, medusaIni, "region = us-east-1")
assert.Contains(t, medusaIni, "port = 9001")
assert.Contains(t, medusaIni, "secure = True")
assert.Contains(t, medusaIni, "ssl_verify = False")
assert.Contains(t, medusaIni, "backup_grace_period_in_days = 7")
}

Expand Down

0 comments on commit 9067008

Please sign in to comment.