-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add update kube-vip manifests script and use kube-vip 0.8.0
- Loading branch information
1 parent
ba7f694
commit d7ef1fd
Showing
8 changed files
with
117 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
readonly SCRIPT_DIR | ||
|
||
# shellcheck source=hack/common.sh | ||
source "${SCRIPT_DIR}/../common.sh" | ||
|
||
if [ -z "${KUBE_VIP_VERSION:-}" ]; then | ||
echo "Missing argument: KUBE_VIP_VERSION" | ||
exit 1 | ||
fi | ||
|
||
ASSETS_DIR="$(mktemp -d -p "${TMPDIR:-/tmp}")" | ||
readonly ASSETS_DIR | ||
trap_add "rm -rf ${ASSETS_DIR}" EXIT | ||
|
||
readonly FILE_NAME="kube-vip.yaml" | ||
|
||
docker container run --rm ghcr.io/kube-vip/kube-vip:"${KUBE_VIP_VERSION}" \ | ||
manifest pod \ | ||
--arp \ | ||
--address='{{ `{{ .ControlPlaneEndpoint.Host }}` }}' \ | ||
--port=-99999 \ | ||
--controlplane \ | ||
--leaderElection \ | ||
--leaseDuration=15 \ | ||
--leaseRenewDuration=10 \ | ||
--leaseRetry=2 \ | ||
--prometheusHTTPServer='' | | ||
gojq --yaml-input --yaml-output 'del(.metadata.creationTimestamp, .status) | .spec.containers[].imagePullPolicy |= "IfNotPresent"' | | ||
sed "s/\"-99999\"/'{{ \`{{ .ControlPlaneEndpoint.Port }}\` }}'/" >"${ASSETS_DIR}/${FILE_NAME}" | ||
|
||
kubectl create configmap "{{ .Values.hooks.kubeVip.defaultTemplateConfigMap.name }}" --dry-run=client --output yaml \ | ||
--from-file "${ASSETS_DIR}/${FILE_NAME}" \ | ||
>"${ASSETS_DIR}/kube-vip-configmap.yaml" | ||
|
||
# add warning not to edit file directly | ||
cat <<EOF >"${GIT_REPO_ROOT}/charts/cluster-api-runtime-extensions-nutanix/templates/kube-vip/manifests/kube-vip-configmap.yaml" | ||
$(cat "${GIT_REPO_ROOT}/hack/license-header.yaml.txt") | ||
#================================================================= | ||
# DO NOT EDIT THIS FILE | ||
# IT HAS BEEN GENERATED BY /hack/addons/update-kube-vip-manifests.sh | ||
#================================================================= | ||
{{- if .Values.hooks.kubeVip.defaultTemplateConfigMap.create }} | ||
$(cat "${ASSETS_DIR}/kube-vip-configmap.yaml") | ||
{{- end -}} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters