forked from kubernetes/autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: kube-hetzner own cluster autoscaler image
- Loading branch information
Showing
9 changed files
with
134 additions
and
60 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,12 @@ | ||
name: Cluster Autoscaler | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/multi-arch-build.yaml | ||
with: | ||
image: ghcr.io/kube-hetzner/autoscaler/cluster-autoscaler | ||
context: cluster-autoscaler | ||
digestName: 'cluster-autoscaler' |
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,108 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
required: true | ||
type: string | ||
context: | ||
required: true | ||
type: string | ||
dockerfile: | ||
required: false | ||
type: string | ||
default: ${{ inputs.context }} | ||
digestName: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ inputs.image }} | ||
tags: | | ||
type=raw,value=latest,enable=true | ||
type=raw,value={{date 'YYYYMMDD'}},enable=true | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: ${{ inputs.buildArgs }} | ||
context: ${{ inputs.context }} | ||
file: ${{ inputs.dockerfile }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ matrix.platform }} | ||
outputs: type=image,name=${{ inputs.image }},push-by-digest=true,name-canonical=true,push=true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.digestName }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
merge: | ||
name: Merge and publish | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.digestName }} | ||
path: /tmp/digests | ||
- uses: geekyeggo/delete-artifact@v2 | ||
with: | ||
name: ${{ inputs.digestName }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ inputs.image }} | ||
tags: | | ||
type=raw,value=latest,enable=true | ||
type=raw,value={{date 'YYYYMMDD'}},enable=true | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ inputs.image }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ inputs.image }}:${{ steps.meta.outputs.version }} |
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,14 @@ | ||
ARG BASEIMAGE=gcr.io/distroless/static:nonroot | ||
|
||
FROM golang:1.21 as build | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN CGO_ENABLED=0 go build -v -o /build/cluster-autoscaler | ||
|
||
FROM $BASEIMAGE | ||
|
||
COPY --from=build /build/cluster-autoscaler /cluster-autoscaler | ||
WORKDIR / | ||
CMD ["/cluster-autoscaler"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.