Skip to content

Commit

Permalink
Merge pull request #68 from PyratLabs/feature-embedded_etcd_ga_support
Browse files Browse the repository at this point in the history
Embedded Etcd now no longer Experimental
  • Loading branch information
xanmanning authored Dec 12, 2020
2 parents 5d3524d + e7ba779 commit a067a97
Show file tree
Hide file tree
Showing 54 changed files with 241 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- Please list criteria required to ensure this change has been sufficiently reviewed. -->

<!-- Example ticklist:
- [ ] Travis-CI Build passes.
- [ ] GitHub Actions Build passes.
- [ ] Documentation updated.
-->

Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---

name: CI
'on':
pull_request:
push:
branches:
- master
- main
- v1_release
schedule:
- cron: "0 1 1 * *"

defaults:
run:
working-directory: "xanmanning.k3s"

jobs:
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: debian10
scenario: default
- distro: ubuntu2004
scenario: default
- distro: amazonlinux2
scenario: default
- distro: centos7
scenario: default
- distro: ubuntu1804
scenario: default
- distro: fedora31
scenario: nodeploy
- distro: fedora29
scenario: highavailabilitydb
- distro: fedora30
scenario: autodeploy
- distro: debian9
scenario: highavailabilityetcd
- distro: centos8
scenario: highavailabilityetcd

steps:
- name: Checkout codebase
uses: actions/checkout@v2
with:
path: "xanmanning.k3s"

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install test dependencies
run: pip3 install -r molecule/requirements.txt

- name: Run Molecule tests
run: molecule test --scenario-name "${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---

name: Release
'on':
push:
tags:
- '*'

defaults:
run:
working-directory: "xanmanning.k3s"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v2
with:
path: "xanmanning.k3s"

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install Ansible
run: pip3 install -r requirements.txt

- name: Trigger a new import on Galaxy
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@
---
-->

## 2020-12-12, v2.2.0

### Notable changes

- Use of FQCNs enforced, minimum Ansible version now v2.10
- `k3s_etcd_datastore` no longer experimental after K3s version v1.19.5+k3s1
- Docker marked as deprecated for K3s > v1.20.0+k3s1

### Breaking changes

- Use of FQCNs enforced, minimum Ansible version now v2.10
- Use of Docker requires `k3s_use_unsupported_config` to be `true` after
v1.20.0+k3s1

---

## 2020-12-05, v2.1.1

### Notable changes
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Ansible role for installing [Rancher k3s](https://k3s.io/) ("Lightweight
Kubernetes") as either a standalone server or cluster.

[![Build Status](https://www.travis-ci.org/PyratLabs/ansible-role-k3s.svg?branch=master)](https://www.travis-ci.org/PyratLabs/ansible-role-k3s)
[![CI](https://github.com/PyratLabs/ansible-role-k3s/workflows/CI/badge.svg?event=push)](https://github.com/PyratLabs/ansible-role-k3s/actions?query=workflow%3ACI)

## Release notes

Expand Down Expand Up @@ -86,7 +86,7 @@ consistency. These are generally cluster-level configuration.
| `k3s_server_manifests_templates` | A list of Auto-Deploying Manifests Templates. | [] |
| `k3s_use_experimental` | Allow the use of experimental features in k3s. | `false` |
| `k3s_use_unsupported_config` | Allow the use of unsupported configurations in k3s. | `false` |
| `k3s_etcd_datastore` | Enable etcd embedded datastore (EXPERIMENTAL, read notes below). | `false` |
| `k3s_etcd_datastore` | Enable etcd embedded datastore (read notes below). | `false` |
| `k3s_debug` | Enable debug logging on the k3s service. | `false` |

### Ansible Controller Configuration Variables
Expand Down Expand Up @@ -269,13 +269,12 @@ with a `datastore-endpoint` defined. As this is not a typically supported
configuration you will need to set `k3s_use_unsupported_config` to `true`.

Since K3s v1.19.1 it is possible to use an embedded Etcd as the backend
database, and this is done by setting `k3s_etcd_datastore` to true.
As this is an experimental feature you will also need to set
`k3s_use_experimental` to `true`. The best practice for Etcd is to define at
least 3 members to ensure quorum is established. In addition to this, an odd
number of members is recommended to ensure a majority in the event of a network
partition. If you want to use 2 members or an even number of members,
please set `k3s_use_unsupported_config` to `true`.
database, and this is done by setting `k3s_etcd_datastore` to `true`.
The best practice for Etcd is to define at least 3 members to ensure quorum is
established. In addition to this, an odd number of members is recommended to
ensure a majority in the event of a network partition. If you want to use 2
members or an even number of members, please set `k3s_use_unsupported_config`
to `true`.

## Dependencies

Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ k3s_use_experimental: false
# Allow for unsupported configurations in k3s?
k3s_use_unsupported_config: false

# Enable etcd embedded datastore (EXPERIMENTAL)
# Enable etcd embedded datastore
k3s_etcd_datastore: false


Expand Down
2 changes: 1 addition & 1 deletion documentation/quickstart-ha-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Here is our playbook for the k3s cluster (`ha_cluster.yml`):
vars:
k3s_become_for_all: true
k3s_etcd_datastore: true
k3s_use_experimental: true # Note this is required for k3s v1.19.4+k3s1
k3s_use_experimental: true # Note this is required for k3s < v1.19.5+k3s1
roles:
- xanmanning.k3s
```
Expand Down
6 changes: 3 additions & 3 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---

- name: reload systemd
systemd:
ansible.builtin.systemd:
daemon_reload: true
scope: "{{ k3s_systemd_context }}"
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"

- name: restart k3s
systemd:
ansible.builtin.systemd:
name: k3s
state: restarted
scope: "{{ k3s_systemd_context }}"
Expand All @@ -17,7 +17,7 @@
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"

- name: restart docker
systemd:
ansible.builtin.systemd:
name: docker
state: restarted
enabled: true
Expand Down
6 changes: 3 additions & 3 deletions molecule/autodeploy/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lint: |
ansible-lint
platforms:
- name: node1
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand All @@ -19,7 +19,7 @@ platforms:
networks:
- name: k3snet
- name: node2
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand All @@ -28,7 +28,7 @@ platforms:
networks:
- name: k3snet
- name: node3
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand Down
2 changes: 1 addition & 1 deletion molecule/autodeploy/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
6 changes: 3 additions & 3 deletions molecule/debug/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lint: |
ansible-lint
platforms:
- name: node1
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand All @@ -19,7 +19,7 @@ platforms:
networks:
- name: k3snet
- name: node2
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand All @@ -28,7 +28,7 @@ platforms:
networks:
- name: k3snet
- name: node3
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand Down
2 changes: 1 addition & 1 deletion molecule/debug/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
6 changes: 3 additions & 3 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lint: |
ansible-lint
platforms:
- name: node1
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand All @@ -19,7 +19,7 @@ platforms:
networks:
- name: k3snet
- name: node2
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand All @@ -28,7 +28,7 @@ platforms:
networks:
- name: k3snet
- name: node3
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand Down
6 changes: 3 additions & 3 deletions molecule/default/prepare-rootless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
become: true
tasks:
- name: Ensure a user group exists
group:
ansible.builtin.group:
name: user
state: present

- name: Ensure a normal user exists
user:
ansible.builtin.user:
name: k3suser
group: user
state: present

- name: Ensure a normal user has bin directory
file:
ansible.builtin.file:
path: /home/k3suser/bin
state: directory
owner: k3suser
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
hosts: all
tasks:
- name: Ensure apt cache is updated
apt:
ansible.builtin.apt:
update_cache: true
when: ansible_pkg_mgr == 'apt'
Loading

0 comments on commit a067a97

Please sign in to comment.