kubernetes/kops · error

Type fixed did not contain addr: %v

Error message

Type fixed did not contain addr: %v

What it means

Thrown by GetServerFixedIP when an address entry has type 'fixed' but its map lacks the 'addr' key. The code expects every fixed address entry to include an 'addr' field holding the IP; a missing key means the entry is incomplete.

Source

Thrown at upup/pkg/fi/cloudup/openstack/utils.go:119

		return "", fmt.Errorf("No suitable flavor for role %q", ig.Spec.Role)
	}
	return candidates[0].Name, nil
}

func GetServerFixedIP(server *servers.Server, interfaceName string) (poolAddress string, err error) {
	if localAddr, ok := server.Addresses[interfaceName]; ok {
		if localAddresses, ok := localAddr.([]interface{}); ok {
			for _, addr := range localAddresses {
				addrMap := addr.(map[string]interface{})
				if addrType, ok := addrMap[openstackExternalIPType]; ok && addrType == openstackAddressFixed {
					if fixedIP, ok := addrMap[openstackAddress]; ok {
						if fixedIPStr, ok := fixedIP.(string); ok {
							poolAddress = fixedIPStr
						} else {
							err = fmt.Errorf("Fixed IP was not a string: %v", fixedIP)
						}
					} else {
						err = fmt.Errorf("Type fixed did not contain addr: %v", addr)
					}
				}
			}
		}
	} else {
		err = fmt.Errorf("server `%s` interface name `%s` not found", server.ID, interfaceName)
	}
	return poolAddress, err
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect `openstack server show <server-id>` to see the actual address entry shape.
  2. Retry after the server reaches ACTIVE state, when addresses are fully populated.
  3. Update parsing to decode the actual entry shape or use gophercloud's typed address structs.

Example fix

// before
if fixedIP, ok := addrMap[openstackAddress]; ok {
    ...
} else {
    err = fmt.Errorf("Type fixed did not contain addr: %v", addr)
}
// after
fixedIP, ok := addrMap[openstackAddress]
if !ok {
    return "", fmt.Errorf("fixed address entry missing 'addr' for server %s: %#v", server.ID, addr)
}
Defensive patterns

Strategy: validation

Validate before calling

for _, addr := range addrList {
    addrMap, ok := addr.(map[string]interface{})
    if !ok || addrMap["addr"] == nil {
        return "", fmt.Errorf("malformed address entry: %#v", addr)
    }
}

Type guard

func hasAddr(addr interface{}) bool {
    m, ok := addr.(map[string]interface{})
    return ok && m["addr"] != nil
}

Try / catch

poolAddress, err := GetServerFixedIP(server, iface)
if err != nil {
    return fmt.Errorf("resolving fixed IP for server %s: %w", server.ID, err)
}

Prevention

When it happens

Trigger: GetServerFixedIP finds a fixed-type entry in server.Addresses[interfaceName] but addrMap[openstackAddress] is absent — partial address data from Nova or a provider plugin emitting entries without addr.

Common situations: Networking plugins (OVN or vendor SDN) reporting nonstandard address shapes; API version differences in address payloads; transitional server states where addresses are registered but not yet assigned.

Related errors


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