Skip to content

Commit 2119408

Browse files
authored
Merge pull request #6 from cert-manager/tag-v0.1.0
Adds multi-arch image support to trust
2 parents de240ce + 37cbcdc commit 2119408

File tree

5 files changed

+132
-23
lines changed

5 files changed

+132
-23
lines changed

Dockerfile

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,31 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM gcr.io/distroless/static@sha256:aadea1b1f16af043a34491eec481d0132479382096ea34f608087b4bef3634be
16-
LABEL description="cert-manager operator for distributing trust bundles across a Kubernetes cluster"
15+
# Build the trust binary
16+
FROM docker.io/library/golang:1.17 as builder
1717

18-
USER 1001
18+
WORKDIR /workspace
19+
# Copy the Go Modules manifests
20+
COPY go.mod go.mod
21+
COPY go.sum go.sum
22+
23+
# Copy the go source files
24+
COPY Makefile Makefile
25+
COPY cmd/ cmd/
26+
COPY pkg/ pkg/
27+
28+
RUN go mod download
1929

20-
COPY ./bin/cert-manager-trust-linux /usr/bin/cert-manager-trust
30+
# Build
31+
RUN make build
32+
33+
# Use distroless as minimal base image to package the manager binary
34+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
35+
FROM gcr.io/distroless/static@sha256:bca3c203cdb36f5914ab8568e4c25165643ea9b711b41a8a58b42c80a51ed609
36+
LABEL description="cert-manager trust is an operator for distributing trust bundles across a Kubernetes cluster"
37+
38+
WORKDIR /
39+
USER 1001
40+
COPY --from=builder /workspace/bin/cert-manager-trust /usr/bin/cert-manager-trust
2141

2242
ENTRYPOINT ["/usr/bin/cert-manager-trust"]

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ OS ?= $(shell go env GOOS)
1818

1919
HELM_VERSION ?= 3.6.3
2020
KUBEBUILDER_TOOLS_VERISON ?= 1.21.2
21+
IMAGE_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le
2122

2223
help: ## display this help
2324
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
@@ -45,10 +46,12 @@ generate: depend ## generate code
4546
.PHONY: verify
4647
verify: depend test build ## tests and builds trust
4748

49+
# image will only build and store the image locally, targeted in OCI format.
50+
# To actually push an image to the public repo, replace the `--output` flag and
51+
# arguments to `--push`.
4852
.PHONY: image
49-
image: ## build docker image
50-
GOARCH=$(ARCH) GOOS=linux CGO_ENABLED=0 go build -o ./bin/cert-manager-trust-linux ./cmd/.
51-
docker build -t quay.io/jetstack/cert-manager-trust:v0.0.1 .
53+
image: ## build docker image targeting all supported platforms
54+
docker buildx build --platform=$(IMAGE_PLATFORMS) -t quay.io/jetstack/cert-manager-trust:v0.1.0 --output type=local,dest=./bin/cert-manager-trust .
5255

5356
.PHONY: clean
5457
clean: ## clean up created files

go.mod

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cert-manager/trust
22

3-
go 1.16
3+
go 1.17
44

55
require (
66
github.com/go-logr/logr v0.4.0
@@ -20,3 +20,94 @@ require (
2020
sigs.k8s.io/controller-tools v0.6.1
2121
sigs.k8s.io/kind v0.11.1
2222
)
23+
24+
require (
25+
cloud.google.com/go v0.54.0 // indirect
26+
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
27+
github.com/Azure/go-autorest/autorest v0.11.12 // indirect
28+
github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect
29+
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
30+
github.com/Azure/go-autorest/logger v0.2.0 // indirect
31+
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
32+
github.com/BurntSushi/toml v0.3.1 // indirect
33+
github.com/PuerkitoBio/purell v1.1.1 // indirect
34+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
35+
github.com/alessio/shellescape v1.4.1 // indirect
36+
github.com/beorn7/perks v1.0.1 // indirect
37+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
38+
github.com/davecgh/go-spew v1.1.1 // indirect
39+
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
40+
github.com/evanphx/json-patch/v5 v5.2.0 // indirect
41+
github.com/fatih/color v1.12.0 // indirect
42+
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
43+
github.com/fsnotify/fsnotify v1.4.9 // indirect
44+
github.com/go-errors/errors v1.0.1 // indirect
45+
github.com/go-logr/zapr v0.4.0 // indirect
46+
github.com/go-openapi/jsonpointer v0.19.3 // indirect
47+
github.com/go-openapi/jsonreference v0.19.3 // indirect
48+
github.com/go-openapi/spec v0.19.5 // indirect
49+
github.com/go-openapi/swag v0.19.5 // indirect
50+
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
51+
github.com/gobuffalo/flect v0.2.3 // indirect
52+
github.com/gogo/protobuf v1.3.2 // indirect
53+
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
54+
github.com/golang/protobuf v1.5.2 // indirect
55+
github.com/google/btree v1.0.0 // indirect
56+
github.com/google/go-cmp v0.5.6 // indirect
57+
github.com/google/gofuzz v1.1.0 // indirect
58+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
59+
github.com/google/uuid v1.1.2 // indirect
60+
github.com/googleapis/gnostic v0.5.5 // indirect
61+
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
62+
github.com/hashicorp/golang-lru v0.5.4 // indirect
63+
github.com/imdario/mergo v0.3.12 // indirect
64+
github.com/inconshreveable/mousetrap v1.0.0 // indirect
65+
github.com/json-iterator/go v1.1.11 // indirect
66+
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
67+
github.com/mailru/easyjson v0.7.0 // indirect
68+
github.com/mattn/go-colorable v0.1.8 // indirect
69+
github.com/mattn/go-isatty v0.0.12 // indirect
70+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
71+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
72+
github.com/modern-go/reflect2 v1.0.1 // indirect
73+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
74+
github.com/nxadm/tail v1.4.8 // indirect
75+
github.com/pelletier/go-toml v1.8.1 // indirect
76+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
77+
github.com/pkg/errors v0.9.1 // indirect
78+
github.com/pmezard/go-difflib v1.0.0 // indirect
79+
github.com/prometheus/client_golang v1.11.0 // indirect
80+
github.com/prometheus/client_model v0.2.0 // indirect
81+
github.com/prometheus/common v0.26.0 // indirect
82+
github.com/prometheus/procfs v0.6.0 // indirect
83+
github.com/stretchr/testify v1.7.0 // indirect
84+
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
85+
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
86+
go.uber.org/atomic v1.7.0 // indirect
87+
go.uber.org/multierr v1.6.0 // indirect
88+
go.uber.org/zap v1.17.0 // indirect
89+
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
90+
golang.org/x/mod v0.4.2 // indirect
91+
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
92+
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
93+
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
94+
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
95+
golang.org/x/text v0.3.6 // indirect
96+
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 // indirect
97+
golang.org/x/tools v0.1.3 // indirect
98+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
99+
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
100+
google.golang.org/appengine v1.6.7 // indirect
101+
google.golang.org/protobuf v1.26.0 // indirect
102+
gopkg.in/inf.v0 v0.9.1 // indirect
103+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
104+
gopkg.in/yaml.v2 v2.4.0 // indirect
105+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
106+
k8s.io/apiextensions-apiserver v0.21.2 // indirect
107+
k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027 // indirect
108+
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
109+
sigs.k8s.io/kustomize/api v0.8.8 // indirect
110+
sigs.k8s.io/kustomize/kyaml v0.10.17 // indirect
111+
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
112+
sigs.k8s.io/yaml v1.2.0 // indirect
113+
)

hack/boilerplate/boilerplate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright 2015 The Kubernetes Authors.
44
#

hack/ci/create-cluster.sh

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,19 @@ TRUST_TAG="${TRUST_TAG:-smoke}"
99
TRUST_IMAGE="${TRUST_IMAGE:-quay.io/jetstack/cert-manager-trust:$TRUST_TAG}"
1010

1111
echo ">> building docker image..."
12-
GOARCH=$(go env GOARCH) GOOS=linux CGO_ENABLED=0 go build -o $REPO_ROOT/bin/cert-manager-trust-linux $REPO_ROOT/cmd/.
1312
docker build -t $TRUST_IMAGE .
1413

14+
15+
echo ">> pre-creating 'kind' docker network to avoid networking issues in CI"
16+
# When running in our CI environment the Docker network's subnet choice will cause issues with routing
17+
# This works around this till we have a way to properly patch this.
18+
docker network create --driver=bridge --subnet=192.168.0.0/16 --gateway 192.168.0.1 kind || true
19+
# Sleep for 2s to avoid any races between docker's network subcommand and 'kind create'
20+
sleep 2
21+
1522
echo ">> creating kind cluster..."
1623
$KIND_BIN delete cluster --name trust
17-
cat <<EOF | $KIND_BIN create cluster --name trust --config=-
18-
apiVersion: kind.x-k8s.io/v1alpha4
19-
kind: Cluster
20-
kubeadmConfigPatches:
21-
- |
22-
# config generated by kind
23-
apiVersion: kubeadm.k8s.io/v1beta2
24-
kind: ClusterConfiguration
25-
metadata:
26-
name: config
27-
networking:
28-
serviceSubnet: 10.0.0.0/16
29-
EOF
24+
$KIND_BIN create cluster --name trust
3025

3126
echo ">> loading docker image..."
3227
$KIND_BIN load docker-image $TRUST_IMAGE --name trust

0 commit comments

Comments
 (0)