Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ephemeral storage #6566

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions .github/workflows/cluster-autoscaler.yaml
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'
108 changes: 108 additions & 0 deletions .github/workflows/multi-arch-build.yaml
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 }}
14 changes: 14 additions & 0 deletions cluster-autoscaler/Dockerfile
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"]
20 changes: 0 additions & 20 deletions cluster-autoscaler/Dockerfile.amd64

This file was deleted.

20 changes: 0 additions & 20 deletions cluster-autoscaler/Dockerfile.arm64

This file was deleted.

20 changes: 0 additions & 20 deletions cluster-autoscaler/Dockerfile.s390x

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,11 @@ func getMachineTypeResourceList(m *hetznerManager, instanceType string) (apiv1.R

return apiv1.ResourceList{
// TODO somehow determine the actual pods that will be running
apiv1.ResourcePods: *resource.NewQuantity(defaultPodAmountsLimit, resource.DecimalSI),
apiv1.ResourceCPU: *resource.NewQuantity(int64(typeInfo.Cores), resource.DecimalSI),
apiv1.ResourceMemory: *resource.NewQuantity(int64(typeInfo.Memory*1024*1024*1024), resource.DecimalSI),
apiv1.ResourceStorage: *resource.NewQuantity(int64(typeInfo.Disk*1024*1024*1024), resource.DecimalSI),
apiv1.ResourcePods: *resource.NewQuantity(defaultPodAmountsLimit, resource.DecimalSI),
apiv1.ResourceCPU: *resource.NewQuantity(int64(typeInfo.Cores), resource.DecimalSI),
apiv1.ResourceMemory: *resource.NewQuantity(int64(typeInfo.Memory*1024*1024*1024), resource.DecimalSI),
apiv1.ResourceStorage: *resource.NewQuantity(int64(typeInfo.Disk*1024*1024*1024), resource.DecimalSI),
apiv1.ResourceEphemeralStorage: *resource.NewQuantity(int64(typeInfo.Disk*1024*1024*1024), resource.DecimalSI),
}, nil
}

Expand Down
Loading