Skip to content

Commit 84b1031

Browse files
Multiarch (#117)
* added support for multiarch Signed-off-by: raffaelespazzoli <[email protected]> * fixed readme Signed-off-by: raffaelespazzoli <[email protected]> * removed s390x Signed-off-by: raffaelespazzoli <[email protected]>
1 parent a1aff1a commit 84b1031

File tree

7 files changed

+63
-6
lines changed

7 files changed

+63
-6
lines changed

.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

2020
# Use distroless as minimal base image to package the manager binary
2121
# Refer to https://github.com/GoogleContainerTools/distroless for more details

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ It is recommended to deploy this operator via [`OperatorHub`](https://operatorhu
196196

197197
If you want to utilize the Operator Lifecycle Manager (OLM) to install this operator, you can do so in two ways: from the UI or the CLI.
198198

199+
### Multiarch Support
200+
201+
| Arch | Support |
202+
|:-:|:-:|
203+
| amd64 | ✅ |
204+
| arm64 | ✅ |
205+
| ppc64le | ✅ |
206+
| s390x | ❌ |
207+
199208
#### Deploying from OperatorHub UI
200209

201210
* If you would like to launch this operator from the UI, you'll need to navigate to the OperatorHub tab in the console.Before starting, make sure you've created the namespace that you want to install this operator to with the following:
@@ -222,7 +231,8 @@ oc apply -f config/operatorhub -n namespace-configuration-operator
222231
This will create the appropriate OperatorGroup and Subscription and will trigger OLM to launch the operator in the specified namespace.
223232

224233
You can set `ALLOW_SYSTEM_NAMESPACES` environment variable in `Subscription` like this;
225-
```
234+
235+
```yaml
226236
apiVersion: operators.coreos.com/v1alpha1
227237
kind: Subscription
228238
metadata:

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/namespace-configuration-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: namespace-configuration-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)