Skip to content

Commit

Permalink
fix: stop discovery errors from bootstrap process (#1465)
Browse files Browse the repository at this point in the history
  • Loading branch information
drivebyer authored Jun 29, 2023
1 parent 4a60456 commit e1f2a7a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controller/certificates/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

certificatesV1 "k8s.io/api/certificates/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
)
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 e1f2a7a

Please sign in to comment.