Skip to content

Commit

Permalink
Add OvnDb endpoint to TLS APIService
Browse files Browse the repository at this point in the history
  • Loading branch information
olliewalsh committed Feb 20, 2024
1 parent 641ba4d commit ebaab56
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/certmanager/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
const (
// RootCAIssuerInternalLabel for internal RootCA to issue internal TLS Certs
RootCAIssuerInternalLabel = "osp-rootca-issuer-internal"
// RootCAIssuerOvnDBLabel for internal RootCA to issue OVN DB TLS Certs
RootCAIssuerOvnDBLabel = "osp-rootca-issuer-ovndb"
)

// Issuer -
Expand Down
2 changes: 2 additions & 0 deletions modules/common/service/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const (
ProtocolHTTPS Protocol = "https"
// ProtocolNone -
ProtocolNone Protocol = ""
// OvnDbCA - fake endpoint for OVN DB internal CA
OvnDbCA Endpoint = "ovndb"
)

func (e *Endpoint) String() string {
Expand Down
14 changes: 13 additions & 1 deletion modules/common/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ type APIService struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Internal GenericService - holds the secret for the internal endpoint
Internal GenericService `json:"internal,omitempty"`

// +kubebuilder:validation:optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// OVNDb GenericService - holds the secret for the OVNDb client cert
OvnDb GenericService `json:"ovndb,omitempty"`
}

// GenericService contains server-specific TLS secret or issuer
Expand Down Expand Up @@ -163,7 +168,7 @@ func (a *APIService) ValidateCertSecrets(
) (string, ctrl.Result, error) {
var svc GenericService
certHashes := map[string]env.Setter{}
for _, endpt := range []service.Endpoint{service.EndpointInternal, service.EndpointPublic} {
for _, endpt := range []service.Endpoint{service.EndpointInternal, service.EndpointPublic, service.OvnDbCA} {
switch endpt {
case service.EndpointPublic:
if !a.Enabled(service.EndpointPublic) {
Expand All @@ -178,6 +183,13 @@ func (a *APIService) ValidateCertSecrets(
}

svc = a.Internal

case service.OvnDbCA:
if !a.Enabled(service.EndpointInternal) {
continue
}

svc = a.OvnDb
}

hash, ctrlResult, err := svc.ValidateCertSecret(ctx, h, namespace)
Expand Down

0 comments on commit ebaab56

Please sign in to comment.