Skip to content

Commit

Permalink
feat: addede kube-vip-watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Glants committed Oct 2, 2024
1 parent 2215cde commit 3d64d52
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
44 changes: 44 additions & 0 deletions apps/kube-vip-watcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM python:3.12-slim as base

# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1


FROM base AS python-deps
ARG VERSION
# Install pipenv and compilation dependencies
RUN pip install pipenv
RUN apt-get update && apt-get install -y --no-install-recommends gcc git g++
RUN git clone --depth 1 --branch ${VERSION} https://github.com/BBQigniter/kube-vip-watcher.git /src
RUN chmod +x /src/*.py
RUN chmod +x /src/healthchecks/*.py
# Install python dependencies in /.venv
COPY Pipfile .
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy


FROM base AS runtime
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETOS
LABEL xyz.glants.image.target_platform=$TARGETPLATFORM
LABEL xyz.glants.image.target_architecture=$TARGETARCH
LABEL xyz.glants.image.target_os=$TARGETOS
LABEL org.opencontainers.image.title="emonoda"
LABEL org.opencontainers.image.source="https://github.com/mdevaev/emonoda"
# Copy virtual env from python-deps stage
COPY --from=python-deps /.venv /.venv
COPY --from=python-deps /src/kube-vip-watcher.py /app/
COPY --from=python-deps /src/healthchecks /app/
COPY --from=python-deps /src/lib /app/lib/

ENV PATH="/.venv/bin:/app:$PATH"

# Create and switch to a new user
RUN useradd --create-home app
WORKDIR /home/app
USER app
ENTRYPOINT ["kube-vip-watcher.py"]
14 changes: 14 additions & 0 deletions apps/kube-vip-watcher/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
kubernetes = "*"
psutil = "*"
coloredlogs = "*"

[dev-packages]

[requires]
python_version = "3"
21 changes: 21 additions & 0 deletions apps/kube-vip-watcher/ci/latest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python

import requests
import json

# Get the latest version of matchbox

URL = "https://api.github.com/repos/BBQigniter/kube-vip-watcher/tags"

def get_latest(channel):
r = requests.get(URL)
data = json.loads(r.text)
versions = [ release['name'].replace('v', '') for release in data ]
latest_version = max(versions)

return str(latest_version)

if __name__ == "__main__":
import sys
channel = sys.argv[1]
print(get_latest(channel))
12 changes: 12 additions & 0 deletions apps/kube-vip-watcher/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
app: "kube-vip-watcher"
base: false
semantic_versioning: true
channels:
- name: "stable"
platforms:
- linux/arm64
- linux/amd64
stable: true
tests:
enabled: false

0 comments on commit 3d64d52

Please sign in to comment.