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

POC: Supporting k3s-ansible with external database #339

Merged
merged 5 commits into from
Jul 2, 2024

Conversation

peterklijn
Copy link
Contributor

@peterklijn peterklijn commented Jun 20, 2024

Changes

A (working) proof of concept of supporting external databases in this Ansible setup.
This change introduces an option variable use_external_database, which if present uses the k3s-single.service.j2 template, regardless of how many server hosts are defined.
Using this together with the extra_server_args variable to pass along a --datastore-endpoint will create a K3s setup using an external datastore.

---
k3s_cluster:
  children:
    server:
      hosts:
        192.168.64.2:
        192.168.64.3:
    agent:
      hosts:
        192.168.64.4:

  # Required Vars
  vars:
    # ...
    token: mytoken
    use_external_database: true
    extra_server_args: "--datastore-endpoint=postgres://username:password@hostname:port/database-name"
    # ...

Linked Issues

#340

roles/k3s_server/tasks/main.yml Outdated Show resolved Hide resolved
@dereknola
Copy link
Member

If you rebase off master, you won't see the lint error around ansible 2.14 anymore.

@peterklijn peterklijn force-pushed the support-external-db branch from e5bbe6d to ef17880 Compare June 20, 2024 20:05
@peterklijn peterklijn requested a review from dereknola June 20, 2024 20:11
@peterklijn peterklijn force-pushed the support-external-db branch from d20f1ad to f86910a Compare June 21, 2024 11:31
Signed-off-by: Peter Klijn <[email protected]>
@peterklijn peterklijn force-pushed the support-external-db branch from 45190fe to bbeb175 Compare June 25, 2024 21:20
@peterklijn peterklijn marked this pull request as ready for review June 25, 2024 21:21
@peterklijn
Copy link
Contributor Author

Hi @dereknola,
Thanks for the review, I've fixed the lint error and added some documentation to the readme.
Could you have another look and let me know if there's anything I need to do before merging?

Copy link
Member

@dereknola dereknola left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, was offsite all last week. This should fix all the lint. As use_external_database is already defined with a default bool value, all attempts to override it must also be a bool, eliminating the need to filter | bool in the when clauses.

roles/k3s_server/tasks/main.yml Outdated Show resolved Hide resolved
roles/k3s_server/tasks/main.yml Outdated Show resolved Hide resolved
roles/k3s_server/tasks/main.yml Outdated Show resolved Hide resolved
roles/k3s_server/tasks/main.yml Outdated Show resolved Hide resolved
Signed-off-by: Peter Klijn <[email protected]>
@peterklijn peterklijn requested a review from dereknola July 1, 2024 18:26
@peterklijn
Copy link
Contributor Author

Sorry for the delay, was offsite all last week. This should fix all the lint. As use_external_database is already defined with a default bool value, all attempts to override it must also be a bool, eliminating the need to filter | bool in the when clauses.

Thanks for the review! I've processed your comments 👍

@dereknola dereknola merged commit 31b8b1e into k3s-io:master Jul 2, 2024
2 checks passed
@peterklijn peterklijn deleted the support-external-db branch July 2, 2024 20:35
andygodish pushed a commit to andygodish/k3s-ansible that referenced this pull request Aug 9, 2024
* POC: Supporting k3s-ansible with external database

Signed-off-by: Peter Klijn <[email protected]>
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