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 several configuration options #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,35 @@ cilium_etcd_certfile: "cert-cilium.pem"

# etcd certificate key file (file will be fetched in "cilium_etcd_cert_directory")
cilium_etcd_keyfile: "cert-cilium-key.pem"

cilium_chaining_mode: portmap

# the IP addressing mode Cilium will use, default is "cluster-pool"
cilium_ipam_mode: cluster-pool

# when the cluster-pool IPAM mode is used, specify the CIDR used for pod IP allocation
cilium_ipam_cluster_pool_pod_cidr: "10.200.0.0/16"

# enable BGP annoucements using Cilium's MetalLB integration
cilium_bgp_enabled: false

# the BGP config file contents that will be added to the ConfigMap
# reference: https://metallb.universe.tf/configuration/
# example:
# cilium_bgp_config: |
# peers:
# - peer-address: 10.31.0.1
# peer-asn: 123
# my-asn: 321
#
# address-pools:
# - name: private
# avoid-buggy-ips: true
# protocol: bgp
# addresses:
# - 10.33.0.0/24
cilium_bgp_config: ~

# Whether or not Cilium should replace kube-proxy for network operations.
# The default is `probe` despite the Helm chart suggesting it's `disabled`.
cilium_kube_proxy_replacement: ~
20 changes: 20 additions & 0 deletions tasks/bgp_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- block:
- name: Assert the configuration is provided
ansible.builtin.assert:
that:
- cilium_bgp_config is defined
- cilium_bgp_config != None
- name: Add BGP configuration
k8s:
state: present
definition:
apiVersion: v1
kind: ConfigMap
metadata:
name: bgp-config
namespace: "{{ cilium_namespace }}"
data:
config.yaml: "{{ cilium_bgp_config }}"
delegate_to: 127.0.0.1
run_once: true
4 changes: 4 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
args:
executable: "/bin/bash"

- name: Add BGP support
include_tasks: bgp_config.yml
when: cilium_bgp_enabled

- name: Delete temporary file for Helm values
file:
path: "{{ cilium_values_tmp_file.path }}"
Expand Down
4 changes: 4 additions & 0 deletions tasks/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
args:
executable: "/bin/bash"

- name: Add BGP support
include_tasks: bgp_config.yml
when: cilium_bgp_enabled

- name: Delete temporary file for Helm values
file:
path: "{{ cilium_values_tmp_file.path }}"
Expand Down
24 changes: 23 additions & 1 deletion templates/cilium_values_default.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ bpf:
masquerade: true

cni:
chainingMode: portmap
{% if cilium_chaining_mode is defined %}
chainingMode: {{ cilium_chaining_mode }}
{% endif %}

{% if cilium_etcd_enabled is defined and cilium_etcd_enabled == "true" -%}
etcd:
enabled: true
Expand All @@ -39,3 +42,22 @@ etcd:
{% endfor -%}
ssl: {% if cilium_etcd_secrets_name is defined %}true{% else %}false{% endif -%}
{% endif %}

ipam:
mode: "{{ cilium_ipam_mode }}"
operator:
{% if cilium_ipam_cluster_pool_pod_cidr is defined %}
clusterPoolIPv4PodCIDR: "{{ cilium_ipam_cluster_pool_pod_cidr }}"
clusterPoolIPv4PodCIDRList: [ "{{ cilium_ipam_cluster_pool_pod_cidr }}" ]
{% endif %}

{% if cilium_bgp_enabled %}
bgp:
enabled: true
announce:
loadbalancerIP: true
{% endif %}

{% if cilium_kube_proxy_replacement is defined %}
kubeProxyReplacement: "{{ cilium_kube_proxy_replacement }}"
{% endif %}