Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

IP Address Assignments and AssignedTo fields are unused response bloat #464

@displague

Description

@displague

In #354, a change in EM API include fields to add details about the IP Addresses resulted in a large increase in the response time and size for IP address list responses for large projects.

We'll want to revert this.

In CAPP, the resulting Assignments field in the IP address lists is only used in len() calls to determine if an address is in use.
https://github.com/kubernetes-sigs/cluster-api-provider-packet/blob/a6d36083511981e576639920930c011273a9eb37/controllers/packetmachine_controller.go#L327-L331

It appears that assignments and assignments.assigned_to includes are not necessary for this purpose. Countable href objects are returned in an assignments list without explicit includes.

We see further proof of this when comparing metal-cli commands (debug output reveals that metal-cli nor packngo are adding unsolicited include values):

$ metal ips get -o json | jq '.[].assignments|length'  | sort -n | uniq -c 
     29 0
      1 1
      2 3
$ metal ips get -o json --include assignments,assignments.assigned_to | jq '.[].assignments|length'  | sort -n | uniq -c 
     29 0
      1 1
      2 3

Originally posted by @displague in #354 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions