Skip to content

Commit

Permalink
csr: Wait for availability of the csr resource in getCSRList
Browse files Browse the repository at this point in the history
This will ensure getCSRList() returns a list of CSRs even if the
apiserver is not ready yet when it's called.
  • Loading branch information
cfergeau authored and praveenkumar committed Sep 3, 2021
1 parent 165faa6 commit 4e8017e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/crc/cluster/csr.go
Expand Up @@ -79,7 +79,10 @@ func deleteCSR(ocConfig oc.Config, expectedSignerName string) error {

func getCSRList(ocConfig oc.Config) (*k8scerts.CertificateSigningRequestList, error) {
var csrs k8scerts.CertificateSigningRequestList
output, stderr, err := ocConfig.RunOcCommand("get", "csr", "-ojson")
if err := WaitForOpenshiftResource(ocConfig, "csr"); err != nil {
return nil, err
}
output, stderr, err := ocConfig.WithFailFast().RunOcCommand("get", "csr", "-ojson")
if err != nil {
return nil, fmt.Errorf("Failed to get all certificate signing requests: %v %s", err, stderr)
}
Expand Down

0 comments on commit 4e8017e

Please sign in to comment.