Skip to content

Commit

Permalink
Add shell script to patch configmap for kube-proxy
Browse files Browse the repository at this point in the history
Signed-off-by: michal.gubricky <michal.gubricky@dnation.cloud>
  • Loading branch information
michal-gubricky committed Jul 19, 2024
1 parent b450cdc commit 9801c10
Showing 1 changed file with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ spec:
extraArgs:
cloud-provider: external
bind-address: 0.0.0.0
secure-port: 10257
secure-port: "10257"
scheduler:
extraArgs:
bind-address: 0.0.0.0
secure-port: 10259
secure-port: "10259"
etcd:
local:
dataDir: /var/lib/etcd
Expand All @@ -29,6 +29,54 @@ spec:
election-timeout: "2500"
heartbeat-interval: "250"
snapshot-count: "6400"
files:
- content: |
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
metricsBindAddress: "0.0.0.0:10249"
path: /etc/kube-proxy-config.yaml
- content: |
#!/usr/bin/env bash
#
# (PK) I couldn't find a better/simpler way to conifgure it. See:
# https://github.com/kubernetes-sigs/cluster-api/issues/4512
#
set -o errexit
set -o nounset
set -o pipefail
dir=$( cd "$( dirname "$${BASH_SOURCE[0]}" )" && pwd )
readonly dir
# Exit fast if already appended.
if [[ ! -f $${dir}/kube-proxy-config.yaml ]]; then
exit 0
fi
# kubeadm config is in different directory in Flatcar (/etc) and Ubuntu (/run/kubeadm).
kubeadm_file="/etc/kubeadm.yml"
if [[ ! -f $${kubeadm_file} ]]; then
kubeadm_file="/run/kubeadm/kubeadm.yaml"
fi
# Run this script only if this is the init node.
if [[ ! -f $${kubeadm_file} ]]; then
exit 0
fi
# Append kube-proxy-config.yaml to kubeadm config and delete it
cat "$${dir}/kube-proxy-config.yaml" >> "$${kubeadm_file}"
rm "$${dir}/kube-proxy-config.yaml"
echo success > /tmp/kube-proxy-patch
owner: root:root
path: /etc/kube-proxy-patch.sh
permissions: "0755"
preKubeadmCommands:
- bash /etc/kube-proxy-patch.sh
initConfiguration:
nodeRegistration:
kubeletExtraArgs:
Expand Down

0 comments on commit 9801c10

Please sign in to comment.