Skip to content

Commit daac765

Browse files
authored
M1 mac compatibility (#5511)
* Apply x86 protoc for m1 mac * Enable the Dockerfile suffix for m1 Mac * Enable the Dockerfile suffix for ow-utils * Choose zookeeper image according to the os architecture * Use the bitnami/etcd image that supports arm * Replace docker info API to cli command
1 parent 6b1c048 commit daac765

File tree

10 files changed

+150
-23
lines changed

10 files changed

+150
-23
lines changed

ansible/group_vars/all

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ kafka_connect_string: "{% set ret = [] %}\
186186
kafka_protocol_for_setup: "{{ kafka_protocol | default('PLAINTEXT') }}"
187187

188188
zookeeper:
189-
version: 3.4
189+
image:
190+
amd64: zookeeper:3.4
191+
arm64: arm64v8/zookeeper:3.4
190192
port: 2181
191193

192194
zookeeper_connect_string: "{% set ret = [] %}\
@@ -464,7 +466,7 @@ zeroDowntimeDeployment:
464466
enabled: "{{ zerodowntime_deployment_switch | default(false) }}"
465467

466468
etcd:
467-
version: "{{ etcd_version | default('v3.4.33') }}"
469+
version: "{{ etcd_version | default('3.5') }}"
468470
client:
469471
port: 2379
470472
server:

ansible/roles/etcd/tasks/deploy.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,13 @@
3838
- name: (re)start etcd
3939
docker_container:
4040
name: etcd{{ groups['etcd'].index(inventory_hostname) }}
41-
image: quay.io/coreos/etcd:{{ etcd.version }}
41+
image: bitnami/etcd:{{ etcd.version }}
4242
state: started
4343
recreate: true
4444
restart_policy: "{{ docker.restart.policy }}"
4545
volumes: "{{volume_dir | default([])}}"
46-
command: "/usr/local/bin/etcd \
47-
--data-dir=/etcd-data --name '{{ name }}' \
48-
--initial-advertise-peer-urls http://{{ ansible_host }}:{{ etcd.server.port + groups['etcd'].index(inventory_hostname) }} \
49-
--advertise-client-urls http://{{ ansible_host }}:{{ etcd.client.port + groups['etcd'].index(inventory_hostname) }} \
50-
--listen-peer-urls http://0.0.0.0:{{ etcd.server.port + groups['etcd'].index(inventory_hostname) }} \
51-
--listen-client-urls http://0.0.0.0:{{ etcd.client.port + groups['etcd'].index(inventory_hostname) }} \
52-
--initial-cluster {{ cluster }} \
53-
--initial-cluster-state new --initial-cluster-token {{ etcd.cluster.token }} \
54-
--quota-backend-bytes {{ etcd.quota_backend_bytes }} \
55-
--snapshot-count {{ etcd.snapshot_count }} \
56-
--auto-compaction-retention {{ etcd.auto_compaction_retention }} \
57-
--auto-compaction-mode {{ etcd.auto_compaction_mode }} \
58-
--log-level {{ etcd.loglevel }}"
46+
env:
47+
"ALLOW_NONE_AUTHENTICATION": "yes"
5948
ports:
6049
- "{{ etcd.client.port + groups['etcd'].index(inventory_hostname) }}:{{ etcd.client.port + groups['etcd'].index(inventory_hostname) }}"
6150
- "{{ etcd.server.port + groups['etcd'].index(inventory_hostname) }}:{{ etcd.server.port + groups['etcd'].index(inventory_hostname) }}"

ansible/roles/invoker/tasks/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
when: environmentInformation.type == "docker-machine"
8181

8282
- name: "determine docker root dir"
83-
shell: echo -e "GET http:/v1.24/info HTTP/1.0\r\n" | nc -U /var/run/docker.sock | grep "{"
83+
shell: docker info -f json
8484
args:
8585
executable: /bin/bash
8686
register: dockerInfo_output

ansible/roles/zookeeper/tasks/deploy.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@
1717
---
1818
# This role will install Kafka with Zookeeper in group 'kafka' in the environment inventory
1919

20+
- name: set zookeeper image
21+
set_fact:
22+
zookeeper_image: "{{ zookeeper.image.arm64 }}"
23+
when: ansible_facts['os_family'] == "Darwin" and ansible_facts['architecture'] == "arm64"
24+
25+
- name: set zookeeper image
26+
set_fact:
27+
zookeeper_image: "{{ zookeeper.image.amd64 }}"
28+
when: ansible_facts['os_family'] != "Darwin" or ansible_facts['architecture'] != "arm64"
29+
2030
- name: (re)start zookeeper
2131
docker_container:
2232
name: zookeeper{{ groups['zookeepers'].index(inventory_hostname) }}
23-
image: zookeeper:{{ zookeeper.version }}
33+
image: "{{ zookeeper_image }}"
2434
state: started
2535
recreate: true
2636
restart_policy: "{{ docker.restart.policy }}"

common/scala/Dockerfile.arm

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# if you change version of openjsk, also update tools/github/setup.sh to download the corresponding jdk
18+
FROM arm64v8/eclipse-temurin:21.0.4_7-jdk-alpine
19+
20+
ENV LANG en_US.UTF-8
21+
ENV LANGUAGE en_US:en
22+
ENV LC_ALL en_US.UTF-8
23+
24+
# Switch to the HTTPS endpoint for the apk repositories as per https://github.com/gliderlabs/docker-alpine/issues/184
25+
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
26+
RUN apk add --update sed curl bash && apk update && apk upgrade
27+
28+
RUN mkdir /logs
29+
30+
COPY transformEnvironment.sh /
31+
RUN chmod +x transformEnvironment.sh
32+
33+
COPY copyJMXFiles.sh /
34+
RUN chmod +x copyJMXFiles.sh

common/scala/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ plugins {
2424
}
2525

2626
ext.dockerImageName = 'scala'
27+
if(System.getProperty("os.arch").toLowerCase(Locale.ENGLISH).startsWith("aarch")) {
28+
ext.dockerDockerfileSuffix = ".arm"
29+
}
2730
apply from: '../../gradle/docker.gradle'
2831

2932
project.archivesBaseName = "openwhisk-common"

core/scheduler/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ buildscript {
5252
}
5353
}
5454

55+
protobuf {
56+
protoc {
57+
if (osdetector.os == "osx") {
58+
artifact = 'com.google.protobuf:protoc:3.4.0:osx-x86_64'
59+
} else {
60+
artifact = 'com.google.protobuf:protoc:3.4.0'
61+
}
62+
}
63+
}
64+
5565
// Define a separate configuration for managing the dependency on Jetty ALPN agent.
5666
configurations {
5767
alpnagent

gradle/docker.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ext {
4646
dockerRetries = project.hasProperty('dockerRetries') ? dockerRetries.toInteger() : 3
4747
dockerBinary = project.hasProperty('dockerBinary') ? [dockerBinary] : ['docker']
4848
dockerBuildArg = ['build']
49-
dockerDockerfileSuffix = ""
49+
dockerDockerfileSuffix = project.hasProperty('dockerDockerfileSuffix') ? dockerDockerfileSuffix : ""
5050
}
5151
ext.dockerTaggedImageName = dockerRegistry + dockerImagePrefix + '/' + dockerImageName + ':' + dockerImageTag
5252

@@ -60,10 +60,6 @@ if(project.hasProperty('dockerBuildArgs')) {
6060
}
6161
}
6262

63-
if(project.hasProperty('dockerfileSuffix')) {
64-
dockerDockerfileSuffix = project.dockerfileSuffix
65-
}
66-
6763
task distDocker {
6864
doLast {
6965
def start = new Date()

tools/ow-utils/Dockerfile.arm

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
FROM arm64v8/eclipse-temurin:8u422-b05-jdk-noble
19+
20+
ENV DOCKER_VERSION 1.12.0
21+
ENV KUBECTL_VERSION v1.16.3
22+
ENV WHISK_CLI_VERSION latest
23+
ENV WHISKDEPLOY_CLI_VERSION latest
24+
25+
RUN apt-get update && apt-get install -y \
26+
git \
27+
jq \
28+
libffi-dev \
29+
nodejs \
30+
npm \
31+
python-is-python3 \
32+
python3-pip \
33+
python3-venv \
34+
wget \
35+
zip \
36+
locales \
37+
&& rm -rf /var/lib/apt/lists/*
38+
39+
# update npm
40+
RUN npm install -g n && n stable && hash -r
41+
42+
RUN locale-gen en_US.UTF-8
43+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
44+
45+
WORKDIR /root
46+
47+
RUN python -m venv .venv
48+
ENV PATH="/root/.venv/bin:$PATH"
49+
50+
# Python packages
51+
RUN pip3 install --upgrade pip
52+
RUN pip3 install --upgrade setuptools
53+
RUN pip3 install cryptography && \
54+
pip3 install ansible==2.5.2 && \
55+
pip3 install jinja2==2.9.6 && \
56+
pip3 install docker
57+
58+
# Install docker client
59+
RUN wget --no-verbose https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz && \
60+
tar --strip-components 1 -xvzf docker-${DOCKER_VERSION}.tgz -C /usr/bin docker/docker && \
61+
rm -f docker-${DOCKER_VERSION}.tgz && \
62+
chmod +x /usr/bin/docker
63+
64+
# Install kubectl in /usr/local/bin
65+
RUN curl -Lo ./kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/kubectl
66+
67+
# Install `wsk` cli in /usr/local/bin
68+
RUN wget -q https://github.com/apache/openwhisk-cli/releases/download/$WHISK_CLI_VERSION/OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz && \
69+
tar xzf OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz -C /usr/local/bin wsk && \
70+
rm OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz
71+
72+
# Install wskadmin in /bin
73+
COPY wskutil.py /bin
74+
COPY wskprop.py /bin
75+
COPY wskadmin /bin
76+
77+
# Setup tools/data for certificate generation (used by openwhisk-deploy-kube)
78+
RUN mkdir /cert-gen
79+
COPY openwhisk-server-key.pem /cert-gen
80+
COPY genssl.sh /usr/local/bin/

tools/ow-utils/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
*/
1717

1818
ext.dockerImageName = 'ow-utils'
19+
if(System.getProperty("os.arch").toLowerCase(Locale.ENGLISH).startsWith("aarch64")) {
20+
ext.dockerDockerfileSuffix = ".arm"
21+
}
1922
apply from: '../../gradle/docker.gradle'
2023

2124
distDocker.dependsOn 'copyWskadmin', 'copyGenssl'

0 commit comments

Comments
 (0)