cilium/cilium · error

failed to collect Gateway entries: %w

Error message

failed to collect Gateway entries: %w

What it means

Thrown when the cilium-cli sysdump collector fails to list Gateway resources (namespaced, all namespaces) via the dynamic client. The Kubernetes API error from ListUnstructured is wrapped with %w.

Source

Thrown at cilium-cli/sysdump/sysdump.go:2134

				n := corev1.NamespaceAll
				v, err := c.Client.ListUnstructured(ctx, gatewayClass, &n, metav1.ListOptions{})
				if err != nil {
					return fmt.Errorf("failed to collect GatewayClass entries: %w", err)
				}
				if err := c.WriteYAML(gatewayClassesFileName, v); err != nil {
					return fmt.Errorf("failed to collect GatewayClass entries: %w", err)
				}
				return nil
			},
		},
		{
			Description: "Collecting Gateway entries",
			Quick:       true,
			Task: func(ctx context.Context) error {
				n := corev1.NamespaceAll
				v, err := c.Client.ListUnstructured(ctx, gateway, &n, metav1.ListOptions{})
				if err != nil {
					return fmt.Errorf("failed to collect Gateway entries: %w", err)
				}
				if err := c.WriteYAML(gatewaysFileName, v); err != nil {
					return fmt.Errorf("failed to collect Gateway entries: %w", err)
				}
				return nil
			},
		},
		{
			Description: "Collecting ListenerSet entries",
			Quick:       true,
			Task: func(ctx context.Context) error {
				n := corev1.NamespaceAll
				v, err := c.Client.ListUnstructured(ctx, listenerSet, &n, metav1.ListOptions{})
				if err != nil {
					return fmt.Errorf("failed to collect ListenerSet entries: %w", err)
				}
				if err := c.WriteYAML(listenerSetsFileName, v); err != nil {
					return fmt.Errorf("failed to collect ListenerSet entries: %w", err)

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Check: kubectl get gateways -A; if the resource is not found, install the full Gateway API CRD bundle.
  2. Verify RBAC: kubectl auth can-i list gateways --all-namespaces.
  3. Confirm kubeconfig points at the intended cluster (kubectl config current-context).
  4. If Gateways are not used, ignore this missing entry in the sysdump.

Example fix

// before
kubectl get gateways -A  # no matches / not found
// after
kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
Defensive patterns

Strategy: validation

Validate before calling

kubectl get crd gateways.gateway.networking.k8s.io && kubectl auth can-i list gateways -A

Try / catch

v, err := c.Client.ListUnstructured(ctx, gateway, &n, metav1.ListOptions{})
if err != nil {
    if meta.IsNoMatchError(err) || k8sErrors.IsNotFound(err) { return nil }
    return fmt.Errorf("failed to collect Gateway entries: %w", err)
}

Prevention

When it happens

Trigger: c.Client.ListUnstructured(ctx, gateway, &corev1.NamespaceAll, metav1.ListOptions{}) returns an error: Gateway API CRDs not installed, RBAC denial on gateways list, or API server connectivity failure.

Common situations: Cluster lacking the gateway.networking.k8s.io Gateway CRD (only GatewayClass installed, or experimental channel missing); user lacking read access across namespaces; wrong cluster context.

Related errors


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