How to setup osm to run on arm64 platform - flomesh-io/osm GitHub Wiki

OSM scripts require changes for it to run on ARM64 platform. This wiki details steps required to setup OSM development environment on ARM64 platform. Below steps assume you are running a ARM64 linux based environment.

Below script make changes to osm files which have either hard-coded AMD64 architecture, images or replace images which doesn't have ARM64 support, we have used the same Github repository for those open source images and have them compiled for ARM64 architecture (or both). If you prefer to have them replaced with your own compiled images, make sure you replace images which are getting retrieved from flomesh account.

Steps Required

  1. Setup OSM_HOME environment variable to point it to osm directory. This should be directory where you have cloned the osm code base.
  2. Run below shell script to perform the changes to required files
  find ${OSM_HOME}/charts -type f | xargs sed -i 's/amd64/arm64/g'
  sed -i 's/repository: envoyproxy\/envoy-alpine/repository: envoyproxy\/envoy/g' ${OSM_HOME}/charts/osm/values.yaml
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/charts/osm/README.md
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/charts/osm/values.yaml
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/charts/osm/values.schema.json
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/cmd/osm-bootstrap/osm-bootstrap_test.go

  find ${OSM_HOME}/dockerfiles -type f | xargs sed -i 's# alpine:3$# arm64v8/alpine:3.12#g'
  find ${OSM_HOME}/dockerfiles -type f | xargs sed -i 's#openservicemesh/proxy-wasm-cpp-sdk:.* AS#flomesh/proxy-wasm-cpp-sdk:v2 AS#g'

  sed -i 's/kind create cluster --name/kind create cluster --image kindest\/node-arm64:v1.20.15 --name/g' ${OSM_HOME}/scripts/kind-with-registry.sh

  find ${OSM_HOME}/demo -type f | xargs sed -i 's/amd64/arm64/g'
  sed -i 's/image: mysql:5.6/image: devilbox\/mysql:mysql-8.0/g' ${OSM_HOME}/demo/deploy-mysql.sh

  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"simonkowallik/httpbin"#"flomesh/httpbin:latest"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"kennethreitz/httpbin"#"flomesh/httpbin:ken"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"songrgg/alpine-debug"#"flomesh/alpine-debug"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"networld/grpcurl"#"flomesh/grpcurl"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"moul/grpcbin"#"flomesh/grpcbin"#g'

One-step shell script

You can use below shell script to pass OSM_HOME and BUILD_ARCH parameters to perform the same changes.

#!/bin/bash

set -euo pipefail

if [ -z "$1" ]; then
  echo "Error: expected one argument OSM_HOME"
  exit 1
fi

if [ -z "$2" ]; then
  echo "Error: expected one argument OS_ARCH"
  exit 1
fi

OSM_HOME=$1
BUILD_ARCH=$2

if [ "${BUILD_ARCH}" == "arm64" ](/flomesh-io/osm/wiki/-"${BUILD_ARCH}"-==-"arm64"-); then
  find ${OSM_HOME}/charts -type f | xargs sed -i 's/amd64/arm64/g'
  sed -i 's/repository: envoyproxy\/envoy-alpine/repository: envoyproxy\/envoy/g' ${OSM_HOME}/charts/osm/values.yaml
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/charts/osm/README.md
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/charts/osm/values.yaml
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/charts/osm/values.schema.json
  sed -i 's/envoy-alpine:v1.19.3@sha256:.*b0f3/envoy:v1.19.3@sha256:9bbd3140c7ba67e32ecdf1731c03f010e2de386ef84d215023327624fc2c37ae/g' ${OSM_HOME}/cmd/osm-bootstrap/osm-bootstrap_test.go

  find ${OSM_HOME}/dockerfiles -type f | xargs sed -i 's# alpine:3$# arm64v8/alpine:3.12#g'
  find ${OSM_HOME}/dockerfiles -type f | xargs sed -i 's#openservicemesh/proxy-wasm-cpp-sdk:.* AS#flomesh/proxy-wasm-cpp-sdk:v2 AS#g'

  sed -i 's/kind create cluster --name/kind create cluster --image kindest\/node-arm64:v1.20.15 --name/g' ${OSM_HOME}/scripts/kind-with-registry.sh

  find ${OSM_HOME}/demo -type f | xargs sed -i 's/amd64/arm64/g'
  sed -i 's/image: mysql:5.6/image: devilbox\/mysql:mysql-8.0/g' ${OSM_HOME}/demo/deploy-mysql.sh

  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"simonkowallik/httpbin"#"flomesh/httpbin:latest"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"kennethreitz/httpbin"#"flomesh/httpbin:ken"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"songrgg/alpine-debug"#"flomesh/alpine-debug"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"networld/grpcurl"#"flomesh/grpcurl"#g'
  find ${OSM_HOME}/tests -type f | xargs sed -i 's#"moul/grpcbin"#"flomesh/grpcbin"#g'
fi