Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for other arch than amd64 #31

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Image URL to use all building/pushing image targets;
# Use your own docker registry and image name for dev/test by overridding the
# IMAGE_REPO, IMAGE_NAME and IMAGE_TAG environment variable.
IMAGE_REPO ?= docker.io/morvencao
IMAGE_REPO ?= 584416962002.dkr.ecr.us-west-2.amazonaws.com/nginx
IMAGE_NAME ?= sidecar-injector


# Github host to use for checking the source tree;
# Override this variable ue with your own value if you're working on forked repo.
GIT_HOST ?= github.com/morvencao
GIT_HOST ?= github.com/yahavb

PWD := $(shell pwd)
BASE_DIR := $(shell basename $(PWD))
Expand All @@ -20,7 +21,17 @@ DEST := $(GOPATH)/src/$(GIT_HOST)/$(BASE_DIR)
IMAGE_TAG ?= $(shell date +v%Y%m%d)-$(shell git describe --match=$(git rev-parse --short=8 HEAD) --tags --always --dirty)


ARCH := $(shell uname -m)
ifeq ($(ARCH),x86_64)
GOARCH ?= amd64
else ifeq ($(ARCH),aarch64)
GOARCH ?= arm64
else
$(error "This system's arch $(ARCH) isn't recognized/supported")
endif

LOCAL_OS := $(shell uname)

ifeq ($(LOCAL_OS),Linux)
TARGET_OS ?= linux
XARGS_FLAGS="-r"
Expand Down Expand Up @@ -66,12 +77,12 @@ test:
############################################################

build:
@echo "Building the $(IMAGE_NAME) binary..."
@echo "Building the $(IMAGE_NAME) binary for $(GOARCH)..."
@CGO_ENABLED=0 go build -o build/_output/bin/$(IMAGE_NAME) ./cmd/

build-linux:
@echo "Building the $(IMAGE_NAME) binary for Docker (linux)..."
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o build/_output/linux/bin/$(IMAGE_NAME) ./cmd/
@echo "Building the $(IMAGE_NAME) binary for Docker (linux) $(GOARCH)..."
@GOOS=linux GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o build/_output/linux/bin/$(IMAGE_NAME) ./cmd/

############################################################
# image section
Expand Down
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest
FROM arm64v8/alpine:latest

# set labels for metadata
LABEL maintainer="Morven Cao<morvencao@gmail.com>" \
LABEL maintainer="Yahav Biran<birayaha@amazon.com>" \
name="sidecar-injector" \
description="A Kubernetes mutating webhook server that implements sidecar injection" \
summary="A Kubernetes mutating webhook server that implements sidecar injection"
Expand Down
1 change: 0 additions & 1 deletion deploy/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: sidecar-injector-webhook-configmap
namespace: sidecar-injector
data:
sidecarconfig.yaml: |
containers:
Expand Down
1 change: 0 additions & 1 deletion deploy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: sidecar-injector-webhook-deployment
namespace: sidecar-injector
labels:
app: sidecar-injector
spec:
Expand Down
21 changes: 21 additions & 0 deletions deploy/mutatingwebhook-ca-bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
name: sidecar-injector-webhook-cfg
labels:
app: sidecar-injector
webhooks:
- name: sidecar-injector.morven.me
clientConfig:
service:
name: sidecar-injector-webhook-svc
path: "/mutate"
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Fo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iV2lLdmVhZ25Ybm5VNTV1TGdEclNtSk5iTjUKVTZQbGE1WVBZV0VVU2Q1ZXVBL3NPejNMdmZINC9vN203VDN3NG96Q1dGTXhGY0RZcVE1L2F3aWNZeW8xZ1VMZgpUMzNGdk5nbmMyVlE1cHZEdXdMbktNaW5kWU54dm05NDRMMEo4aWNtb1hBekdyVjhUblFFNFRIQXdud0R4NHIrCjg0eXVaMnhjNnFCa3pLMWpyNk9tenhmOVhBQ1JKUHFFMVJGegotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
rules:
- operations: ["CREATE", "UPDATE"]
apiGroups: [""]
apiVersions: ["v1"]
resources: ["pods"]
namespaceSelector:
matchLabels:
sidecar-injection: enabled
1 change: 0 additions & 1 deletion deploy/nginxconfigmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-configmap
namespace: sidecar-injector
data:
nginx.conf: |
worker_processes 1;
Expand Down
1 change: 0 additions & 1 deletion deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Service
metadata:
name: sidecar-injector-webhook-svc
namespace: sidecar-injector
labels:
app: sidecar-injector
spec:
Expand Down