Skip to content

Commit ef26896

Browse files
authored
0.4.1+1.5.4 (#10)
* update Longhorn to v1.5.4 * Molecule: update prepare.yml * Molecule: use alvistack instead of generic Vagrant boxes * Molecule: remove tasks files no longer needed * update .yamllint * update requirements.yml * update CHANGELOG
1 parent 0025c13 commit ef26896

15 files changed

+60
-392
lines changed

.yamllint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extends: default
66

77
rules:
88
line-length:
9-
max: 160
9+
max: 300
1010
level: warning
1111

1212
comments-indentation: disable

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
55

66
# Changelog
77

8+
## 0.4.1+1.5.4
9+
10+
- update Longhorn to `v1.5.4`
11+
- Molecule: use `alvistack` instead of `generic` Vagrant boxes
12+
- Molecule: various updates
13+
814
## 0.4.0+1.5.3
915

1016
Please read [Longhorn Important Note](https://longhorn.io/docs/1.5.3/deploy/important-notes) before upgrading!

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This Ansible role is used in my blog series [Kubernetes the not so hard way with
1111
Versions
1212
--------
1313

14-
I tag every release and try to stay with [semantic versioning](http://semver.org). If you want to use the role I recommend to checkout the latest tag. The master branch is basically development while the tags mark stable releases. But in general I try to keep master in good shape too. A tag `0.4.0+1.5.3` means this is release `0.4.0` of this role and it contains Longhorn chart version `1.5.3` (which normally is the same as the Longhorn version itself). If the role itself changes `X.Y.Z` before `+` will increase. If the Longhorn chart version changes `X.Y.Z` after `+` will increase too. This allows to tag bugfixes and new major versions of the role while it's still developed for a specific Longhorn release.
14+
I tag every release and try to stay with [semantic versioning](http://semver.org). If you want to use the role I recommend to checkout the latest tag. The master branch is basically development while the tags mark stable releases. But in general I try to keep master in good shape too. A tag `0.4.1+1.5.4` means this is release `0.4.0` of this role and it contains Longhorn chart version `1.5.4` (which normally is the same as the Longhorn version itself). If the role itself changes `X.Y.Z` before `+` will increase. If the Longhorn chart version changes `X.Y.Z` after `+` will increase too. This allows to tag bugfixes and new major versions of the role while it's still developed for a specific Longhorn release.
1515

1616
Requirements
1717
------------
@@ -43,7 +43,7 @@ Role variables
4343

4444
```yaml
4545
# Helm chart version
46-
longhorn_chart_version: "1.5.3"
46+
longhorn_chart_version: "1.5.4"
4747

4848
# Helm release name
4949
longhorn_release_name: "longhorn"
@@ -181,11 +181,11 @@ longhorn_label_nodes: false
181181
Usage
182182
-----
183183

184-
Before you start installing Longhorn you REALLY want to read the [The Longhorn Documentation](https://longhorn.io/docs/1.5.3/)! As data is the most valuable thing you can have you should understand how Longhorn works and don't forget to add backups later ;-). Esp. have a look at the [best practices](https://longhorn.io/docs/1.5.3/best-practices/).
184+
Before you start installing Longhorn you REALLY want to read the [The Longhorn Documentation](https://longhorn.io/docs/1.5.4/)! As data is the most valuable thing you can have you should understand how Longhorn works and don't forget to add backups later ;-). Esp. have a look at the [best practices](https://longhorn.io/docs/1.5.4/best-practices/).
185185

186-
That said: The first thing to do is to check `templates/longhorn_values_default.yml.j2`. This file contains the values/settings for the Longhorn Helm chart that are partly default anyways (just to avoid that someone changes the defaults) or different to the default ones which are located [here](https://github.com/longhorn/longhorn/blob/v1.5.3/chart/values.yaml). All settings can be found in the [Settings Reference](https://longhorn.io/docs/1.5.3/references/settings/).
186+
That said: The first thing to do is to check `templates/longhorn_values_default.yml.j2`. This file contains the values/settings for the Longhorn Helm chart that are partly default anyways (just to avoid that someone changes the defaults) or different to the default ones which are located [here](https://github.com/longhorn/longhorn/blob/v1.5.4/chart/values.yaml). All settings can be found in the [Settings Reference](https://longhorn.io/docs/1.5.4/references/settings/).
187187

188-
To use your own values just create a file called `longhorn_values_user.yml.j2` and put it into the `templates` directory. Then this Longhorn role will use that file to render the Helm values. You can use `templates/longhorn_values_default.yml.j2` as a template or just start from scratch. As mentioned above you can modify all settings for the Longhorn Helm chart that are different to the default ones which are located [here](https://github.com/longhorn/longhorn/blob/v1.5.3/chart/values.yaml).
188+
To use your own values just create a file called `longhorn_values_user.yml.j2` and put it into the `templates` directory. Then this Longhorn role will use that file to render the Helm values. You can use `templates/longhorn_values_default.yml.j2` as a template or just start from scratch. As mentioned above you can modify all settings for the Longhorn Helm chart that are different to the default ones which are located [here](https://github.com/longhorn/longhorn/blob/v1.5.4/chart/values.yaml).
189189

190190
After the values file (`templates/longhorn_values_default.yml.j2` or `templates/longhorn_values_user.yml.j2`) is in place and the `defaults/main.yml` values are checked and maybe adjusted accordingly, the role can be installed. Quite a few tasks need to communicate with the Kubernetes API server or executing [Helm](https://helm.sh/) commands. By default these commands are executed on the host where the `ansible-playbook` gets executed and the current user is used. But you can delegate this kind of tasks to a different host by using `longhorn_delegate_to` variable (see above).
191191

@@ -215,11 +215,11 @@ ansible-playbook --tags=role-longhorn-kubernetes --extra-vars longhorn_action=in
215215

216216
To check if everything was deployed use the usual `kubectl` commands like `kubectl -n <longhorn_namespace> get pods -o wide`. The first installation will take quite some time if your internet connection isn't the fastest one. Lots of container images need to be downloaded.
217217

218-
As Longhorn gets updates/upgrades every few weeks/months the role also can do upgrades. For updates/upgrades (esp. major upgrades) have a look at `tasks/upgrade.yml` to see what's happening before, during and after the update. Of course you should consult Longhorn's [upgrade guide](https://longhorn.io/docs/1.5.3/deploy/upgrade/) (the link is for upgrading to Longhorn `v1.5.3`) to check for major changes and stuff like that before upgrading. Now is also a good time to check if the backups are in place and if the backups are actually valid ;-)
218+
As Longhorn gets updates/upgrades every few weeks/months the role also can do upgrades. For updates/upgrades (esp. major upgrades) have a look at `tasks/upgrade.yml` to see what's happening before, during and after the update. Of course you should consult Longhorn's [upgrade guide](https://longhorn.io/docs/1.5.4/deploy/upgrade/) (the link is for upgrading to Longhorn `v1.5.4`) to check for major changes and stuff like that before upgrading. Now is also a good time to check if the backups are in place and if the backups are actually valid ;-)
219219

220-
After consulting Longhorn's [upgrade guide](https://longhorn.io/docs/1.5.3/deploy/upgrade/) you basically only need to change `longhorn_chart_version` variable e.g. from `1.5.3` to `1.5.4` for a patch release or from `1.4.3` to `1.5.3` for a major upgrade. And of course the Helm values need to be adjusted for potential breaking changes (if any are mentioned in the upgrade guide e.g.).
220+
After consulting Longhorn's [upgrade guide](https://longhorn.io/docs/1.5.4/deploy/upgrade/) you basically only need to change `longhorn_chart_version` variable e.g. from `1.5.4` to `1.5.5` for a patch release or from `1.4.3` to `1.5.4` for a major upgrade. And of course the Helm values need to be adjusted for potential breaking changes (if any are mentioned in the upgrade guide e.g.).
221221

222-
You can also use the upgrade method if you keep the version number and just want to change some Helm values or other settings. But please be aware that changing some of settings might have some serious consequences if you already have volumes deployed! Not all Longhorn settings can be changed just by changing a number or a string. So you really want to consult the [Settings reference](https://longhorn.io/docs/1.5.3/references/settings/) to figure out what might happen if you change this or that setting or what you need to do before you apply a changed setting!
222+
You can also use the upgrade method if you keep the version number and just want to change some Helm values or other settings. But please be aware that changing some of settings might have some serious consequences if you already have volumes deployed! Not all Longhorn settings can be changed just by changing a number or a string. So you really want to consult the [Settings reference](https://longhorn.io/docs/1.5.4/references/settings/) to figure out what might happen if you change this or that setting or what you need to do before you apply a changed setting!
223223

224224
That said to actually do the update/upgrade run
225225

@@ -237,7 +237,7 @@ ansible-playbook \
237237
k8s.yml
238238
```
239239

240-
Longhorn has a [Deleting Confirmation Flag](https://longhorn.io/docs/1.5.3/references/settings/#deleting-confirmation-flag) which is set to `false` by default. In this case Longhorn refuses to be uninstalled. By setting `--extra-vars longhorn_delete=true` the Ansible role will set this flag to `true` and afterwards the Longhorn resources can be deleted by the role. Without `longhorn_delete` variable the role will refuse to finish uninstallation.
240+
Longhorn has a [Deleting Confirmation Flag](https://longhorn.io/docs/1.5.4/references/settings/#deleting-confirmation-flag) which is set to `false` by default. In this case Longhorn refuses to be uninstalled. By setting `--extra-vars longhorn_delete=true` the Ansible role will set this flag to `true` and afterwards the Longhorn resources can be deleted by the role. Without `longhorn_delete` variable the role will refuse to finish uninstallation.
241241

242242
The role also allows to set Kubernetes node labels. First `longhorn_label_nodes: true` must be set. Next the nodes that should be labeled must be assigned to two Ansible groups. By default all nodes that should run Longhorn system components are part of a group called `k8s_longhorn_system`. This can be changed by setting `longhorn_nodes_system` to a different value. For the Longhorn user components the group is called `k8s_longhorn_user`. This can also be changed by adjusting `longhorn_nodes_user` variable value. Finally you need to decide how the labels should be called. This can be done by setting `longhorn_node_selector_system` and `longhorn_node_selector_user` accordingly. All the variables are described in detail above in the variable section.
243243

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: GPL-3.0-or-later
44

55
# Helm chart version
6-
longhorn_chart_version: "1.5.3"
6+
longhorn_chart_version: "1.5.4"
77

88
# Helm release name
99
longhorn_release_name: "longhorn"

molecule/default/molecule.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ driver:
1313

1414
platforms:
1515
- name: test-assets
16-
box: generic/ubuntu2204
17-
memory: 1536
16+
box: alvistack/ubuntu-22.04
17+
memory: 2048
1818
cpus: 2
1919
groups:
2020
- vpn
@@ -26,7 +26,7 @@ platforms:
2626
type: static
2727
ip: 172.16.10.5
2828
- name: test-controller1
29-
box: generic/ubuntu2204
29+
box: alvistack/ubuntu-22.04
3030
memory: 2048
3131
cpus: 2
3232
groups:
@@ -42,7 +42,7 @@ platforms:
4242
type: static
4343
ip: 172.16.10.10
4444
- name: test-controller2
45-
box: generic/ubuntu2004
45+
box: alvistack/ubuntu-20.04
4646
memory: 2048
4747
cpus: 2
4848
groups:
@@ -58,7 +58,7 @@ platforms:
5858
type: static
5959
ip: 172.16.10.20
6060
- name: test-controller3
61-
box: generic/ubuntu2004
61+
box: alvistack/ubuntu-20.04
6262
memory: 2048
6363
cpus: 2
6464
groups:
@@ -74,7 +74,7 @@ platforms:
7474
type: static
7575
ip: 172.16.10.30
7676
- name: test-worker1
77-
box: generic/ubuntu2204
77+
box: alvistack/ubuntu-22.04
7878
memory: 2048
7979
cpus: 2
8080
provider_raw_config_args:
@@ -92,7 +92,7 @@ platforms:
9292
type: static
9393
ip: 172.16.10.100
9494
- name: test-worker2
95-
box: generic/ubuntu2004
95+
box: alvistack/ubuntu-20.04
9696
memory: 2048
9797
cpus: 2
9898
provider_raw_config_args:
@@ -111,7 +111,7 @@ platforms:
111111
type: static
112112
ip: 172.16.10.110
113113
- name: test-worker3
114-
box: generic/ubuntu2204
114+
box: alvistack/ubuntu-22.04
115115
memory: 2048
116116
cpus: 2
117117
provider_raw_config_args:
@@ -130,7 +130,7 @@ platforms:
130130
type: static
131131
ip: 172.16.10.120
132132
- name: test-worker4
133-
box: generic/ubuntu2004
133+
box: alvistack/ubuntu-20.04
134134
memory: 2048
135135
cpus: 2
136136
provider_raw_config_args:

molecule/default/prepare.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- name: Update cache
66
hosts: k8s
7+
remote_user: vagrant
8+
become: true
79
gather_facts: true
810
tasks:
911
- name: Update APT package cache
@@ -13,6 +15,8 @@
1315

1416
- name: Harden hosts
1517
hosts: all
18+
remote_user: vagrant
19+
become: true
1620
gather_facts: true
1721
tasks:
1822
- name: Setup harden_linux role
@@ -21,6 +25,8 @@
2125

2226
- name: Setup Wireguard VPN
2327
hosts: vpn
28+
remote_user: vagrant
29+
become: true
2430
gather_facts: true
2531
tasks:
2632
- name: Setup wireguard role
@@ -29,6 +35,8 @@
2935

3036
- name: Setup cfssl
3137
hosts: k8s_assets
38+
remote_user: vagrant
39+
become: true
3240
gather_facts: false
3341
tasks:
3442
- name: Install cfssl
@@ -51,6 +59,8 @@
5159

5260
- name: Setup etcd
5361
hosts: k8s_etcd
62+
remote_user: vagrant
63+
become: true
5464
gather_facts: true
5565
tasks:
5666
- name: Include etcd role
@@ -59,6 +69,7 @@
5969

6070
- name: Setup Kubernetes client tooling
6171
hosts: k8s_assets
72+
become: true
6273
gather_facts: true
6374
tasks:
6475
- name: Install kubectl
@@ -85,6 +96,8 @@
8596

8697
- name: Setup HAProxy
8798
hosts: ubuntu22
99+
remote_user: vagrant
100+
become: true
88101
gather_facts: true
89102
tasks:
90103
- name: Setup haproxy role
@@ -93,6 +106,7 @@
93106

94107
- name: Install runc, CNI plugins and containerd
95108
hosts: k8s_worker
109+
become: true
96110
gather_facts: true
97111
tasks:
98112
- name: Include runc role
@@ -109,6 +123,7 @@
109123

110124
- name: Setup Kubernetes controller
111125
hosts: k8s_controller
126+
become: true
112127
gather_facts: true
113128
tasks:
114129
- name: Include kubernetes_controller role
@@ -117,20 +132,31 @@
117132

118133
- name: Prepare kubeconfig for vagrant user
119134
hosts: k8s_assets
135+
become: true
120136
gather_facts: false
121137
vars:
122138
k8s_controller__vagrant_kube_directory: "/home/vagrant/.kube"
123139
tasks:
124140
- name: Ensure .kube directory in vagrant home
125141
ansible.builtin.file:
142+
path: "{{ k8s_controller__vagrant_kube_directory }}"
143+
state: directory
144+
mode: "0700"
145+
owner: "vagrant"
146+
group: "vagrant"
147+
148+
- name: Copy admin.kubeconfig to vagrant home directory
149+
ansible.builtin.copy:
126150
src: "{{ k8s_admin_conf_dir }}/admin.kubeconfig"
127-
dest: "{{ k8s_admin_conf_dir }}/config"
128-
state: link
151+
dest: "{{ k8s_controller__vagrant_kube_directory }}/config"
152+
mode: "0400"
153+
remote_src: true
129154
owner: "vagrant"
130155
group: "vagrant"
131156

132157
- name: Setup LVM volumes for Longhorn
133158
hosts: lvm
159+
become: true
134160
gather_facts: true
135161
tasks:
136162
- name: Include LVM role
@@ -139,6 +165,7 @@
139165

140166
- name: Setup K8s worker
141167
hosts: k8s_worker
168+
become: true
142169
gather_facts: true
143170
tasks:
144171
- name: Setup Kubernetes worker
@@ -147,6 +174,7 @@
147174

148175
- name: Setup Cilium
149176
hosts: k8s_worker
177+
become: true
150178
gather_facts: true
151179
environment:
152180
K8S_AUTH_KUBECONFIG: "{{ k8s_admin_conf_dir }}/admin.kubeconfig"

molecule/default/tasks/kube-admin-user.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)