Skip to content

Commit e2a7a10

Browse files
committed
feat: kube-hetzner own cluster autoscaler image
1 parent 4d8e654 commit e2a7a10

File tree

9 files changed

+132
-60
lines changed

9 files changed

+132
-60
lines changed
File renamed without changes.
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Cluster Autoscaler
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
uses: ./.github/workflows/multi-arch-build.yaml
9+
with:
10+
image: ghcr.io/kube-hetzner/autoscaler/cluster-autoscaler
11+
context: cluster-autoscaler
12+
digestName: 'cluster-autoscaler'
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
image:
5+
required: true
6+
type: string
7+
context:
8+
required: true
9+
type: string
10+
dockerfile:
11+
required: false
12+
type: string
13+
default: ${{ inputs.context }}
14+
digestName:
15+
required: true
16+
type: string
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
platform:
25+
- linux/amd64
26+
- linux/arm64
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Docker meta
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ inputs.image }}
35+
tags: |
36+
type=raw,value=latest,enable=true
37+
type=raw,value={{date 'YYYYMMDD'}},enable=true
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Build and push by digest
47+
id: build
48+
uses: docker/build-push-action@v5
49+
with:
50+
build-args: ${{ inputs.buildArgs }}
51+
context: ${{ inputs.context }}
52+
file: ${{ inputs.dockerfile }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
platforms: ${{ matrix.platform }}
55+
outputs: type=image,name=${{ inputs.image }},push-by-digest=true,name-canonical=true,push=true
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
- name: Export digest
59+
run: |
60+
mkdir -p /tmp/digests
61+
digest="${{ steps.build.outputs.digest }}"
62+
touch "/tmp/digests/${digest#sha256:}"
63+
- name: Upload digest
64+
uses: actions/upload-artifact@v3
65+
with:
66+
name: ${{ inputs.digestName }}
67+
path: /tmp/digests/*
68+
if-no-files-found: error
69+
retention-days: 1
70+
71+
merge:
72+
name: Merge and publish
73+
runs-on: ubuntu-latest
74+
needs:
75+
- build
76+
steps:
77+
- name: Download digests
78+
uses: actions/download-artifact@v3
79+
with:
80+
name: ${{ inputs.digestName }}
81+
path: /tmp/digests
82+
- uses: geekyeggo/delete-artifact@v2
83+
with:
84+
name: ${{ inputs.digestName }}
85+
- name: Set up Docker Buildx
86+
uses: docker/setup-buildx-action@v3
87+
- name: Docker meta
88+
id: meta
89+
uses: docker/metadata-action@v5
90+
with:
91+
images: ${{ inputs.image }}
92+
tags: |
93+
type=raw,value=latest,enable=true
94+
type=raw,value={{date 'YYYYMMDD'}},enable=true
95+
- name: Login to GitHub Container Registry
96+
uses: docker/login-action@v3
97+
with:
98+
registry: ghcr.io
99+
username: ${{ github.actor }}
100+
password: ${{ secrets.GITHUB_TOKEN }}
101+
- name: Create manifest list and push
102+
working-directory: /tmp/digests
103+
run: |
104+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
105+
$(printf '${{ inputs.image }}@sha256:%s ' *)
106+
- name: Inspect image
107+
run: |
108+
docker buildx imagetools inspect ${{ inputs.image }}:${{ steps.meta.outputs.version }}

cluster-autoscaler/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.21 as build
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
RUN go build -v -o /usr/local/bin/app
7+
8+
FROM golang:1.21
9+
10+
COPY --from=build /usr/local/bin/app /usr/local/bin/app
11+
12+
CMD ["app"]

cluster-autoscaler/Dockerfile.amd64

Lines changed: 0 additions & 20 deletions
This file was deleted.

cluster-autoscaler/Dockerfile.arm64

Lines changed: 0 additions & 20 deletions
This file was deleted.

cluster-autoscaler/Dockerfile.s390x

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)