Add option to disable kube-vip (part 2) (#386)

This commit is contained in:
Manuel Rüger authored and GitHub committed 2022-07-06 20:21:28 -04:00
1 parent 24c2dc3094
commit 7759b9270a
4 files changed
+14 -6

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@ export BOOTSTRAP_AGE_PUBLIC_KEY=""
# If this is set to false (e.g. on a cluster with a single-node control plane), do not install 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 # BOOTSTRAP_KUBE_VIP_ADDR needs to be set to the IP the API Server is reachable under
export BOOTSTRAP_KUBE_VIP_ENABLED="true" export BOOTSTRAP_KUBE_VIP_ENABLED="true"
# The IP Address to use with KubeVIP # 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
# and doesn't conflict with any other IP addresses here # and doesn't conflict with any other IP addresses here
@@ -4,7 +4,6 @@ kind: Kustomization
resources: resources:
- namespace.yaml - namespace.yaml
- cert-manager - cert-manager
- kube-vip
# - kured # - kured
- metrics-server - metrics-server
- reflector - reflector
Vendored
+13 -1
View File
@@ -71,7 +71,19 @@ 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"
# generate ansible hosts file and secrets # 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 generate_ansible_hosts
generate_ansible_host_secrets generate_ansible_host_secrets
setup_github_webhook setup_github_webhook
@@ -30,11 +30,8 @@ k3s_registration_address: "{{ kubevip_address }}"
k3s_server_manifests_urls: k3s_server_manifests_urls:
- url: https://docs.projectcalico.org/archive/v3.22/manifests/tigera-operator.yaml - url: https://docs.projectcalico.org/archive/v3.22/manifests/tigera-operator.yaml
filename: tigera-operator.yaml filename: tigera-operator.yaml
- url: https://kube-vip.io/manifests/rbac.yaml
filename: kube-vip-rbac.yaml
# (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"