Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rotating docker configs #295

Merged
merged 1 commit into from
Feb 12, 2022
Merged

Add support for rotating docker configs #295

merged 1 commit into from
Feb 12, 2022

Conversation

andrasmaroy
Copy link
Contributor

SUMMARY

Add support for rolling updates for docker configs. Based on the same functionality for secrets in #293.

Adding two additional parameters for the docker_config module:

  • rolling_versions (default: false): whether to use versioning configs for rolling updates.
  • versions_to_keep (default: 5): when using rolling updates, how many of the old versions to keep.

When rolling_versions is set to true configs are created with a _vX postfix in their names where X is replaced with an incremental counter. That counter is also added to the configs as a label with the name of ansible_version. This way when a config is changed a new version is created with an incremented version number instead of deleting it first then creating again. This aims to solve the problem where the config is attached to a service, thus deleting it fails.

This is the recommended approach of updating configs based on the official Docker documentation.

The change is not breaking, users of this module shouldn't expect any changes.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

docker_config

ADDITIONAL INFORMATION

The problem this PR aims to solve is the following:
When a config is attached to a service docker won't let it get deleted, thus the current version of the module fails execution if one tries to update a config that is attached to a service already. The recommendation from docker for this is to create a new config with the updated data then update the service definition adding the new config in place of the old one. Afterwards the old config can be safely deleted. Having different names for the config is a non-issue since one can define the mountpoint for the config in the container regardless of its name.

The PR addresses #109

@github-actions
Copy link

github-actions bot commented Feb 6, 2022

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Copy link
Collaborator

@felixfontein felixfontein 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 it looks good. I will merge if nobody complains until, say, next Saturday.

@WojciechowskiPiotr
Copy link
Collaborator

shipit

@felixfontein felixfontein merged commit 1d062da into ansible-collections:main Feb 12, 2022
@felixfontein
Copy link
Collaborator

@andrasmaroy thanks for your contribution!
@WojciechowskiPiotr thanks for reviewing!

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.

3 participants