Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Update pkg/reconciler/certificate/resources/cert_manager_certificate.go
Browse files Browse the repository at this point in the history
Co-authored-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
  • Loading branch information
ReToCode and nak3 committed Nov 14, 2023
1 parent aa66b6b commit c699f69
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pkg/reconciler/certificate/resources/cert_manager_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,15 @@ func MakeCertManagerCertificate(cmConfig *config.CertManagerConfig, knCert *v1al

dnsNames = append(dnsNames, knCert.Spec.DNSNames...)

var certType string
var ok bool
// default to CertificateExternalDomain if label is not set
if certType, ok = knCert.Labels[networking.CertificateTypeLabelKey]; !ok {
certType = string(netapi.CertificateExternalDomain)
// default to CertificateExternalDomain
certType := netapi.CertificateExternalDomain
if val, ok := knCert.Labels[networking.CertificateTypeLabelKey]; ok {
certType = netapi.CertificateType(val)
}

var issuerRef cmeta.ObjectReference
switch certType {
case string(netapi.CertificateClusterLocalDomain):
case netapi.CertificateClusterLocalDomain:
if cmConfig.ClusterLocalIssuerRef == nil {
return nil, &apis.Condition{
Type: IssuerNotSetCondition,
Expand All @@ -130,7 +129,7 @@ func MakeCertManagerCertificate(cmConfig *config.CertManagerConfig, knCert *v1al
}
issuerRef = *cmConfig.ClusterLocalIssuerRef

case string(netapi.CertificateSystemInternal):
case netapi.CertificateSystemInternal:
if cmConfig.SystemInternalIssuerRef == nil {
return nil, &apis.Condition{
Type: IssuerNotSetCondition,
Expand All @@ -141,7 +140,7 @@ func MakeCertManagerCertificate(cmConfig *config.CertManagerConfig, knCert *v1al
}
issuerRef = *cmConfig.SystemInternalIssuerRef

case string(netapi.CertificateExternalDomain):
case netapi.CertificateExternalDomain:
if cmConfig.IssuerRef == nil {
return nil, &apis.Condition{
Type: IssuerNotSetCondition,
Expand Down

0 comments on commit c699f69

Please sign in to comment.