cilium/cilium · error

no RESTClientGetter for Helm Values

Error message

no RESTClientGetter for Helm Values

What it means

Returned by `Client.GetHelmValues` when `c.RESTClientGetter` is nil. This function is used by cilium-cli sysdump to read Helm release values directly from the cluster; Helm's `action.Configuration.Init` requires a RESTClientGetter to build its Kubernetes client, and the Client was constructed without one (e.g. client created only from a kubeconfig without the getter stored, or a slim/agent client instance).

Source

Thrown at cilium-cli/k8s/client.go:1150

		if err == nil {
			return &ver, nil
		}
	}
	return nil, fmt.Errorf("unable to parse Kubernetes version (got %s): %w", sv.String(), err)
}

func (c *Client) GetIngress(ctx context.Context, namespace string, name string, opts metav1.GetOptions) (*networkingv1.Ingress, error) {
	return c.Clientset.NetworkingV1().Ingresses(namespace).Get(ctx, name, opts)
}

func (c *Client) CreateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress, opts metav1.CreateOptions) (*networkingv1.Ingress, error) {
	return c.Clientset.NetworkingV1().Ingresses(namespace).Create(ctx, ingress, opts)
}

// GetHelmValues is the function for cilium cli sysdump to collect the helm values from the release directly
func (c *Client) GetHelmValues(_ context.Context, releaseName string, namespace string) (string, error) {
	if c.RESTClientGetter == nil {
		return "", fmt.Errorf("no RESTClientGetter for Helm Values")
	}
	helmDriver := ""
	actionConfig := action.Configuration{}
	if err := actionConfig.Init(c.RESTClientGetter, namespace, helmDriver); err != nil {
		return "", err
	}
	helmGetValsClient := action.NewGetValues(&actionConfig)
	vals, err := helmGetValsClient.Run(releaseName)
	if err != nil {
		return "", fmt.Errorf("unable to retrieve helm value from release %s: %w", releaseName, err)
	}

	valuesBuf := new(bytes.Buffer)
	if err = output.EncodeYAML(valuesBuf, vals); err != nil {
		return "", fmt.Errorf("unable to parse helm values from release %s: %w", releaseName, err)
	}
	return valuesBuf.String(), nil
}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Construct the client so RESTClientGetter is populated (the genericclioptions ConfigFlags used for the rest of cilium-cli)
  2. Upgrade cilium-cli — ensure you're not using an older/different client-construction path
  3. As a workaround, retrieve values via `helm get values <release> -n <namespace>` outside cilium-cli
  4. Guard the call: check RESTClientGetter availability before invoking GetHelmValues

Example fix

// before
client, err := k8s.NewClient(...) // RESTClientGetter unset
client.GetHelmValues(ctx, "cilium", "kube-system") // error
// after
client, err := k8s.NewClient(
    k8s.WithRESTClientGetter(configFlags), // pass the ConfigFlags used for kubeconfig access
)
client.GetHelmValues(ctx, "cilium", "kube-system")
Defensive patterns

Strategy: validation

Validate before calling

if client.RESTClientGetter == nil {
    return errors.New("helm operations unavailable: client was built without a RESTClientGetter")
}

Type guard

func supportsHelm(c *k8s.Client) bool {
    return c != nil && c.RESTClientGetter != nil
}

Try / catch

vals, err := client.GetHelmValues(ctx, release, ns)
if err != nil && strings.Contains(err.Error(), "no RESTClientGetter") {
    // fall back to helm CLI or skip the helm-values section of the sysdump
    log.Warn("skipping helm values collection: client lacks RESTClientGetter")
    return nil
}

Prevention

When it happens

Trigger: Calling `GetHelmValues(ctx, releaseName, namespace)` on a `k8s.Client` built without a RESTClientGetter — e.g. created via constructors that leave the field unset (default client creation paths, test clients) while the sysdump tries to collect Helm values.

Common situations: Running `cilium-cli sysdump` with a client created programmatically rather than through the CLI's normal client-initialization; unit tests instantiating k8s.Client directly; refactors dropping the `WithRESTClientGetter`-style option.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/da6431ed4fdbcce8. Report an issue: GitHub.