Skip to content

Commit

Permalink
rabbitmq: Fix server cert name (pt 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianunruh committed Jul 19, 2024
1 parent 9a2530c commit 22ca46f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions api/v1beta1/pki.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1beta1

import (
"fmt"
"strings"

corev1 "k8s.io/api/core/v1"
)
Expand Down Expand Up @@ -40,10 +41,10 @@ func tlsProxyDefault(spec TLSProxySpec) TLSProxySpec {
return spec
}

func tlsServerDefault(spec TLSServerSpec, name, component string) TLSServerSpec {
func tlsServerDefault(spec TLSServerSpec, name ...string) TLSServerSpec {
if spec.Secret == "" {
if spec.Issuer.Name != "" {
spec.Secret = fmt.Sprintf("%s-%s-tls", name, component)
spec.Secret = fmt.Sprintf("%s-tls", strings.Join(name, "-"))
}
}
return spec
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/rabbitmq_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r *RabbitMQ) Default() {

r.Spec.Image = imageDefault(r.Spec.Image, DefaultRabbitMQImage)
r.Spec.Volume = volumeDefault(r.Spec.Volume)
r.Spec.TLS = tlsServerDefault(r.Spec.TLS, r.Name, "server")
r.Spec.TLS = tlsServerDefault(r.Spec.TLS, r.Name)
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
Expand Down

0 comments on commit 22ca46f

Please sign in to comment.