SaaShup / netbox-docker-agent

Agent for Netbox Docker Plugin
https://saashup.com
BSD 3-Clause "New" or "Revised" License
29 stars 1 forks source link

:sparkles: Save registry state (with credentials) #107

Open linkdd opened 2 weeks ago

linkdd commented 2 weeks ago

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:

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

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.

lvenier commented 2 weeks ago

@linkdd thanks for the issue. @fanshan It was discussed to have that feature in the plugin instead. Can you discuss with @dzove855 to check where to implement it ?