kubernetes/kops · error

error finding Address with IP=%q: %w

Error message

error finding Address with IP=%q: %w

What it means

After fetching the forwarding rule, Find() resolves its IP address to a GCE static Address resource via findAddressByIP(). If that helper fails (non-NotFound API error), the error is wrapped with %w preserving the cause. This blocks reconciling the forwarding rule's actual state.

Source

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

		Name:       new(r.Name),
		IPProtocol: r.IPProtocol,
	}
	if r.PortRange != "" {
		actual.PortRange = &r.PortRange
	}
	if len(r.Ports) > 0 {
		actual.Ports = r.Ports
	}

	if r.Target != "" {
		actual.TargetPool = &TargetPool{
			Name: new(lastComponent(r.Target)),
		}
	}
	if r.IPAddress != "" {
		address, err := findAddressByIP(cloud, r.IPAddress, r.Subnetwork)
		if err != nil {
			return nil, fmt.Errorf("error finding Address with IP=%q: %w", r.IPAddress, err)
		}
		actual.IPAddress = address
	}
	if r.BackendService != "" {
		actual.BackendService = &BackendService{
			Name: new(lastComponent(r.BackendService)),
		}
	}
	if r.LoadBalancingScheme != "" {
		actual.LoadBalancingScheme = new(r.LoadBalancingScheme)
	}
	if r.Network != "" {
		actual.Network = &Network{
			Name: new(lastComponent(r.Network)),
		}
	}
	if r.Subnetwork != "" {
		actual.Subnetwork = &Subnet{

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Follow the wrapped cause (%w) to the underlying findAddressByIP error.
  2. Confirm the IP is a static Address in the same region as the forwarding rule; create one if it is ephemeral.
  3. Check IAM permissions for compute.addresses.get/list.
  4. Re-run after verifying project/region configuration if the cause is an API error.
Defensive patterns

Strategy: validation

Validate before calling

// before applying, ensure the forwarding rule's IP is a static regional address:
// gcloud compute addresses list --filter="address=IP AND region=R"
func hasStaticAddress(ips []cloudresourcemanager.Binding, ip, region string) bool { /* query Addresses API; return false if empty */ ; return false }

Type guard

func isRegionalAddress(addr *compute.Address, region string) bool {
  return addr != nil && addr.Region != "" && strings.HasSuffix(addr.Region, "/regions/"+region) && addr.Address != ""
}

Prevention

When it happens

Trigger: findAddressByIP returns an error other than not-found — typically a Compute API failure while listing/getting Addresses in the region, or an address in an unexpected project/scope (global vs regional).

Common situations: The IP is a global address but lookup is regional (or vice versa); IAM lacks compute.addresses.list; the forwarding rule references an ephemeral IP with no Address resource and the lookup API call still errors.

Related errors


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