Skip to content

Commit

Permalink
change check for CRs to certs
Browse files Browse the repository at this point in the history
Signed-off-by: Ashley Davis <[email protected]>
  • Loading branch information
SgtCoDFish committed Sep 30, 2024
1 parent 177d7cf commit c0b0dd6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/cmd/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,21 @@ func Command() *cobra.Command {
return fmt.Errorf("connected to the Kubernetes API, but the Openshift Route v1 CRD does not appear to be installed")
}

// Check if v1 cert-manager CertificateRequests exist in the API server
apiServerHasCertificateRequests := false
// Check if v1 cert-manager Certificates exist in the API server
apiServerHasCertificates := false
cmResources, err := cl.Discovery().ServerResourcesForGroupVersion("cert-manager.io/v1")
if err != nil {
return fmt.Errorf("couldn't check if cert-manager.io/v1 exists in the kubernetes API: %w", err)
}

for _, r := range cmResources.APIResources {
if r.Kind == "CertificateRequest" {
apiServerHasCertificateRequests = true
if r.Kind == "Certificate" {
apiServerHasCertificates = true
break
}
}
if !apiServerHasCertificateRequests {

if !apiServerHasCertificates {
return fmt.Errorf("connected to the Kubernetes API, but the cert-manager v1 CRDs do not appear to be installed")
}

Expand Down

0 comments on commit c0b0dd6

Please sign in to comment.