This is an automated email from the ASF dual-hosted git repository. yuchaoran pushed a commit to branch branch-1.3.0 in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
commit acd6fa1f180e0871545472908ab54cfc44ca87a1 Author: Chaoran Yu <[email protected]> AuthorDate: Wed Jul 19 23:30:44 2023 -0700 Added missing files needed for multi-arch build --- Makefile | 19 ++++++++++++ build/Dockerfile | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ build/start-yunikorn.sh | 36 +++++++++++++++++++++++ 3 files changed, 133 insertions(+) diff --git a/Makefile b/Makefile index bfad12c6..0a2dd37a 100644 --- a/Makefile +++ b/Makefile @@ -276,6 +276,22 @@ sched_image: scheduler @mv -f ./deployments/image/configmap/Dockerfile.bkp ./deployments/image/configmap/Dockerfile @rm -f ./deployments/image/configmap/${BINARY} +.PHONY: multi_arch_sched_image +multi_arch_sched_image: + @echo "building the multi-arch docker image for the scheduler" + docker buildx build --no-cache -f ./build/Dockerfile \ + --platform linux/arm64/v8,linux/amd64 \ + -t ${REGISTRY}/di-batch:yunikorn-scheduler-${VERSION} \ + -o type=registry \ + --build-arg MAIN_VERSION=${VERSION} \ + --build-arg MAIN_DATE=${DATE} \ + --label "yunikorn-core-revision=${CORE_SHA}" \ + --label "yunikorn-scheduler-interface-revision=${SI_SHA}" \ + --label "yunikorn-k8shim-revision=${SHIM_SHA}" \ + --label "BuildTimeStamp=${DATE}" \ + --label "Version=${VERSION}" \ + . + # Build a plugin image based on the production ready version .PHONY: plugin_image plugin_image: plugin @@ -353,6 +369,9 @@ simulation_image: simulation @rm -f ./deployments/image/gang/gangclient/${GANG_CLIENT_BINARY} @rm -f ./deployments/image/gang/webserver/${GANG_SERVER_BINARY} +.PHONY: multi_arch_images +multi_arch_images: multi_arch_sched_image + # Build all images based on the production ready version .PHONY: image image: sched_image plugin_image adm_image diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 00000000..eaa03cf4 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,78 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 MAIN_VERSION +ARG MAIN_DATE + +#FROM --platform=$BUILDPLATFORM docker.apple.com/base-images/ubi9/go1.18-builder as builder +FROM docker.apple.com/base-images/ubi9/go1.20-builder as builder + +RUN echo "start build process" +RUN echo "Running on $BUILDPLATFORM, version: $MAIN_VERSION, date: $MAIN_DATE" + +WORKDIR /workspace + +# copy source code +COPY pkg/ pkg/ +COPY build/start-yunikorn.sh /workspace/start-yunikorn.sh +COPY go.mod go.mod +COPY go.sum go.sum +RUN go mod download + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH \ + go build -a -o=/workspace/k8s_yunikorn_scheduler -ldflags \ + '-extldflags "-static" -X main.version=$MAIN_VERSION -X main.date=$MAIN_DATE' \ + -tags netgo -installsuffix netgo \ + /workspace/pkg/cmd/shim/ + +FROM docker.apple.com/base-images/ubi9/ubi + +RUN mkdir -p /opt/yunikorn/work && \ + mkdir -p /opt/yunikorn/bin && \ + groupadd -g 4444 yunikorn && \ + useradd -d /opt/yunikorn/work -g yunikorn -u 4444 yunikorn -s /bin/sh && \ + mkdir -p /opt/yunikorn/bin /opt/yunikorn/work && \ + chown -R yunikorn:yunikorn /opt/yunikorn/work && \ + chmod 755 /opt/yunikorn/work + +COPY --from=builder /workspace/k8s_yunikorn_scheduler /opt/yunikorn/bin/ +ADD build/start-yunikorn.sh /opt/yunikorn/bin/start-yunikorn.sh + +RUN chmod 755 /opt/yunikorn/bin/* + +ENV CLUSTER_ID "mycluster" +ENV CLUSTER_VERSION "latest" +ENV POLICY_GROUP "queues" +ENV SCHEDULING_INTERVAL "1s" +ENV LOG_LEVEL "0" +ENV LOG_ENCODING "console" +ENV VOLUME_BINDING_TIMEOUT "10s" +ENV EVENT_CHANNEL_CAPACITY "1048576" +ENV DISPATCHER_TIMEOUT "300s" +ENV KUBE_CLIENT_QPS "400" +ENV KUBE_CLIENT_BURST "400" +ENV PREDICATES "" +ENV ENABLE_CONFIG_HOT_REFRESH "true" +ENV DISABLE_RESERVATION "true" +ENV OPERATOR_PLUGINS "general,spark-k8s-operator" +ENV DISABLE_GANG_SCHEDULING "false" +ENV USER_LABEL_KEY "yunikorn.apache.org/username" +ENV PLACEHOLDER_IMAGE "k8s.gcr.io/pause" + +WORKDIR /opt/yunikorn/work +USER yunikorn +ENTRYPOINT /opt/yunikorn/bin/start-yunikorn.sh diff --git a/build/start-yunikorn.sh b/build/start-yunikorn.sh new file mode 100644 index 00000000..1f3aa68f --- /dev/null +++ b/build/start-yunikorn.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +cd /opt/yunikorn/work +exec /opt/yunikorn/bin/k8s_yunikorn_scheduler \ + -clusterId="${CLUSTER_ID}" \ + -clusterVersion="${CLUSTER_VERSION}" \ + -policyGroup="${POLICY_GROUP}" \ + -interval="${SCHEDULING_INTERVAL}" \ + -logLevel="${LOG_LEVEL}" \ + -logEncoding="${LOG_ENCODING}" \ + -volumeBindTimeout="${VOLUME_BINDING_TIMEOUT}" \ + -eventChannelCapacity="${EVENT_CHANNEL_CAPACITY}" \ + -dispatchTimeout="${DISPATCHER_TIMEOUT}" \ + -kubeQPS="${KUBE_CLIENT_QPS}" \ + -kubeBurst="${KUBE_CLIENT_BURST}" \ + -operatorPlugins="${OPERATOR_PLUGINS}" \ + -enableConfigHotRefresh="${ENABLE_CONFIG_HOT_REFRESH}" \ + -disableGangScheduling="${DISABLE_GANG_SCHEDULING}" \ + -userLabelKey="${USER_LABEL_KEY}" \ + -placeHolderImage="${PLACEHOLDER_IMAGE}" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
