Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 27.1.0+1.32.9

- **UPDATE**
- update `k8s_ctl_release` to `1.32.9`

- **OTHER CHANGES**
- 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
- `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

- **MOLECULE**
- install `python3-kubernetes` package instead `kubernetes` Pip in `prepare.yml`

## 27.0.0+1.32.8

- **BREAKING**
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This role is used in [Kubernetes the not so hard way with Ansible - Control plan

## Versions

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.
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.

## Requirements

Expand Down Expand Up @@ -74,7 +74,7 @@ See full [CHANGELOG.md](https://github.com/githubixx/ansible-role-kubernetes-con
roles:
- name: githubixx.kubernetes_controller
src: https://github.com/githubixx/ansible-role-kubernetes-controller.git
version: 27.0.0+1.32.8
version: 27.1.0+1.32.9
```

## Role (default) variables
Expand Down Expand Up @@ -104,7 +104,7 @@ k8s_ctl_pki_dir: "{{ k8s_ctl_conf_dir }}/pki"
k8s_ctl_bin_dir: "/usr/local/bin"

# The Kubernetes release.
k8s_ctl_release: "1.32.8"
k8s_ctl_release: "1.32.9"

# The interface on which the Kubernetes services should listen on. As all cluster
# communication should use a VPN interface the interface name is
Expand Down
6 changes: 3 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ k8s_ctl_pki_dir: "{{ k8s_ctl_conf_dir }}/pki"
k8s_ctl_bin_dir: "/usr/local/bin"

# The Kubernetes release.
k8s_ctl_release: "1.32.8"
k8s_ctl_release: "1.32.9"

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

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

# As above just for the port.
k8s_admin_api_endpoint_port: "6443"
Expand Down
4 changes: 2 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
- python3-pip

- name: Install kubernetes Python package
ansible.builtin.pip:
name: kubernetes
ansible.builtin.package:
name: python3-kubernetes
state: present

- name: Setup HAProxy
Expand Down
4 changes: 3 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@

- name: Combine k8s_apiserver_settings and k8s_apiserver_settings_user (if defined)
ansible.builtin.set_fact:
k8s_apiserver_settings: "{{ k8s_apiserver_settings | combine(k8s_apiserver_settings_user | default({})) }}"
k8s_apiserver_settings: "{{ k8s_apiserver_settings | combine(k8s_apiserver_settings_user | default({})) | combine({'etcd-servers': k8s_ctl__etcd_servers}) }}"
vars:
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 %}"
tags:
- k8s-controller

Expand Down
8 changes: 0 additions & 8 deletions templates/etc/systemd/system/kube-apiserver.service.j2
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#jinja2: trim_blocks:False
{%- macro cluster_hosts() -%}
{%- 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 -%}
{%- endmacro -%}

{%- set x=k8s_apiserver_settings.__setitem__('etcd-servers',cluster_hosts()) -%}

[Unit]
Description=Kubernetes API Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Expand Down