kubernetes/kops · error

ResourceVersion not supported in InstanceGroupVFS::Get

Error message

ResourceVersion not supported in InstanceGroupVFS::Get

What it means

InstanceGroupVFS.Get is a simple VFS read and does not support the ResourceVersion field of metav1.GetOptions. If options.ResourceVersion is non-empty it rejects the call immediately. Callers must pass zero-valued GetOptions.

Source

Thrown at pkg/client/simple/vfsclientset/instancegroup.go:66

	clusterName := cluster.Name
	kind := "InstanceGroup"

	r := &InstanceGroupVFS{
		cluster:     cluster,
		clusterName: clusterName,
	}
	r.Init(kind, c.VFSContext(), c.basePath.Join(clusterName, "instancegroup"), StoreVersion)
	r.validate = func(o runtime.Object) error {
		return validation.ValidateInstanceGroup(o.(*kopsapi.InstanceGroup), nil, false).ToAggregate()
	}
	return r
}

var _ kopsinternalversion.InstanceGroupInterface = &InstanceGroupVFS{}

func (c *InstanceGroupVFS) Get(ctx context.Context, name string, options metav1.GetOptions) (*kopsapi.InstanceGroup, error) {
	if options.ResourceVersion != "" {
		return nil, fmt.Errorf("ResourceVersion not supported in InstanceGroupVFS::Get")
	}

	o, err := c.Find(ctx, name)
	if err != nil {
		return nil, err
	}
	if o == nil {
		return nil, errors.NewNotFound(schema.GroupResource{Group: kopsapi.GroupName, Resource: "InstanceGroup"}, name)
	}
	ig := o.(*kopsapi.InstanceGroup)
	c.addLabels(ig)

	return ig, nil
}

func (c *InstanceGroupVFS) addLabels(ig *kopsapi.InstanceGroup) {
	if ig.ObjectMeta.Labels == nil {
		ig.ObjectMeta.Labels = make(map[string]string)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Pass metav1.GetOptions{} (empty ResourceVersion) when using InstanceGroupVFS.
  2. Remove code that copies ResourceVersion from prior responses into Get options.
  3. Implement optimistic concurrency above the VFS layer if needed, not via GetOptions.

Example fix

// before
ig, err := c.Get(ctx, name, metav1.GetOptions{ResourceVersion: rv})
// after
ig, err := c.Get(ctx, name, metav1.GetOptions{})
Defensive patterns

Strategy: validation

Validate before calling

if options.ResourceVersion != "" {
    return fmt.Errorf("ResourceVersion is not supported by VFS-backed clients")
}
ig, err := client.Get(ctx, name, options)

Try / catch

ig, err := client.Get(ctx, name, opts)
if err != nil {
    if strings.Contains(err.Error(), "ResourceVersion not supported") {
        return client.Get(ctx, name, metav1.GetOptions{})
    }
    return err
}

Prevention

When it happens

Trigger: Calling InstanceGroupVFS.Get (directly or via Update, which calls Get) with GetOptions{ResourceVersion: "..."} set — e.g. code ported from the API-server clientset.

Common situations: Generic client code propagating ResourceVersion from a previous list/watch; migrating from registry-based to VFS-based clientsets; optimistic-concurrency code paths expecting etcd-style resource versions.

Related errors


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