Skip to content

Commit

Permalink
fix: stop discovery errors from halting chart rendering.
Browse files Browse the repository at this point in the history
This blocks a particular error (caused by upstream discovery client),
printing a warning instead of failing. It's not a great solution, but is
a stop-gap until Client-Go gets fixed.

Closes helm#6361

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
  • Loading branch information
technosophos committed Nov 7, 2019
1 parent 43acbfe commit 0cda232
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package action
import (
"path"
"regexp"
"strings"

"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -109,9 +110,19 @@ func (c *Configuration) getCapabilities() (*chartutil.Capabilities, error) {
if err != nil {
return nil, errors.Wrap(err, "could not get server version from Kubernetes")
}
// There is a bug in upstream that causes this to fail when there are orphaned API services.
// To stop #6361 from killing charts, we will for now do some error scanning and print
// a warning when the above is the cause.
// See https://github.com/kubernetes/kubernetes/issues/72051#issuecomment-521157642
apiVersions, err := GetVersionSet(dc)
if err != nil {
return nil, errors.Wrap(err, "could not get apiVersions from Kubernetes")
if strings.Contains(err.Error(), "unable to retrieve the complete list") {
c.Log("WARNING: The Kubernetes server has an orphaned API server. Server reports: %s", err)
c.Log("WARNING: To fix this, kubectl delete apiservice <service-name>")
c.Log("WARNING: Until this is fixed, Helm will not be able to determine all of the types registered on this server.")
} else {
return nil, errors.Wrap(err, "could not get apiVersions from Kubernetes")
}
}

c.Capabilities = &chartutil.Capabilities{
Expand Down

0 comments on commit 0cda232

Please sign in to comment.