Skip to content

Commit

Permalink
fix: stop discovery errors from bootstrap process
Browse files Browse the repository at this point in the history
  • Loading branch information
drivebyer committed Feb 24, 2023
1 parent 70d38cc commit 9c4502d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controller/cluster/certificates/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package certificates

import (
"context"
"k8s.io/client-go/discovery"
"os"
"strings"
"sync"
Expand Down Expand Up @@ -81,7 +82,13 @@ func GetCertificatesAPIVersion(clientSet kubernetes.Interface) CSRVersion {
default:
apiVersions, err := clientSet.Discovery().ServerPreferredResources()
if err != nil {
panic(err)
// If extension API server is not available, we emit a warning and continue.
if discovery.IsGroupDiscoveryFailedError(err) {
klog.Warningf("The Kubernetes server has an orphaned API service. Server reports: %s", err)
klog.Warningf("To fix this, check related API Server or kubectl delete apiservice <service-name>")
} else {
panic(err)
}
}
for _, api := range apiVersions {
// if certificates v1beta1 is present operator will use that api by default
Expand Down

0 comments on commit 9c4502d

Please sign in to comment.