Skip to content

Commit

Permalink
we will need an arm build for an arm cluster! (#188)
Browse files Browse the repository at this point in the history
* we will need an arm build for an arm cluster!

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Jun 26, 2023
1 parent 93a4a63 commit 24d54d7
Show file tree
Hide file tree
Showing 4 changed files with 1,427 additions and 2 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,39 @@ on:
workflow_dispatch:

jobs:
# Only build arm image on merge, takes too long otherwise
build-arm:
if: (github.event_name != 'pull_request')
runs-on: ubuntu-latest
name: make and build arm
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Add custom buildx ARM builder
run: |
docker buildx create --name armbuilder
docker buildx use armbuilder
docker buildx inspect --bootstrap
- name: Deploy Container
run: make arm-deploy

build:
runs-on: ubuntu-latest
strategy:
matrix:
command: [docker, bundle, catalog]
command: [bundle, catalog, docker]

name: make and build ${{ matrix.command }}
steps:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make test

- name: Check Updated flux-operator-arm.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp examples/dist/flux-operator-arm.yaml /tmp/flux-operator-arm.yaml
make build-config-arm
diff examples/dist/flux-operator-arm.yaml /tmp/flux-operator-arm.yaml
# Ensure build-config is the same as the one we have
- name: Check Updated flux-operator.yaml
env:
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ IMG ?= ghcr.io/flux-framework/flux-operator

# Testing image (for development mostly)
DEVIMG ?= ghcr.io/flux-framework/flux-operator:test
ARMIMG ?= ghcr.io/flux-framework/flux-operator:arm

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.24.1
Expand Down Expand Up @@ -128,7 +129,7 @@ helm: manifests kustomize helmify
$(KUSTOMIZE) build config/default | $(HELMIFY)

.PHONY: pre-push
pre-push: generate api build-config helm
pre-push: generate api build-config-arm build-config helm
git status

.PHONY: fmt
Expand Down Expand Up @@ -240,6 +241,10 @@ run: manifests generate fmt vet ## Run a controller from your host.
docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} .

.PHONY: arm-build
arm-build: test ## Build docker image with the manager.
docker buildx build --platform linux/arm64 -t ${ARMIMG} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}
Expand Down Expand Up @@ -268,6 +273,11 @@ build-config: manifests kustomize ## Deploy controller to the K8s cluster specif
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default > examples/dist/flux-operator.yaml

.PHONY: build-config-arm
build-config-arm: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${ARMIMG}
$(KUSTOMIZE) build config/default > examples/dist/flux-operator-arm.yaml

# Build a test image, push to the registry at test, and apply the build-config
.PHONY: test-deploy
test-deploy: manifests kustomize
Expand All @@ -276,6 +286,12 @@ test-deploy: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=${DEVIMG}
$(KUSTOMIZE) build config/default > examples/dist/flux-operator-dev.yaml

.PHONY: arm-deploy
arm-deploy: manifests kustomize
docker buildx build --platform linux/arm64 --push -t ${ARMIMG} .
cd config/manager && $(KUSTOMIZE) edit set image controller=${ARMIMG}
$(KUSTOMIZE) build config/default > examples/dist/flux-operator-arm.yaml

# Build a local test image, load into minikube or kind and apply the build-config
.PHONY: deploy-local
deploy-local: manifests kustomize build
Expand Down

0 comments on commit 24d54d7

Please sign in to comment.