Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop discovery errors from bootstrap process #1465

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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