Skip to content

Commit c9887d2

Browse files
authored
27.1.0+1.32.9 (#76)
* kube-apiserver.service.j2: remove cluster_hosts() macro and adjust 'combine k8s_apiserver_settings and k8s_apiserver_settings_user' task accordingly * Molecule: install python3-kubernetes package instead kubernetes Pip in prepare.yml * defaults/main.yml: k8s_ctl_api_endpoint_host/k8s_admin_api_endpoint_host - simplify the complex default variables for endpoint hosts to avoid nested template construction * update k8s_ctl_release to 1.32.9 * update CHANGELOG
1 parent d5f0950 commit c9887d2

File tree

6 files changed

+23
-17
lines changed

6 files changed

+23
-17
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## 27.1.0+1.32.9
4+
5+
- **UPDATE**
6+
- update `k8s_ctl_release` to `1.32.9`
7+
8+
- **OTHER CHANGES**
9+
- fix for Ansible 2.19 in `kube-apiserver.service.j2`: remove `cluster_hosts()` macro and adjust `combine k8s_apiserver_settings and k8s_apiserver_settings_user` task accordingly
10+
- `defaults/main.yml`: `k8s_ctl_api_endpoint_host`/`k8s_admin_api_endpoint_host` - simplify the complex default variables for endpoint hosts to avoid nested template construction
11+
12+
- **MOLECULE**
13+
- install `python3-kubernetes` package instead `kubernetes` Pip in `prepare.yml`
14+
315
## 27.0.0+1.32.8
416

517
- **BREAKING**

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This role is used in [Kubernetes the not so hard way with Ansible - Control plan
44

55
## Versions
66

7-
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 `27.0.0+1.32.8` means this is release `27.0.0` of this role and it's meant to be used with Kubernetes version `1.32.8` (but should work with any K8s 1.32.x release of course). If the role itself changes `X.Y.Z` before `+` will increase. If the Kubernetes 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 Kubernetes release. That's especially useful for Kubernetes major releases with breaking changes.
7+
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 `27.1.0+1.32.9` means this is release `27.1.0` of this role and it's meant to be used with Kubernetes version `1.32.9` (but should work with any K8s 1.32.x release of course). If the role itself changes `X.Y.Z` before `+` will increase. If the Kubernetes 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 Kubernetes release. That's especially useful for Kubernetes major releases with breaking changes.
88

99
## Requirements
1010

@@ -74,7 +74,7 @@ See full [CHANGELOG.md](https://github.com/githubixx/ansible-role-kubernetes-con
7474
roles:
7575
- name: githubixx.kubernetes_controller
7676
src: https://github.com/githubixx/ansible-role-kubernetes-controller.git
77-
version: 27.0.0+1.32.8
77+
version: 27.1.0+1.32.9
7878
```
7979
8080
## Role (default) variables
@@ -104,7 +104,7 @@ k8s_ctl_pki_dir: "{{ k8s_ctl_conf_dir }}/pki"
104104
k8s_ctl_bin_dir: "/usr/local/bin"
105105

106106
# The Kubernetes release.
107-
k8s_ctl_release: "1.32.8"
107+
k8s_ctl_release: "1.32.9"
108108

109109
# The interface on which the Kubernetes services should listen on. As all cluster
110110
# communication should use a VPN interface the interface name is

defaults/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ k8s_ctl_pki_dir: "{{ k8s_ctl_conf_dir }}/pki"
2323
k8s_ctl_bin_dir: "/usr/local/bin"
2424

2525
# The Kubernetes release.
26-
k8s_ctl_release: "1.32.8"
26+
k8s_ctl_release: "1.32.9"
2727

2828
# The interface on which the Kubernetes services should listen on. As all cluster
2929
# communication should use a VPN interface the interface name is
@@ -113,7 +113,7 @@ k8s_ctl_delegate_to: "127.0.0.1"
113113
# variable of https://github.com/githubixx/ansible-role-kubernetes-ca
114114
# role). If it's not specified you'll get certificate errors in the
115115
# logs of the services mentioned above.
116-
k8s_ctl_api_endpoint_host: "{% set controller_host = groups['k8s_controller'][0] %}{{ hostvars[controller_host]['ansible_' + hostvars[controller_host]['k8s_interface']].ipv4.address }}"
116+
k8s_ctl_api_endpoint_host: "{{ hostvars[groups['k8s_controller'] | first]['ansible_' + hostvars[groups['k8s_controller'] | first]['k8s_interface']].ipv4.address }}"
117117

118118
# As above just for the port. It specifies on which port the
119119
# Kubernetes API servers are listening. Again if there is a loadbalancer
@@ -178,7 +178,7 @@ k8s_admin_conf_group: "root"
178178
#
179179
# Besides that basically the same comments as for "k8s_ctl_api_endpoint_host"
180180
# variable apply.
181-
k8s_admin_api_endpoint_host: "{% set controller_host = groups['k8s_controller'][0] %}{{ hostvars[controller_host]['ansible_' + hostvars[controller_host]['k8s_interface']].ipv4.address }}"
181+
k8s_admin_api_endpoint_host: "{{ hostvars[groups['k8s_controller'] | first]['ansible_' + hostvars[groups['k8s_controller'] | first]['k8s_interface']].ipv4.address }}"
182182

183183
# As above just for the port.
184184
k8s_admin_api_endpoint_port: "6443"

molecule/default/prepare.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
- python3-pip
8686

8787
- name: Install kubernetes Python package
88-
ansible.builtin.pip:
89-
name: kubernetes
88+
ansible.builtin.package:
89+
name: python3-kubernetes
9090
state: present
9191

9292
- name: Setup HAProxy

tasks/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@
203203

204204
- name: Combine k8s_apiserver_settings and k8s_apiserver_settings_user (if defined)
205205
ansible.builtin.set_fact:
206-
k8s_apiserver_settings: "{{ k8s_apiserver_settings | combine(k8s_apiserver_settings_user | default({})) }}"
206+
k8s_apiserver_settings: "{{ k8s_apiserver_settings | combine(k8s_apiserver_settings_user | default({})) | combine({'etcd-servers': k8s_ctl__etcd_servers}) }}"
207+
vars:
208+
k8s_ctl__etcd_servers: "{% for host in groups['k8s_etcd'] %}https://{{ hostvars[host]['ansible_' + k8s_ctl_etcd_interface].ipv4.address }}:{{ k8s_ctl_etcd_client_port }}{% if not loop.last %},{% endif %}{% endfor %}"
207209
tags:
208210
- k8s-controller
209211

templates/etc/systemd/system/kube-apiserver.service.j2

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
#jinja2: trim_blocks:False
2-
{%- macro cluster_hosts() -%}
3-
{%- for host in groups['k8s_etcd'] -%}
4-
https://{{ hostvars[host]['ansible_' + k8s_ctl_etcd_interface].ipv4.address }}:{{ k8s_ctl_etcd_client_port }}{% if not loop.last %},{% endif %}
5-
{%- endfor -%}
6-
{%- endmacro -%}
7-
8-
{%- set x=k8s_apiserver_settings.__setitem__('etcd-servers',cluster_hosts()) -%}
9-
102
[Unit]
113
Description=Kubernetes API Server
124
Documentation=https://github.com/GoogleCloudPlatform/kubernetes

0 commit comments

Comments
 (0)