kubernetes/kops · error

cluster Patch not implemented for vfs store

Error message

cluster Patch not implemented for vfs store

What it means

A Patch against the Cluster object was requested through the VFS-backed clientset, which has no compare-and-swap semantics; only the REST (API-server) clientset implements Patch, so this is a hard capability gap of the vfs store, not a data or permissions error.

Source

Thrown at pkg/client/simple/vfsclientset/cluster.go:231

	}

	return c, nil
}

func (r *ClusterVFS) Delete(name string, options *metav1.DeleteOptions) error {
	return fmt.Errorf("cluster Delete not implemented for vfs store")
}

func (r *ClusterVFS) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
	return fmt.Errorf("cluster DeleteCollection not implemented for vfs store")
}

func (r *ClusterVFS) Watch(opts metav1.ListOptions) (watch.Interface, error) {
	return nil, fmt.Errorf("cluster Watch not implemented for vfs store")
}

func (r *ClusterVFS) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *api.Cluster, err error) {
	return nil, fmt.Errorf("cluster Patch not implemented for vfs store")
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the object with Get/Find, mutate the struct in Go, then write it back with Update.
  2. Use the API-server (grpc) kops clientset if patch semantics are needed.
  3. Implement ClusterVFS.Patch by decoding the patch and applying it to the stored object if you own the fork.

Example fix

// before
_, err := clusterClient.Patch(ctx, "mycluster", types.StrategicMergePatchType, data, metav1.PatchOptions{})
// after
c, err := clusterClient.Get(ctx, "mycluster", metav1.GetOptions{})
if err != nil { return err }
c.Spec.KubernetesVersion = "1.29.0"
_, err = clusterClient.Update(ctx, c, metav1.UpdateOptions{})
Defensive patterns

Strategy: fallback

Validate before calling

if _, ok := clusterClient.(interface{ Patch(string, types.PatchType, []byte, ...string) (*kops.Cluster, error) }); !ok {
    return errors.New("patch unsupported on vfs store; use Get+Update")
}

Type guard

func supportsPatch(c interface{}) bool {
    _, ok := c.(interface{ Patch(string, types.PatchType, []byte, ...string) (*kops.Cluster, error) })
    return ok
}

Try / catch

_, err := client.Patch(name, pt, data)
if err != nil && strings.Contains(err.Error(), "not implemented for vfs store") {
    // fall back to Get, mutate, Update
}

Prevention

When it happens

Trigger: Calling ClusterVFS.Patch(name, patchType, data, subresources...) against a vfs-backed clientset.

Common situations: Code using generic clientset patch helpers (StrategicMerge/JSON patch) ported to kops vfs store; automation applying small updates to Cluster specs.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/d2cc9ecf51840c0d. Report an issue: GitHub.