netbox-docker-agent icon indicating copy to clipboard operation
netbox-docker-agent copied to clipboard

:sparkles: Save registry state (with credentials)

Open linkdd opened this issue 8 months ago • 1 comments

Actual Behavior

When in the Netbox Plugin we create a registry with a specific name, and eventually credentials, the agent does not save it locally. Instead, it is used only when pulling Docker images.

This means that, when the host in Netbox is recreated, the agent has no way of restoring the proper, correct data.

Consider the following:

  • Registry foobar, server address https://somehost:1234/v2 with credentials
  • Image quux tied to registry foobar
  • Image spongebob tied to registry foobar

When recreating the host (thus deleting all related data in cascade), the agent will recreate the following data:

  • Registry somehost:1234, server address https://somehost:1234 with no credentials
  • Image quux tied to that first registry
  • Registry somehost:1234, server address https://somehost:1234 with no credentials
  • Image spongebob tied to that second registry

This is not only the truth that was initially set up in Netbox, but it creates a lot of clutter, and non-functional data.

Let's imagine that we have a feature in the Netbox plugin allowing the user to "repull" a Docker image, this will not be possible because the credentials went missing.

We lose the initial nomenclature (which might be important for the actual user of the CMDB, the source of truth), and the functionality (since we have wrong data).

This forces the user to recreate the registries, the images, and the containers, and then remove all the clutter. Which is a time-expensive operation when there are not even a lot of containers.

Desired Behavior

Whenever we add a registry in Netbox, that registry should be saved locally alongside the agent. Information of which image belongs to which registry should be saved as well when creating an image in Netbox.

Therefore, upon recreation of the host, the actual data can be restored, saving the user some precious time.

Either that or prevent the agent from ever feeding data to Netbox. As a user, I either want correct data, or no data. Incorrect data is a no-go.

linkdd avatar Jun 20 '24 16:06 linkdd