feat: Remove option to disable kube-vip

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2022-12-15 18:47:40 -05:00
1 parent 9932f2705c
commit 1134b2927b
4 files changed
+8 -22

No files matched your search

-5
View File
@@ -36,11 +36,6 @@ export BOOTSTRAP_METALLB_INGRESS_ADDR=""
# e.g. age15uzrw396e67z9wdzsxzdk7ka0g2gr3l460e0slaea563zll3hdfqwqxdta # e.g. age15uzrw396e67z9wdzsxzdk7ka0g2gr3l460e0slaea563zll3hdfqwqxdta
export BOOTSTRAP_AGE_PUBLIC_KEY="" export BOOTSTRAP_AGE_PUBLIC_KEY=""
# Enable / Disable kube-vip
# If this is set to false (e.g. on a cluster with a single-node control plane), do not install kube-vip.
# BOOTSTRAP_KUBE_VIP_ADDR needs to be set to the IP the API Server is reachable under
export BOOTSTRAP_KUBE_VIP_ENABLED="true"
# The IP Address to use with kube-vip # The IP Address to use with kube-vip
# Pick a unused IP that is on the same network as your nodes # Pick a unused IP that is on the same network as your nodes
# and outside the ${BOOTSTRAP_METALLB_LB_RANGE} range # and outside the ${BOOTSTRAP_METALLB_LB_RANGE} range
@@ -8,6 +8,7 @@ resources:
- ./external-dns - ./external-dns
- ./ingress-nginx - ./ingress-nginx
- ./k8s-gateway - ./k8s-gateway
- ./kube-vip
- ./metallb - ./metallb
- ./metrics-server - ./metrics-server
- ./reloader - ./reloader
Vendored
+2 -16
View File
@@ -45,10 +45,8 @@ main() {
> "${PROJECT_DIR}/cluster/flux/vars/cluster-settings.yaml" > "${PROJECT_DIR}/cluster/flux/vars/cluster-settings.yaml"
envsubst < "${PROJECT_DIR}/tmpl/cluster/flux-cluster.yaml" \ envsubst < "${PROJECT_DIR}/tmpl/cluster/flux-cluster.yaml" \
> "${PROJECT_DIR}/cluster/flux/config/flux-cluster.yaml" > "${PROJECT_DIR}/cluster/flux/config/flux-cluster.yaml"
if [[ "${BOOTSTRAP_KUBE_VIP_ENABLED}" == "true" ]]; then envsubst < "${PROJECT_DIR}/tmpl/cluster/kube-vip-daemonset.yaml" \
envsubst < "${PROJECT_DIR}/tmpl/cluster/kube-vip-daemonset.yaml" \ > "${PROJECT_DIR}/cluster/apps/kube-system/kube-vip/daemon-set.yaml"
> "${PROJECT_DIR}/cluster/apps/kube-system/kube-vip/daemon-set.yaml"
fi
# generate cluster secrets # generate cluster secrets
envsubst < "${PROJECT_DIR}/tmpl/cluster/cluster-secrets.sops.yaml" \ envsubst < "${PROJECT_DIR}/tmpl/cluster/cluster-secrets.sops.yaml" \
> "${PROJECT_DIR}/cluster/flux/vars/cluster-secrets.sops.yaml" > "${PROJECT_DIR}/cluster/flux/vars/cluster-secrets.sops.yaml"
@@ -71,18 +69,6 @@ main() {
# generate ansible settings # generate ansible settings
envsubst < "${PROJECT_DIR}/tmpl/ansible/kube-vip.yml" \ envsubst < "${PROJECT_DIR}/tmpl/ansible/kube-vip.yml" \
> "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/kube-vip.yml" > "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/kube-vip.yml"
# include kube-vip if enabled
if [[ ${BOOTSTRAP_KUBE_VIP_ENABLED} == "true" ]]; then
if [[ $(yq eval --no-doc 'contains({"resources": ["kube-vip"]})' "${PROJECT_DIR}/cluster/apps/kube-system/kustomization.yaml") == false ]]; then
yq --inplace '.resources += [ "kube-vip" ]' "${PROJECT_DIR}/cluster/apps/kube-system/kustomization.yaml"
fi
if [[ $(yq eval --no-doc 'contains({"k3s_server_manifests_templates": ["kube-vip-daemonset.yaml.j2"]})' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml") == false ]]; then
yq --inplace '.k3s_server_manifests_templates += [ "kube-vip-daemonset.yaml.j2" ]' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml"
fi
if [[ $(yq eval --no-doc 'contains({"k3s_server_manifests_urls": [{"url": "https://kube-vip.io/manifests/rbac.yaml", "filename": "kube-vip-rbac.yaml"}]})' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml") == false ]]; then
yq --inplace '.k3s_server_manifests_urls += [{"url": "https://kube-vip.io/manifests/rbac.yaml", "filename": "kube-vip-rbac.yaml"}]' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml"
fi
fi
# generate ansible hosts file and secrets # generate ansible hosts file and secrets
generate_ansible_hosts generate_ansible_hosts
generate_ansible_host_secrets generate_ansible_host_secrets
@@ -28,6 +28,9 @@ k3s_registration_address: "{{ kubevip_address }}"
# (list) A list of URLs to deploy on the primary control plane. Read notes below. # (list) A list of URLs to deploy on the primary control plane. Read notes below.
k3s_server_manifests_urls: k3s_server_manifests_urls:
# Kube-vip
- url: https://kube-vip.io/manifests/rbac.yaml
filename": kube-vip-rbac.yaml
# Tigera Operator # Tigera Operator
# https://github.com/projectcalico/calico/issues/7003 # https://github.com/projectcalico/calico/issues/7003
- url: https://raw.githubusercontent.com/projectcalico/calico/v3.24.2/manifests/tigera-operator.yaml - url: https://raw.githubusercontent.com/projectcalico/calico/v3.24.2/manifests/tigera-operator.yaml
@@ -53,4 +56,5 @@ k3s_server_manifests_urls:
# (list) A flat list of templates to deploy on the primary control plane # (list) A flat list of templates to deploy on the primary control plane
# /var/lib/rancher/k3s/server/manifests # /var/lib/rancher/k3s/server/manifests
k3s_server_manifests_templates: k3s_server_manifests_templates:
- "calico-installation.yaml.j2" - calico-installation.yaml.j2
- kube-vip-daemonset.yaml.j2