Skip to content

Commit

Permalink
Added s390x and ppc64le support
Browse files Browse the repository at this point in the history
Signed-off-by: Rehan Khan <[email protected]>
  • Loading branch information
Rehan Khan authored and Rehan Khan committed Apr 30, 2024
1 parent 33db128 commit 3dc8b11
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
12 changes: 8 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ RUN python3 -m pip install -r requirements.txt --no-cache-dir

# Downloading Argo CLI so that the samples are validated
ENV ARGO_VERSION v3.4.16
RUN curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz && \
gunzip argo-linux-amd64.gz && \
chmod +x argo-linux-amd64 && \
mv ./argo-linux-amd64 /usr/local/bin/argo
RUN ARCH=$(uname -m); \
if [ "$ARCH" = "x86_64" ]; then \
ARCH="amd64"; \
fi \
&& curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-${ARCH}.gz && \
gunzip argo-linux-${ARCH}.gz && \
chmod +x argo-linux-${ARCH} && \
mv ./argo-linux-${ARCH} /usr/local/bin/argo

WORKDIR /
COPY ./samples /samples
Expand Down
13 changes: 7 additions & 6 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
BUILD=build
MOD_ROOT=..
CSV_PATH=backend/third_party_licenses
DOCKER_PLATFORMS=linux/amd64,linux/s390x,linux/ppc64le

# Whenever build command for any of the binaries change, we should update them both here and in backend/Dockerfiles.

Expand Down Expand Up @@ -55,19 +56,19 @@ image_all: image_apiserver image_persistence_agent image_cache image_swf image_v

.PHONY: image_apiserver
image_apiserver:
cd $(MOD_ROOT) && docker build -t apiserver -f backend/Dockerfile .
cd $(MOD_ROOT) && docker buildx build --platform $(DOCKER_PLATFORMS)-t apiserver -f backend/Dockerfile .
.PHONY: image_persistence_agent
image_persistence_agent:
cd $(MOD_ROOT) && docker build -t persistence-agent -f backend/Dockerfile.persistenceagent .
cd $(MOD_ROOT) && docker buildx build --platform $(DOCKER_PLATFORMS) -t persistence-agent -f backend/Dockerfile.persistenceagent .
.PHONY: image_cache
image_cache:
cd $(MOD_ROOT) && docker build -t cache-server -f backend/Dockerfile.cacheserver .
cd $(MOD_ROOT) && docker buildx build --platform $(DOCKER_PLATFORMS) -t cache-server -f backend/Dockerfile.cacheserver .
.PHONY: image_swf
image_swf:
cd $(MOD_ROOT) && docker build -t scheduledworkflow -f backend/Dockerfile.scheduledworkflow .
cd $(MOD_ROOT) && docker buildx build --platform $(DOCKER_PLATFORMS) -t scheduledworkflow -f backend/Dockerfile.scheduledworkflow .
.PHONY: image_viewer
image_viewer:
cd $(MOD_ROOT) && docker build -t viewercontroller -f backend/Dockerfile.viewercontroller .
cd $(MOD_ROOT) && docker buildx build --platform $(DOCKER_PLATFORMS) -t viewercontroller -f backend/Dockerfile.viewercontroller .
.PHONY: image_visualization
image_visualization:
cd $(MOD_ROOT) && docker build -t visualization -f backend/Dockerfile.visualization .
cd $(MOD_ROOT) && docker buildx build --platform $(DOCKER_PLATFORMS) -t visualization -f backend/Dockerfile.visualization .
28 changes: 25 additions & 3 deletions backend/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ ENV GOBIN=/go/bin

# Install protoc.
RUN apt-get update -y && apt-get install -y jq sed unzip
RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
RUN ARCH=$(uname -m); \
if [ $ARCH = "s390x" ]; then \
ARCH="s390_64"; \
elif [ "$ARCH" = "ppc64le" ]; then \
ARCH="ppcle_64"; fi \
&& curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
RUN unzip -o protoc.zip -d /usr/ bin/protoc
RUN unzip -o protoc.zip -d /usr/ 'include/*'
RUN rm -f protoc.zip
Expand All @@ -41,8 +46,25 @@ RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@la
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest

# Download go-swagger binary.
RUN curl -LO "https://github.com/go-swagger/go-swagger/releases/download/${GO_SWAGGER_VERSION}/swagger_linux_amd64"
RUN chmod +x swagger_linux_amd64 && mv swagger_linux_amd64 /usr/bin/swagger
# Go Swageer Binaries are not available for s390x and ppc64le,hence has to be built from source
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
ARCH="amd64" && \
curl -LO "https://github.com/go-swagger/go-swagger/releases/download/${GO_SWAGGER_VERSION}/swagger_linux_${ARCH}" && \
chmod +x swagger_linux_${ARCH} && \
mv swagger_linux_${ARCH} /usr/bin/swagger; \
else \
dir=$(mktemp -d) && \
git clone https://github.com/go-swagger/go-swagger "$dir" && \
cd "$dir" && \
git checkout v${GO_SWAGGER_VERSION} && \
LDFLAGS="-s -w -X github.com/$GITHUB_REPOSITORY/cmd/swagger/commands.Commit=${GITHUB_SHA}"; \
LDFLAGS="$LDFLAGS -X github.com/$GITHUB_REPOSITORY/cmd/swagger/commands.Version=${GITHUB_REF_NAME-dev}"; \
out="swagger_linux_$ARCH"; \
GOOS=linux GOARCH=$ARCH CGO_ENABLED=0 go build -ldflags "$LDFLAGS" -o "./dist/bin/$out" ./cmd/swagger; \
cd / && \
rm -rf "$dir"; \
fi

# Need protobuf source code for -I in protoc command.
RUN mkdir golang && cd golang && git clone --depth 1 --branch $GOLANG_PROTOBUF_VERSION https://github.com/golang/protobuf.git
Expand Down
10 changes: 8 additions & 2 deletions backend/src/cache/deployer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
FROM gcr.io/google.com/cloudsdktool/google-cloud-cli:alpine
FROM alpine

RUN apk add --update \
curl \
jq \
openssl

RUN gcloud components install kubectl
RUN ARCH=$(uname -m); \
if [ "$ARCH" = "x86_64" ]; then \
ARCH="amd64"; \
fi \
&& curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${ARCH}/kubectl \
&& chmod +x ./kubectl \
&& mv ./kubectl /usr/local/bin/kubectl

ADD backend/src/cache/deployer/* /kfp/cache/deployer/
RUN chmod -R 777 /kfp/cache/deployer
Expand Down
6 changes: 4 additions & 2 deletions backend/src/cache/deployer/deploy-cache-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ echo "Start deploying cache service to existing cluster:"
NAMESPACE=${NAMESPACE_TO_WATCH:-kubeflow}
MUTATING_WEBHOOK_CONFIGURATION_NAME="cache-webhook-${NAMESPACE}"
WEBHOOK_SECRET_NAME=webhook-server-tls

ARCH=$(uname -m)
# Getting correct kubectl. Kubernetes only supports kubectl versions within +/-1 minor version.
# kubectl has some resource version information hardcoded, so using too old kubectl can lead to errors
mkdir -p "$HOME/bin"
export PATH="$HOME/bin:$PATH"
{
server_version_major_minor=$(kubectl version --output json | jq --raw-output '(.serverVersion.major + "." + .serverVersion.minor)' | tr -d '"+')
stable_build_version=$(curl -s "https://storage.googleapis.com/kubernetes-release/release/stable-${server_version_major_minor}.txt")
kubectl_url="https://storage.googleapis.com/kubernetes-release/release/${stable_build_version}/bin/linux/amd64/kubectl"
if [ "$ARCH" = "x86_64" ]; then \
ARCH="amd64"; fi
kubectl_url="https://storage.googleapis.com/kubernetes-release/release/${stable_build_version}/bin/linux/${ARCH}/kubectl"
curl -L -o "$HOME/bin/kubectl" "$kubectl_url"
chmod +x "$HOME/bin/kubectl"
} || true
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.21.3 as build
FROM node:14.21.3-bullseye as build

ARG COMMIT_HASH
ENV COMMIT_HASH=${COMMIT_HASH}
Expand Down

0 comments on commit 3dc8b11

Please sign in to comment.