diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5ed13e1..496a4d5 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -49,4 +49,4 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "${{ vars.SKIP_CI_PREFIX }} Push updated changelog" - file_pattern: "\\.changes/* CHANGELOG.md" + file_pattern: "\\.changes/* CHANGELOG.md .changie.yaml" diff --git a/Dockerfile b/Dockerfile index d728302..a0c6927 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ FROM alpine:3.21 +ARG TARGETOS +ARG TARGETARCH +ARG TARGETPLATFORM + LABEL architecture="$TARGETPLATFORM" \ license="beerware" \ name="keepalived" \ @@ -14,13 +18,18 @@ RUN apk add --no-cache \ && addgroup -S keepalived_script \ && adduser -S -s /sbin/nologin -G keepalived_script -H keepalived_script -ENV STATE BACKUP -ENV INTERFACE enp3s0 -ENV PRIORITY 200 -ENV PASSWORD "" -ENV SRC_IP "" -ENV PEER_IP_0 "" -ENV PEER_IP_1 "" +ARG KEEPALIVED_EXPORTER_VERSION=1.4.0 +RUN wget -O /usr/local/bin/keepalived-exporter.tar.gz https://github.com/mehdy/keepalived-exporter/releases/download/v${KEEPALIVED_EXPORTER_VERSION}/keepalived-exporter_${KEEPALIVED_EXPORTER_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz && \ + tar -xvf /usr/local/bin/keepalived-exporter.tar.gz -C /usr/local/bin/ keepalived-exporter && \ + rm -f /usr/local/bin/keepalived-exporter.tar.gz + +ENV STATE=BACKUP +ENV INTERFACE=enp3s0 +ENV PRIORITY=200 +ENV PASSWORD="" +ENV SRC_IP="" +ENV PEER_IP_0="" +ENV PEER_IP_1="" COPY --chmod=750 --chown=keepalived_script:keepalived_script check_apiserver.sh /usr/lib/keepalived/scripts/chk_kube_apiserver.sh COPY keepalived.template.conf /etc/keepalived/keepalived.template.conf diff --git a/Makefile b/Makefile index f051cdd..6770761 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .PHONY: imageKeepalived -REGISTRY_IP=container.localdomain +REGISTRY_NAME=container.localdomain +REGISTRY_PORT=443 # linux/arm/v7 # linux/arm/v6 # linux/arm64 @@ -12,10 +13,10 @@ VERBOSITY=debug ## build imageKeepalived: - docker manifest rm $(REGISTRY_IP):5000/keepalived-k8s:latest || true - docker-multi-arch-builder build -n keepalived-k8s --platforms $(PLATFORM) -v $(VERBOSITY) + docker manifest rm $(REGISTRY_NAME):$(REGISTRY_PORT)/keepalived-k8s:latest || true + docker-multi-arch-builder build -n keepalived-k8s --platforms $(PLATFORM) -v $(VERBOSITY) --registry $(REGISTRY_NAME) --port $(REGISTRY_PORT) ## management status: - @curl -s $(REGISTRY_IP):5000/v2/_catalog | jq + @curl -ks -H "Host: $(REGISTRY_NAME)" https://$(REGISTRY_NAME):$(REGISTRY_PORT)/v2/_catalog | jq diff --git a/init.sh b/init.sh index dff2ef6..6de7e2f 100644 --- a/init.sh +++ b/init.sh @@ -2,4 +2,8 @@ envsubst < /etc/keepalived/keepalived.template.conf > /etc/keepalived/keepalived.conf +keepalived-exporter -ka.pid-path /var/run/keepalived/keepalived.pid -web.listen-address :9187 -web.telemetry-path /metrics & +mkdir -p /var/run/keepalived +echo "$!" > /var/run/keepalived/exporter.pid + exec "$@"