Skip to content

Commit

Permalink
build: add custom scheduler Dockerfile
Browse files Browse the repository at this point in the history
Problem: the sig-scheduler-plugins Dockerfile was updated to use
a distroless image over alpine, and this destroyed our logging
strategy so it was impossible to see printed messages from fluence.
Since this has bit us before, it will be a simpler strategy moving
forward to put this build under our control, and resort back to using
the previous alpine base.
Solution: add the src/build/scheduler/Dockerfile to our maintained
files, and ensure we use an alpine base that has a filesystem.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Oct 6, 2024
1 parent d61bc79 commit 5047dc1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ prepare: clone
# These are entirely new directory structures
rm -rf $(CLONE_UPSTREAM)/pkg/fluence
rm -rf $(CLONE_UPSTREAM)/pkg/logger
rm -rf $(CLONE_UPSTREAM)/build/scheduler
# rm -rf $(CLONE_UPSTREAM)/cmd/app
rm -rf $(CLONE_UPSTREAM)/pkg/controllers/podgroup_controller.go
rm -rf $(CLONE_UPSTREAM)/cmd/controller/app/server.go
cp -R sig-scheduler-plugins/pkg/logger $(CLONE_UPSTREAM)/pkg/logger
cp -R sig-scheduler-plugins/pkg/fluence $(CLONE_UPSTREAM)/pkg/fluence
cp -R sig-scheduler-plugins/build/scheduler $(CLONE_UPSTREAM)/build/scheduler
cp -R sig-scheduler-plugins/pkg/controllers/* $(CLONE_UPSTREAM)/pkg/controllers/
# This is the one exception not from sig-scheduler-plugins because it is needed in both spots
cp -R src/fluence/fluxcli-grpc $(CLONE_UPSTREAM)/pkg/fluence/fluxcli-grpc
Expand Down
32 changes: 32 additions & 0 deletions sig-scheduler-plugins/build/scheduler/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_BASE_IMAGE=golang
ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot
FROM --platform=${BUILDPLATFORM} $GO_BASE_IMAGE AS builder

WORKDIR /workspace
COPY . .
ARG TARGETARCH
RUN make build-scheduler GO_BUILD_ENV='CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}' && \
cp /workspace/bin/kube-scheduler /bin/kube-scheduler

# Disable distroless because we are wanting a filesystem to preserve logs, etc.
FROM alpine:3.20
# FROM --platform=${BUILDPLATFORM} $DISTROLESS_BASE_IMAGE

WORKDIR /bin
COPY --from=builder /workspace/bin/kube-scheduler .
USER 65532:65532

ENTRYPOINT ["/bin/kube-scheduler"]

0 comments on commit 5047dc1

Please sign in to comment.