Skip to content

Compatibility with new NetBox versions#506

Merged
bruelea merged 30 commits intomainfrom
feature/e2e-test-against-netbox-v4.4.5
Feb 18, 2026
Merged

Compatibility with new NetBox versions#506
bruelea merged 30 commits intomainfrom
feature/e2e-test-against-netbox-v4.4.5

Conversation

@bruelea
Copy link
Collaborator

@bruelea bruelea commented Jan 26, 2026

Changes

  • This MR introduces a change to set the 'mark-populated' flag to true for all ip-ranges that are managed with the operator.
  • Depending on the NetBox version used for prefix create and update requests the site is added to the site or the scope field of a prefix

Reason

In NetBox 4.2 the behavior of the api/ipam/prefixes/{id}/available-ips/ changed. In older versions ip adresses in an ip-range were considered "used". In a version between v4.1.10 and v4.3.0 this behavoir changed, so that ip addresses in an ip-range are considered as free by default.

In v4.3.0 the flag 'mark-populated' was introduced. If it is set to true the ip adresses in the ip range will be considered as used. https://netboxlabs.com/docs/netbox/release-notes/version-4.3#v430-2025-05-01

In v4.20 the site field was removed form the prefix object and replaced with a scope field.

NetBox Upgrade

When upgrading NetBox to a version newer than v4.3.0 it's recommended to pause NetBox operator during the upgrade and add the 'mark-populated' flag to the ip-ranges managed by NetBox Operator as part of the upgrade. Otherwise, if new ip or ip-ranges are claimed, NetBox Operator will try to claim overlapping ip addresses until all managed ip-ranges have the 'mark-populated' flag set to true.

The script 'scripts/mark-ip-ranges-populated.py' can be used to patch the 'mark-populated' field to true.

Limitations

The NetBox versions between the version where the change happened an v4.3 are not compatible with NetBox operator.

@bruelea bruelea marked this pull request as draft January 26, 2026 10:13
@bruelea bruelea force-pushed the feature/e2e-test-against-netbox-v4.4.5 branch 3 times, most recently from dd65379 to 6f52523 Compare February 2, 2026 09:40
@bruelea bruelea force-pushed the feature/e2e-test-against-netbox-v4.4.5 branch from 0b227d5 to 5c62564 Compare February 10, 2026 09:32
@bruelea bruelea marked this pull request as ready for review February 10, 2026 10:01
@faebr faebr changed the title Copmatibility with new NetBox versions Compatibility with new NetBox versions Feb 16, 2026
Copy link
Collaborator

@faebr faebr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its not so good practice that one client is passed as a parameter to the other client. But since the legacy client is only temporarily I think this is acceptable if the changes required to prevent this are big.
I locally deployed all 4 netbox versions from the makefile one after the other. I was only able to leave the same kind cluster and netbox-operator running for the first 3. The last upgrade step forced me to reset my cluster I believe due to redis -> valkey change. So could not locally test this upgrade, but from clean deployment worked great. Nice job!

@bruelea bruelea force-pushed the feature/e2e-test-against-netbox-v4.4.5 branch from d0c653b to a27fae5 Compare February 17, 2026 14:35
Copy link
Collaborator Author

@bruelea bruelea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions and the thorough testing! I still refactored the api package to make it easy to replace more v3 requests with v4 request in the future. And to have cleaner code even if the v3 client won't completely be phased out.

I haven't changed the type of the id's yet but can align them to int64 if we want to keep it the same for all the resources.

@bruelea bruelea requested a review from faebr February 17, 2026 15:20
@bruelea bruelea merged commit bc18711 into main Feb 18, 2026
14 checks passed
@bruelea bruelea deleted the feature/e2e-test-against-netbox-v4.4.5 branch February 18, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments