metal-api icon indicating copy to clipboard operation
metal-api copied to clipboard

for clients the network property "vrfshared" is always false

Open mreiger opened this issue 4 years ago • 3 comments

When displaying a network with property vrfshared: true with metalctl network list --id=<network-id> -o yaml it falsely claims vrfshared is set to false:

$ metalctl network list --id=<network-id> -o yaml
- changed: "2020-05-08T05:37:46.487Z"
  created: "2020-03-10T14:22:21.823Z"
  description: ""
  destinationprefixes:
    - <...>
  id: <network-id>
  labels: {}
  name: <network name>
  nat: true
  parentnetworkid: null
  partitionid: ""
  prefixes:
    - <network prefix>
  privatesuper: false
  projectid: ""
  underlay: false
  usage:
      availableips: 16
      availableprefixes: 0
      usedips: 15
      usedprefixes: 0
  vrf: <vrf number>
  vrfshared: false

mreiger avatar May 22 '20 18:05 mreiger

The culprit may also be https://github.com/metal-stack/metal-api.

mreiger avatar May 22 '20 18:05 mreiger

Good finding. It's definitely coming from the metal-api because the vrfshared property does not get set in the network response. Therefore it comes with null for this property which the metalctl client always interprets as false. It looks like we do not even persist this property in the database, we only use it when creating a new network to check whether it can have the same VRF ID like another network or not.

There are three possibilities to solve this, I assume:

  • Persist the property in the database
  • Dynamically find out the state of this property and add it to the response
  • Remove property from this response and only keep it in the network create request

Gerrit91 avatar May 25 '20 06:05 Gerrit91

I think we can only decide between:

  • persist in the metal.Network entity
  • remove the property from the response

As this is only a flag for network creation and not used later in any case, i strongly vote removing this property from the response, and dont show it in the describe output. Removing from the response is also more difficult, because we need to modify/split the NetworkImmutable struct therefore.

majst01 avatar May 25 '20 11:05 majst01