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

➕ Add default values to roles #509

Merged
8 changes: 8 additions & 0 deletions roles/download/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
argument_specs:
main:
short_description: Manage the downloading of K3S binaries
options:
k3s_version:
description: The desired version of K3S
required: true
4 changes: 4 additions & 0 deletions roles/k3s_agent/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
extra_agent_args: ""
group_name_master: master
systemd_dir: /etc/systemd/system
34 changes: 34 additions & 0 deletions roles/k3s_agent/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
argument_specs:
main:
short_description: Setup k3s agents
options:
apiserver_endpoint:
description: Virtual ip-address configured on each master
required: true

extra_agent_args:
description: Extra arguments for agents nodes

group_name_master:
description: Name of the master group
default: master

k3s_token:
description: Token used to communicate between masters

proxy_env:
type: dict
description: Internet proxy configurations
default: ~
options:
HTTP_PROXY:
required: true
HTTPS_PROXY:
required: true
NO_PROXY:
required: true

systemd_dir:
description: Path to systemd services
default: /etc/systemd/system
2 changes: 1 addition & 1 deletion roles/k3s_agent/templates/k3s.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ExecStart=/usr/local/bin/k3s agent \
--server https://{{ apiserver_endpoint | ansible.utils.ipwrap }}:6443 \
{% if is_pxe_booted | default(false) %}--snapshotter native \
{% endif %}--token {{ hostvars[groups[group_name_master | default('master')][0]]['token'] | default(k3s_token) }} \
{{ extra_agent_args | default("") }}
{{ extra_agent_args }}
KillMode=process
Delegate=yes
LimitNOFILE=1048576
Expand Down
6 changes: 0 additions & 6 deletions roles/k3s_custom_registries/defaults/main.yml

This file was deleted.

20 changes: 20 additions & 0 deletions roles/k3s_custom_registries/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
argument_specs:
main:
short_description: Configure the use of a custom container registry
options:
custom_registries_yaml:
description:
- YAML block defining custom registries.
- >
The following is an example that pulls all images used in
this playbook through your private registries.
- >
It also allows you to pull your own images from your private
registry, without having to use imagePullSecrets in your
deployments.
- >
If all you need is your own images and you don't care about
caching the docker/quay/ghcr.io images, you can just remove
those from the mirrors: section.
required: true
22 changes: 14 additions & 8 deletions roles/k3s_server/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
# If you want to explicitly define an interface that ALL control nodes
# should use to propagate the VIP, define it here. Otherwise, kube-vip
# will determine the right interface automatically at runtime.
kube_vip_iface: null
extra_server_args: ""

group_name_master: master

# Enables ARP broadcasts from Leader
kube_vip_arp: true
kube_vip_iface: ~
kube_vip_cloud_provider_tag_version: main
kube_vip_tag_version: v0.7.2

# Name of the master group
group_name_master: master
metal_lb_controller_tag_version: v0.14.3
metal_lb_speaker_tag_version: v0.14.3
metal_lb_type: native

retry_count: 20

# yamllint disable rule:line-length
server_init_args: >-
Expand All @@ -20,4 +24,6 @@ server_init_args: >-
{% endif %}
--token {{ k3s_token }}
{% endif %}
{{ extra_server_args | default('') }}
{{ extra_server_args }}

systemd_dir: /etc/systemd/system
90 changes: 90 additions & 0 deletions roles/k3s_server/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
argument_specs:
main:
short_description: Setup k3s servers
options:
apiserver_endpoint:
description: Virtual ip-address configured on each master
required: true

cilium_bgp:
description:
- Enable cilium BGP control plane for LB services and pod cidrs.
- Disables the use of MetalLB.
type: bool
default: ~

cilium_iface:
description: The network interface used for when Cilium is enabled
default: ~

extra_server_args:
description: Extra arguments for server nodes
default: ""

group_name_master:
description: Name of the master group
default: master

kube_vip_arp:
description: Enables ARP broadcasts from Leader
default: true
type: bool

kube_vip_iface:
description:
- Explicitly define an interface that ALL control nodes
- should use to propagate the VIP, define it here.
- Otherwise, kube-vip will determine the right interface
- automatically at runtime.
default: ~

kube_vip_tag_version:
description: Image tag for kube-vip
default: v0.7.2

kube_vip_cloud_provider_tag_version:
description: Tag for kube-vip-cloud-provider manifest when enabled
default: main

kube_vip_lb_ip_range:
description: IP range for kube-vip load balancer
default: ~

metal_lb_controller_tag_version:
description: Image tag for MetalLB
default: v0.14.3

metal_lb_speaker_tag_version:
description: Image tag for MetalLB
default: v0.14.3

metal_lb_type:
choices:
- frr
- native
default: native

proxy_env:
type: dict
description: Internet proxy configurations
default: ~
options:
HTTP_PROXY:
required: true
HTTPS_PROXY:
required: true
NO_PROXY:
required: true

retry_count:
description: Amount of retries when verifying that nodes joined
type: int
default: 20

server_init_args:
description: Arguments for server nodes

systemd_dir:
description: Path to systemd services
default: /etc/systemd/system
1 change: 0 additions & 1 deletion roles/k3s_server/tasks/http_proxy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Create k3s.service.d directory
file:
path: '{{ systemd_dir }}/k3s.service.d'
Expand Down
1 change: 0 additions & 1 deletion roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Stop k3s-init
systemd:
name: k3s-init
Expand Down
28 changes: 25 additions & 3 deletions roles/k3s_server_post/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
---
# Timeout to wait for MetalLB services to come up
metal_lb_available_timeout: 240s
bpf_lb_algorithm: maglev
bpf_lb_mode: hybrid

calico_blockSize: 26 # noqa var-naming
calico_ebpf: false
calico_encapsulation: VXLANCrossSubnet
calico_natOutgoing: Enabled # noqa var-naming
calico_nodeSelector: all() # noqa var-naming
calico_tag: v3.27.2

cilium_bgp: false
cilium_exportPodCIDR: true # noqa var-naming
cilium_bgp_my_asn: 64513
cilium_bgp_peer_asn: 64512
cilium_bgp_lb_cidr: 192.168.31.0/24
cilium_hubble: true
cilium_mode: native

# Name of the master group
cluster_cidr: 10.52.0.0/16
enable_bpf_masquerade: true
kube_proxy_replacement: true
group_name_master: master

metal_lb_mode: layer2
metal_lb_available_timeout: 240s
metal_lb_controller_tag_version: v0.14.3
metal_lb_ip_range: 192.168.30.80-192.168.30.90
Loading