Skip to content

Commit c2b480b

Browse files
added support for multiarch (#76)
Signed-off-by: raffaelespazzoli <raffaele.spazzoli@gmail.com>
1 parent 7d62eef commit c2b480b

7 files changed

Lines changed: 61 additions & 5 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
- name: Check out code into the Go module directory
2323
uses: actions/checkout@v2
2424

25+
# - uses: shivanshs9/setup-k8s-operator-sdk@v1
26+
# with:
27+
# version: "1.9.0" # The operator-sdk version to download (if necessary) and use.
28+
2529
- name: Download operator sdk
2630
shell: bash
2731
env:
@@ -48,3 +52,29 @@ jobs:
4852
- name: build chart
4953
shell: bash
5054
run: make helmchart VERSION=0.0.1 IMG=quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY):0.0.1
55+
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v1
58+
with:
59+
platforms: all
60+
61+
- name: Set up Docker Buildx
62+
uses: docker/setup-buildx-action@v1
63+
64+
- name: "Build Operator Image"
65+
uses: docker/build-push-action@v2
66+
with:
67+
context: .
68+
file: ./Dockerfile
69+
platforms: linux/amd64,linux/arm64,linux/ppc64le
70+
push: false
71+
tags: "quay.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}:v0.0.1"
72+
73+
- name: "Build Bundle Image"
74+
uses: docker/build-push-action@v2
75+
with:
76+
context: .
77+
file: ./bundle.Dockerfile
78+
platforms: linux/amd64,linux/arm64,linux/ppc64le
79+
push: false
80+
tags: "quay.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}-bundle:0.0.1"

.github/workflows/push.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
- name: Check out code into the Go module directory
2727
uses: actions/checkout@v2
2828

29+
# - uses: shivanshs9/setup-k8s-operator-sdk@v1
30+
# with:
31+
# version: "1.9.0" # The operator-sdk version to download (if necessary) and use.
32+
2933
- name: Download operator sdk
3034
shell: bash
3135
env:
@@ -46,7 +50,7 @@ jobs:
4650
echo "BUNDLE_IMAGE_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
4751
export TAG=${GITHUB_REF/refs\/tags\//}
4852
echo "BUNDLE_VERSION=${TAG:1}" >> $GITHUB_ENV
49-
export SEMVER_COMPLIANT=$(echo ${TAG:1} | egrep '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-])(?:\.(?:0|[1-9]\d|\d*[a-zA-Z-][0-9a-zA-Z-]))))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')
53+
export SEMVER_COMPLIANT=$(echo ${TAG:1} | egrep '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')
5054
if [ -z "$SEMVER_COMPLIANT" ]; then echo "invalid semver tag ${GITHUB_REF/refs\/tags\//}"; exit 1; fi
5155
5256
- name: Get the version for merge
@@ -77,6 +81,8 @@ jobs:
7781

7882
- name: Set up QEMU
7983
uses: docker/setup-qemu-action@v1
84+
with:
85+
platforms: all
8086

8187
- name: Set up Docker Buildx
8288
uses: docker/setup-buildx-action@v1
@@ -93,6 +99,7 @@ jobs:
9399
with:
94100
context: .
95101
file: ./Dockerfile
102+
platforms: linux/amd64,linux/arm64,linux/ppc64le
96103
push: true
97104
tags: "quay.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}:${{ env.OPERATOR_IMAGE_TAG }}"
98105

@@ -101,6 +108,7 @@ jobs:
101108
with:
102109
context: .
103110
file: ./bundle.Dockerfile
111+
platforms: linux/amd64,linux/arm64,linux/ppc64le
104112
push: true
105113
tags: "quay.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}-bundle:${{ env.BUNDLE_IMAGE_TAG }}"
106114

@@ -216,6 +224,10 @@ jobs:
216224
with:
217225
go-version: ^1.16
218226

227+
# - uses: shivanshs9/setup-k8s-operator-sdk@v1
228+
# with:
229+
# version: "1.9.0" # The operator-sdk version to download (if necessary) and use.
230+
219231
- name: Download operator sdk
220232
shell: bash
221233
env:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COPY api/ api/
1515
COPY controllers/ controllers/
1616

1717
# Build
18-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
18+
RUN CGO_ENABLED=0 GOOS=linux go build -a -o manager main.go
1919
RUN go get -u github.com/gen2brain/keepalived_exporter@0.5.0 && \
2020
cp ${GOPATH}/bin/keepalived_exporter ./
2121
RUN go get -u github.com/rjeczalik/cmd/notify@1.0.3 && \

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ This is a cluster-level operator that you can deploy in any namespace, `keepaliv
190190

191191
It is recommended to deploy this operator via [`OperatorHub`](https://operatorhub.io/), but you can also deploy it using [`Helm`](https://helm.sh/).
192192

193+
### Multiarch Support
194+
195+
| Arch | Support |
196+
|:-:|:-:|
197+
| amd64 | ✅ |
198+
| arm64 | ✅ |
199+
| ppc64le | ✅ |
200+
| s390x | ❌ |
201+
193202
### Deploying from OperatorHub
194203

195204
> **Note**: This operator supports being installed disconnected environments

config/default/manager_auth_proxy_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
spec:
1111
containers:
1212
- name: kube-rbac-proxy
13-
image: quay.io/coreos/kube-rbac-proxy:v0.5.0
13+
image: registry.redhat.io/openshift4/ose-kube-rbac-proxy@sha256:6d57bfd91fac9b68eb72d27226bc297472ceb136c996628b845ecc54a48b31cb
1414
args:
1515
- "--secure-listen-address=0.0.0.0:8443"
1616
- "--upstream=http://127.0.0.1:8080/"

config/helmchart/values.yaml.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ affinity: {}
2929

3030
kube_rbac_proxy:
3131
image:
32-
repository: quay.io/coreos/kube-rbac-proxy
32+
repository: gcr.io/kubebuilder/kube-rbac-proxy
3333
pullPolicy: IfNotPresent
34-
tag: v0.5.0
34+
tag: v0.8.0
3535
resources:
3636
requests:
3737
cpu: 100m

config/manifests/bases/keepalived-operator.clusterserviceversion.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ metadata:
1616
operators.openshift.io/infrastructure-features: '["Disconnected"]'
1717
name: keepalived-operator.v0.0.0
1818
namespace: placeholder
19+
labels:
20+
operatorframework.io/os.linux: supported
21+
operatorframework.io/arch.amd64: supported
22+
operatorframework.io/arch.arm64: supported
23+
operatorframework.io/arch.ppc64le: supported
1924
spec:
2025
apiservicedefinitions: {}
2126
customresourcedefinitions: {}

0 commit comments

Comments
 (0)