Initial commit with utils image
This commit is contained in:
commit
66b6caf19a
64
.github/workflows/build-push-artifacts.yaml
vendored
Normal file
64
.github/workflows/build-push-artifacts.yaml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Publish artifacts
|
||||
# Run the tasks on every push
|
||||
on: push
|
||||
jobs:
|
||||
build_push_utils_image:
|
||||
name: Build and push utils image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Set up Docker layer caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-api-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-api-
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Calculate metadata for image
|
||||
id: image-meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ghcr.io/stackhpc/k8s-utils
|
||||
# Produce the branch name or tag and the SHA as tags
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=sha,prefix=
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./utils
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.image-meta.outputs.tags }}
|
||||
labels: ${{ steps.image-meta.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
# https://github.com/docker/buildx/pull/535
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# capi-helm-charts
|
||||
|
||||
This repository contains Helm charts that can be used to deploy Cluster API resources.
|
46
utils/Dockerfile
Normal file
46
utils/Dockerfile
Normal file
@ -0,0 +1,46 @@
|
||||
#####
|
||||
## Build specification for a container image containing tools that are useful
|
||||
## for deploying applications
|
||||
##
|
||||
## It is designed to be run as a job inside the target cluster
|
||||
#####
|
||||
|
||||
FROM alpine
|
||||
|
||||
# Install some useful tools
|
||||
RUN apk add --no-cache curl jq
|
||||
|
||||
# Because of the version skew policy, which only guarantees compatibility with a skew
|
||||
# of one minor version, we must install a bunch of kubectl versions
|
||||
ARG KUBECTL_VERSIONS="v1.22.0 v1.21.4 v1.20.10 v1.19.14 v1.18.20 v1.17.17"
|
||||
RUN set -ex; \
|
||||
OS_ARCH="$(uname -m)"; \
|
||||
case "$OS_ARCH" in \
|
||||
x86_64) kubectl_arch=amd64 ;; \
|
||||
aarch64) kubectl_arch=arm64 ;; \
|
||||
*) false ;; \
|
||||
esac; \
|
||||
for kubectl_version in $KUBECTL_VERSIONS; do \
|
||||
kubectl_minor_version=${kubectl_version%.*}; \
|
||||
kubectl_latest_version=${kubectl_latest_version:-$kubectl_minor_version}; \
|
||||
kubectl_url=https://dl.k8s.io/release/$kubectl_version/bin/linux/$kubectl_arch/kubectl; \
|
||||
kubectl_exe=/usr/bin/kubectl-$kubectl_minor_version; \
|
||||
curl -fsSL $kubectl_url -o $kubectl_exe; \
|
||||
chmod +x $kubectl_exe; \
|
||||
done; \
|
||||
ln -s /usr/bin/kubectl-$kubectl_latest_version /usr/bin/kubectl-latest
|
||||
|
||||
# This script uses the latest version to discover the version of the Kubernetes
|
||||
# cluster before picking the correct version to use
|
||||
COPY ./kubectl-shim /usr/bin/kubectl
|
||||
|
||||
ARG HELM_VERSION=v3.6.3
|
||||
RUN set -ex; \
|
||||
OS_ARCH="$(uname -m)"; \
|
||||
case "$OS_ARCH" in \
|
||||
x86_64) helm_arch=amd64 ;; \
|
||||
aarch64) helm_arch=arm64 ;; \
|
||||
*) false ;; \
|
||||
esac; \
|
||||
curl -fsSL https://get.helm.sh/helm-$HELM_VERSION-linux-$helm_arch.tar.gz | \
|
||||
tar -xz --strip-components 1 -C /usr/bin linux-$helm_arch/helm
|
6
utils/kubectl-shim
Executable file
6
utils/kubectl-shim
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
server_version="$(kubectl-latest version -o json | jq '"v" + .serverVersion.major + "." + .serverVersion.minor')"
|
||||
exec kubectl-$server_version "$@"
|
Loading…
x
Reference in New Issue
Block a user