kubernetes/kops · error

setting ForwardRule labels: %w

Error message

setting ForwardRule labels: %w

What it means

The SetLabels call on a new forwarding rule succeeded, but WaitForOp failed — the GCE setLabels operation itself completed with an error. Distinct from 2714 only in that the API accepted the request but the operation did not.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/forwardingrule.go:255

		if e.Labels != nil {
			// We can't set labels on creation; we have to read the object to get the fingerprint
			// TODO: We could get it from the operation!
			r, err := t.Cloud.Compute().ForwardingRules().Get(ctx, t.Cloud.Project(), t.Cloud.Region(), name)
			if err != nil {
				return fmt.Errorf("reading created ForwardingRule %q: %v", name, err)
			}

			req := compute.RegionSetLabelsRequest{
				LabelFingerprint: r.LabelFingerprint,
				Labels:           e.Labels,
			}
			op, err := t.Cloud.Compute().ForwardingRules().SetLabels(ctx, t.Cloud.Project(), t.Cloud.Region(), o.Name, &req)
			if err != nil {
				return fmt.Errorf("setting ForwardingRule labels: %w", err)
			}

			if err := t.Cloud.WaitForOp(op); err != nil {
				return fmt.Errorf("setting ForwardRule labels: %w", err)
			}
		}
	} else {
		if changes.Labels != nil {
			req := compute.RegionSetLabelsRequest{
				LabelFingerprint: a.labelFingerprint,
				Labels:           e.Labels,
			}
			op, err := t.Cloud.Compute().ForwardingRules().SetLabels(ctx, t.Cloud.Project(), t.Cloud.Region(), o.Name, &req)
			if err != nil {
				return fmt.Errorf("setting ForwardingRule labels: %w", err)
			}

			if err := t.Cloud.WaitForOp(op); err != nil {
				return fmt.Errorf("setting ForwardRule labels: %w", err)
			}

			changes.Labels = nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run kops update — it re-reads the resource and re-fetches the fingerprint before setting labels
  2. Check whether another process/automation is modifying forwarding-rule labels concurrently
  3. Inspect the operation error in GCE console for labelFingerprint or conditionNotMet failures

Example fix

null
Defensive patterns

Strategy: retry

Try / catch

if err := cloud.WaitForOp(op); err != nil {
    klog.Warningf("setLabels op failed (%v); re-running update will refetch the fingerprint", err)
    return err
}

Prevention

When it happens

Trigger: ForwardingRules().SetLabels returned an operation successfully, then t.Cloud.WaitForOp(op) reports the operation failed (e.g. fingerprint mismatch detected server-side, resource deleted concurrently).

Common situations: Another controller changed labels between Get and SetLabels (stale fingerprint); the rule or its containing region hit a concurrent-modification condition; transient GCE failure.

Related errors


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