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

Fix/fix partition rke2 #1

Merged
merged 83 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
56be8d5
Merge pull request #213 from jLemmings/main
MonolithProjects May 14, 2024
b3e5319
Allow configuration of default nginx certificate
mueller-ma May 14, 2024
7582a41
Fix typo in rke2_cloud_provider_name value
mueller-ma May 14, 2024
5845a00
Fix removing old nodes after restore if rke2-server already started
glennpratt May 23, 2024
19cbd9c
fix: unquoted wildcard in mirror config
jgoelen May 24, 2024
10f8e65
Run ansible-lint in CI and fix issue
mueller-ma May 14, 2024
1dd3ae9
Allow changing all options in HelmChartConfig
mueller-ma May 27, 2024
91c5761
Add editorconfig
mueller-ma May 27, 2024
939ebd7
Merge pull request #216 from mueller-ma/feat/configure-nginx-default-…
MonolithProjects May 28, 2024
b9c79e0
Merge pull request #217 from mueller-ma/fix/docs-typo
MonolithProjects May 28, 2024
ca79f05
Merge pull request #218 from mueller-ma/feat/ansible-lint
MonolithProjects May 28, 2024
8ead9d0
Merge pull request #221 from jgoelen/main
MonolithProjects May 28, 2024
ce91a55
Merge branch 'main' of github.com:lablabs/ansible-role-rke2 into fix-…
glennpratt May 28, 2024
d8ddc9e
oops, we don't need pipefail anymore
glennpratt May 28, 2024
875a2c9
Fix separate partition check
glennpratt May 28, 2024
ce7e20b
Merge pull request #219 from glennpratt/fix-restore-remove-old-nodes
MonolithProjects May 29, 2024
c39c927
Merge pull request #222 from mueller-ma/feat/add-editorconfig
MonolithProjects May 29, 2024
0aaaf7a
Merge pull request #223 from glennpratt/fix-partition-check
MonolithProjects May 29, 2024
5b4e3be
fix: ingress nginx template when var is not empty
Jun 5, 2024
3be4b64
Merge pull request #224 from lablabs/fix/nginx_ingress_config
MonolithProjects Jun 5, 2024
aff4c39
ci: fix ansible-lint
Jun 5, 2024
c1bedf6
feat: use ansible.builtin.dnf module
Jun 5, 2024
89fcf91
Merge pull request #225 from lablabs/ci/tests
MonolithProjects Jun 5, 2024
eee8b57
feat: use ansible.builtin.dnf module
Jun 5, 2024
4a2d2b0
Merge branch 'feat/dnf' of github.com:lablabs/ansible-role-rke2 into …
Jun 5, 2024
d8499fa
Merge pull request #226 from lablabs/feat/dnf
MonolithProjects Jun 5, 2024
3ad75fc
feat: add dependabot
Jun 5, 2024
6eb1522
Merge pull request #227 from lablabs/feat/dependabot
MonolithProjects Jun 5, 2024
140bf05
Bump pre-commit/action from 2.0.3 to 3.0.1
dependabot[bot] Jun 5, 2024
97ba5c1
Bump release-drafter/release-drafter from 5 to 6
dependabot[bot] Jun 5, 2024
87b3c36
Bump actions/checkout from 3 to 4
dependabot[bot] Jun 5, 2024
f719f32
Merge pull request #230 from lablabs/dependabot/github_actions/action…
MonolithProjects Jun 5, 2024
f9a5052
Merge pull request #229 from lablabs/dependabot/github_actions/releas…
MonolithProjects Jun 5, 2024
97be59c
Bump actions/setup-python from 2 to 5
dependabot[bot] Jun 5, 2024
15c7b18
Merge pull request #228 from lablabs/dependabot/github_actions/pre-co…
MonolithProjects Jun 5, 2024
4e23f6b
Merge pull request #231 from lablabs/dependabot/github_actions/action…
MonolithProjects Jun 5, 2024
a77cdf9
feat: add configuation option for cluster-domain
CrimsonFez Jun 10, 2024
ccde98b
docs: adding cluster-domain to readme
CrimsonFez Jun 12, 2024
a5c0c6c
Merge pull request #232 from CrimsonFez/add-cluster-domain
MonolithProjects Jun 13, 2024
e04eb50
Don't fail due to missing versions in check mode.
eliasp Jul 7, 2024
ecfef62
adding options to configure cluster network cidrs
tregad Jul 19, 2024
094e487
removing conditionals due to definition in defaults/main.yml
tregad Jul 19, 2024
f733dbb
Merge pull request #239 from eliasp/check-mode-dont-fail
MonolithProjects Jul 25, 2024
7d09449
adding empty lines above comments
tregad Jul 25, 2024
baabf17
adding default variables to README.md
tregad Jul 25, 2024
6535b05
Merge pull request #240 from tregad/main
MonolithProjects Jul 25, 2024
fc8f77c
fix: Incorrect indentation on config
Mr-Artemus Aug 16, 2024
dc23a2f
Merge pull request #242 from Mr-Artemus/main
MonolithProjects Aug 17, 2024
6c9a253
Always populate active_server
sestegra Aug 24, 2024
dfa2643
Update config.yaml.j2
webpav Sep 2, 2024
0cbd993
fix: etc restore - don't fail in check mode
eliasp Sep 6, 2024
18cd57c
fix: allow to use check mode without failures
eliasp Sep 6, 2024
87d7cc7
change pod check
lukapetrovic-git Sep 16, 2024
e53df88
Change return code to only 0
lukapetrovic-git Sep 16, 2024
54cb001
Merge pull request #244 from sestegra/195
MonolithProjects Sep 18, 2024
09bd728
Merge pull request #246 from pasha121/patch-1
MonolithProjects Sep 18, 2024
10fe5d9
Merge pull request #248 from eliasp/check-mode-dont-fail
MonolithProjects Sep 18, 2024
5bb7820
Merge branch 'lablabs:main' into main
lukapetrovic-git Sep 26, 2024
e02b4d5
add environment INSTALL_RKE2_TYPE
ntheanh201 Oct 3, 2024
5b8555e
add config option: selinux
ntheanh201 Oct 4, 2024
61f981b
update config value
ntheanh201 Oct 4, 2024
e43df6b
remove old nodes when restoring etcd
Oct 10, 2024
8e4b1f0
fix spelling error with backwards compatiblity
Oct 10, 2024
5e6523c
Add checks for pods in kube-system + remove failed_when
lukapetrovic-git Oct 10, 2024
8bd4963
rke2 cni is a list
Oct 10, 2024
3e1842e
ease readability
Oct 10, 2024
361a3be
rke2_type can be inferred by what group the host is in.
Oct 11, 2024
a77f6fd
Merge pull request #249 from lukapetrovic-git/main
MonolithProjects Oct 12, 2024
6769a92
Merge pull request #251 from ntheanh201/agent
MonolithProjects Oct 12, 2024
6300859
Merge pull request #252 from ntheanh201/selinux
MonolithProjects Oct 12, 2024
5a2d7ec
fix linting
Oct 12, 2024
a9a25f3
Merge pull request #264 from lablabs/fix/linting
MonolithProjects Oct 12, 2024
284da50
Merge branch 'main' into fix/fix-partition-rke2
jLemmings Oct 29, 2024
2270260
conditional is missing the and operand
leventyalcin Oct 29, 2024
24137e7
fix airgap deploy
Oct 10, 2024
9cd3979
minor fixes
Oct 29, 2024
a79ff8d
Merge pull request #257 from simonfelding/etcd
MonolithProjects Oct 31, 2024
d004391
Merge pull request #258 from simonfelding/fix-snapshooter-spelling
MonolithProjects Oct 31, 2024
671cc67
Merge pull request #259 from simonfelding/cni-list
MonolithProjects Oct 31, 2024
e334c67
Merge pull request #261 from simonfelding/rke2_type-can-be-inferred
MonolithProjects Oct 31, 2024
fe5c10f
Merge pull request #260 from simonfelding/fix-airgap
MonolithProjects Nov 4, 2024
e32888f
Merge pull request #271 from leventyalcin/conditional-missing-and
MonolithProjects Nov 7, 2024
af001dd
Merge branch 'main' into fix/fix-partition-rke2
jLemmings Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
end_of_line = lf
insert_final_newline = true
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ jobs:
fail-fast: ${{ !contains(github.event_name, 'pull_request') }}
matrix:
config:
- image: "rockylinux8"
- image: "rockylinux9"
cgroup_mode: "host"
volumes: "rw"
- image: "ubuntu2204"
- image: "ubuntu2404"
cgroup_mode: "host"
volumes: "rw"
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'lablabs.rke2'

- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand All @@ -62,17 +62,17 @@ jobs:
strategy:
matrix:
config:
- image: "ubuntu2204"
- image: "ubuntu2404"
cgroup_mode: "host"
volumes: "rw"
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'lablabs.rke2'

- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand Down Expand Up @@ -104,12 +104,12 @@ jobs:
# volumes: "rw"
# steps:
# - name: checkout
# uses: actions/checkout@v3
# uses: actions/checkout@v4
# with:
# path: 'lablabs.rke2'

# - name: Set up Python 3
# uses: actions/setup-python@v4
# uses: actions/setup-python@v5
# with:
# python-version: '3.x'

Expand Down Expand Up @@ -142,12 +142,12 @@ jobs:
# volumes: "rw"
# steps:
# - name: checkout
# uses: actions/checkout@v3
# uses: actions/checkout@v4
# with:
# path: 'lablabs.rke2'

# - name: Set up Python 3
# uses: actions/setup-python@v4
# uses: actions/setup-python@v5
# with:
# python-version: '3.x'

Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ jobs:
fail-fast: true
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: Molecule for Ansible - lint
uses: MonolithProjects/[email protected]
path: 'lablabs.rke2'

- name: Set up Python 3
uses: actions/setup-python@v5
with:
molecule_command: lint
python-version: '3.x'

- name: Install ansible-lint
run: pip3 install ansible-lint

- name: Run ansible-lint
run: ansible-lint --profile production ./tasks
working-directory: ./lablabs.rke2
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Run pre-commit
uses: pre-commit/action@v2.0.3
uses: pre-commit/action@v3.0.1
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
with:
config-name: RELEASE_DRAFTER.yml
env:
Expand Down
6 changes: 5 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
extends: default

rules:
comments:
min-spaces-from-content: 1
octal-values:
forbid-implicit-octal: false
forbid-explicit-octal: true
braces:
max-spaces-inside: 1
level: error
Expand All @@ -15,7 +20,6 @@ rules:
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
Expand Down
49 changes: 35 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ The Role can install the RKE2 in 3 modes:

## Tested on

* Rocky Linux 8
* Ubuntu 20.04 LTS
* Ubuntu 22.04 LTS
* Rocky Linux 9
* Ubuntu 24.04 LTS

## Role Variables

Expand All @@ -39,7 +38,7 @@ This is a copy of `defaults/main.yml`
```yaml
---
# The node type - server or agent
rke2_type: server
rke2_type: "{{ 'server' if inventory_hostname in groups[rke2_servers_group_name] else 'agent' if inventory_hostname in groups[rke2_agents_group_name] }}"

# Deploy the control plane in HA mode
rke2_ha_mode: false
Expand Down Expand Up @@ -111,6 +110,9 @@ rke2_kubevip_metrics_port: 2112
# Add additional SANs in k8s API TLS cert
rke2_additional_sans: []

# Configure cluster domain
# rke2_cluster_domain: cluster.example.net

# API Server destination port
rke2_apiserver_dest_port: 6443

Expand Down Expand Up @@ -189,7 +191,7 @@ rke2_disable_cloud_controller: false

# Cloud provider to use for the cluster (aws, azure, gce, openstack, vsphere, external)
# applicable only if rke2_disable_cloud_controller is true
rke2_cloud_provider_name: "rke2"
rke2_cloud_provider_name: "external"

# Path to custom manifests deployed during the RKE2 installation
# It is possible to use Jinja2 templating in the manifests
Expand Down Expand Up @@ -242,10 +244,11 @@ rke2_etcd_snapshot_destination_dir: "{{ rke2_data_path }}/server/db/snapshots"
# region: "" # optional - defaults to us-east-1
# folder: "" # optional - defaults to top level of bucket
# Override default containerd snapshotter
rke2_snapshooter: overlayfs
rke2_snapshotter: "{{ rke2_snapshooter }}"
rke2_snapshooter: overlayfs # legacy variable that only exists to keep backward compatibility with previous configurations

# Deploy RKE2 with default CNI canal
rke2_cni: canal
# Deploy RKE2 with default CNI canal (should be a list)
rke2_cni: [canal]

# Validate system configuration against the selected benchmark
# (Supported value is "cis-1.23" or eventually "cis-1.6" if you are running RKE2 prior 1.25)
Expand Down Expand Up @@ -304,6 +307,13 @@ rke2_agents_group_name: workers
# rke2_kube_scheduler_arg:
# - "bind-address=0.0.0.0"

# (Optional) Configure nginx via HelmChartConfig: https://docs.rke2.io/networking/networking_services#nginx-ingress-controller
# rke2_ingress_nginx_values:
# controller:
# config:
# use-forwarded-headers: "true"
rke2_ingress_nginx_values: {}

# Cordon, drain the node which is being upgraded. Uncordon the node once the RKE2 upgraded
rke2_drain_node_during_upgrade: false

Expand All @@ -323,6 +333,17 @@ rke2_debug: false

# The value for the node-name configuration item
rke2_node_name: "{{ inventory_hostname }}"

# the network to use for Pods.. Set to '10.42.0.0/16' by default.
rke2_cluster_cidr:
- 10.42.0.0/16

# the network to use for ClusterIP Services. Set to '10.43.0.0/16' by default.
rke2_service_cidr:
- 10.43.0.0/16

# Enable SELinux for rke2
rke2_selinux: false
```

## Inventory file example
Expand All @@ -332,14 +353,14 @@ The RKE2 Kubernetes master/server nodes must belong to `masters` group and worke

```ini
[masters]
master-01 ansible_host=192.168.123.1 rke2_type=server
master-02 ansible_host=192.168.123.2 rke2_type=server
master-03 ansible_host=192.168.123.3 rke2_type=server
master-01 ansible_host=192.168.123.1
master-02 ansible_host=192.168.123.2
master-03 ansible_host=192.168.123.3

[workers]
worker-01 ansible_host=192.168.123.11 rke2_type=agent
worker-02 ansible_host=192.168.123.12 rke2_type=agent
worker-03 ansible_host=192.168.123.13 rke2_type=agent
worker-01 ansible_host=192.168.123.11
worker-02 ansible_host=192.168.123.12
worker-03 ansible_host=192.168.123.13

[k8s_cluster:children]
masters
Expand Down
26 changes: 24 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# The node type - server or agent
rke2_type: server
rke2_type: "{{ 'server' if inventory_hostname in groups[rke2_servers_group_name] else 'agent' if inventory_hostname in groups[rke2_agents_group_name] }}"

# Deploy the control plane in HA mode
rke2_ha_mode: false
Expand Down Expand Up @@ -72,6 +72,9 @@ rke2_kubevip_metrics_port: 2112
# Add additional SANs in k8s API TLS cert
rke2_additional_sans: []

# Configure cluster domain
# rke2_cluster_domain: cluster.example.net

# API Server destination port
rke2_apiserver_dest_port: 6443

Expand Down Expand Up @@ -203,7 +206,8 @@ rke2_etcd_snapshot_destination_dir: "{{ rke2_data_path }}/server/db/snapshots"
# region: "" # optional - defaults to us-east-1
# folder: "" # optional - defaults to top level of bucket
# Override default containerd snapshotter
rke2_snapshooter: overlayfs
rke2_snapshotter: "{{ rke2_snapshooter }}"
rke2_snapshooter: overlayfs # legacy variable that only exists to keep backward compatibility with previous configurations

# Deploy RKE2 with default CNI canal
rke2_cni: canal
Expand Down Expand Up @@ -265,6 +269,13 @@ rke2_agents_group_name: workers
# rke2_kube_scheduler_arg:
# - "bind-address=0.0.0.0"

# (Optional) Configure nginx via HelmChartConfig: https://docs.rke2.io/networking/networking_services#nginx-ingress-controller
# rke2_ingress_nginx_values:
# controller:
# config:
# use-forwarded-headers: "true"
rke2_ingress_nginx_values: {}

# Cordon, drain the node which is being upgraded. Uncordon the node once the RKE2 upgraded
rke2_drain_node_during_upgrade: false

Expand All @@ -284,3 +295,14 @@ rke2_debug: false

# The value for the node-name configuration item
rke2_node_name: "{{ inventory_hostname }}"

# default pod network range for rke2
rke2_cluster_cidr:
- 10.42.0.0/16

# default service network range for rke2
rke2_service_cidr:
- 10.43.0.0/16

# Enable SELinux for rke2
rke2_selinux: false
2 changes: 1 addition & 1 deletion molecule/cluster/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
become: yes
vars:
rke2_version: v1.22.12+rke2r1
rke2_snapshooter: native
rke2_snapshotter: native
rke2_server_node_taints:
- 'CriticalAddonsOnly=true:NoExecute'
roles:
Expand Down
16 changes: 11 additions & 5 deletions molecule/cluster/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
hosts: node*
become: true
tasks:
- name: Install packages
- name: Install wget for Ubuntu
ansible.builtin.package:
update_cache: true
name: "{{ item }}"
loop:
- wget
- curl
name:
- wget
when: ansible_distribution == "Ubuntu"

- name: Install iproute for RockyLinux
ansible.builtin.package:
update_cache: true
name:
- iproute
when: ansible_distribution == "Rocky"
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
become: yes
vars:
rke2_version: v1.27.1+rke2r1
rke2_snapshooter: native
rke2_snapshotter: native
roles:
- role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
6 changes: 3 additions & 3 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
hosts: node*
become: true
tasks:
- name: Install packages
- name: Install wget for Ubuntu
ansible.builtin.package:
update_cache: true
name:
- wget
- curl
when: ansible_distribution == "Ubuntu"

- name: Install special packages for RockyLinux
- name: Install iproute for RockyLinux
ansible.builtin.package:
update_cache: true
name:
Expand Down
2 changes: 1 addition & 1 deletion molecule/ha_cluster/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
rke2_version: v1.22.12+rke2r1
rke2_ha_mode: true
rke2_api_ip: 192.168.123.100
rke2_snapshooter: native
rke2_snapshotter: native
rke2_server_node_taints:
- 'CriticalAddonsOnly=true:NoExecute'
roles:
Expand Down
Loading
Loading