-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from jetstack/raw-v1
Update the CAS Issuer for the GA release of Google Certificate Authority Service
- Loading branch information
Showing
40 changed files
with
1,833 additions
and
723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ name: docker | |
|
||
on: | ||
push: | ||
branches: main | ||
branches: | ||
- main | ||
|
||
jobs: | ||
multiarch-build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,10 +54,7 @@ jobs: | |
run: /bin/bash -c 'echo ::set-output name=VERSION::$(echo ${GITHUB_REF##*/} | cut -c2-)' | ||
- | ||
name: install controller-gen | ||
working-directory: / | ||
env: | ||
GO111MODULE: on | ||
run: go get sigs.k8s.io/controller-tools/cmd/[email protected] | ||
run: go install sigs.k8s.io/controller-tools/cmd/[email protected] | ||
- | ||
name: install kustomize | ||
working-directory: / | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
name: tests | ||
on: [pull_request, push] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
run_tests: | ||
runs-on: ubuntu-latest | ||
container: golang:1.16 | ||
steps: | ||
- name: install kubebuilder | ||
- | ||
name: install kubebuilder | ||
run: | | ||
os=$(go env GOOS) | ||
arch=$(go env GOARCH) | ||
curl -L https://go.kubebuilder.io/dl/2.3.1/${os}/${arch} | tar -xz -C /tmp/ | ||
mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder | ||
sudo mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder | ||
export PATH=$PATH:/usr/local/kubebuilder/bin | ||
- | ||
name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16' | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Run tests | ||
run: make test | ||
name: Run unit tests | ||
run: make test | ||
- | ||
name: Run e2e tests | ||
run: make e2e | ||
env: | ||
AGE_SECRET_KEY: ${{ secrets.AGE_SECRET_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ bin | |
*.swp | ||
*.swo | ||
*~ | ||
|
||
kubeconfig.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,29 @@ else | |
GOBIN=$(shell go env GOBIN) | ||
endif | ||
|
||
GOOS=$(shell go env GOOS) | ||
GOARCH=$(shell go env GOARCH) | ||
|
||
all: google-cas-issuer | ||
|
||
# Run tests | ||
test: generate fmt vet manifests | ||
go test ./... -coverprofile cover.out | ||
go test ./api/... ./pkg/... ./cmd/... -coverprofile cover.out | ||
|
||
.PHONY: e2e | ||
e2e: kind kustomize ginkgo kubectl docker-build | ||
$(KIND) version | ||
$(KIND) create cluster --name casissuer-e2e | ||
$(KIND) export kubeconfig --name casissuer-e2e --kubeconfig kubeconfig.yaml | ||
$(KIND) load docker-image --name casissuer-e2e ${IMG} | ||
$(KUBECTL) --kubeconfig kubeconfig.yaml apply -f https://github.com/jetstack/cert-manager/releases/download/v1.3.1/cert-manager.yaml | ||
$(KUSTOMIZE) build config/crd | $(KUBECTL) --kubeconfig kubeconfig.yaml apply -f - | ||
cd config/manager; $(KUSTOMIZE) edit set image controller=${IMG} | ||
$(KUSTOMIZE) build config/default | $(KUBECTL) --kubeconfig kubeconfig.yaml apply -f - | ||
timeout 5m bash -c 'until $(KUBECTL) --kubeconfig kubeconfig.yaml --timeout=120s wait --for=condition=Ready pods --all --namespace kube-system; do sleep 1; done' | ||
timeout 5m bash -c 'until $(KUBECTL) --kubeconfig kubeconfig.yaml --timeout=120s wait --for=condition=Ready pods --all --namespace cert-manager; do sleep 1; done' | ||
$(GINKGO) -nodes 1 test/e2e/ -- --kubeconfig $$(pwd)/kubeconfig.yaml --project jetstack-cas --location europe-west1 --capoolid google-cas-e2e | ||
$(KIND) delete cluster --name casissuer-e2e | ||
|
||
# Build google-cas-issuer binary | ||
google-cas-issuer: generate fmt vet | ||
|
@@ -26,17 +44,17 @@ run: generate fmt vet manifests | |
go run ./main.go --zap-devel=true | ||
|
||
# Install CRDs into a cluster | ||
install: manifests | ||
kustomize build config/crd | kubectl apply -f - | ||
install: manifests kustomize | ||
$(KUSTOMIZE) build config/crd | kubectl apply -f - | ||
|
||
# Uninstall CRDs from a cluster | ||
uninstall: manifests | ||
kustomize build config/crd | kubectl delete -f - | ||
uninstall: manifests kustomize | ||
$(KUSTOMIZE) build config/crd | kubectl delete -f - | ||
|
||
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config | ||
deploy: manifests | ||
deploy: manifests kustomize | ||
cd config/manager && kustomize edit set image controller=${IMG} | ||
kustomize build config/default | kubectl apply -f - | ||
$(KUSTOMIZE) build config/default | kubectl apply -f - | ||
|
||
# Generate manifests e.g. CRD, RBAC etc. | ||
manifests: controller-gen | ||
|
@@ -63,18 +81,70 @@ docker-push: | |
docker push ${IMG} | ||
|
||
# find or download controller-gen | ||
# download controller-gen if necessary | ||
controller-gen: | ||
ifeq (, $(shell which controller-gen)) | ||
@{ \ | ||
set -e ;\ | ||
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ | ||
cd $$CONTROLLER_GEN_TMP_DIR ;\ | ||
go mod init tmp ;\ | ||
go get sigs.k8s.io/controller-tools/cmd/[email protected] ;\ | ||
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\ | ||
go install sigs.k8s.io/controller-tools/cmd/[email protected] ;\ | ||
} | ||
CONTROLLER_GEN=$(GOBIN)/controller-gen | ||
else | ||
CONTROLLER_GEN=$(shell which controller-gen) | ||
endif | ||
|
||
# find or download kustomize | ||
kustomize: | ||
ifeq (, $(shell which kustomize)) | ||
@{ \ | ||
set -e ;\ | ||
TEMPDIR=$(mktemp -d);\ | ||
cd $$TEMPDIR ;\ | ||
GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3 ;\ | ||
} | ||
KUSTOMIZE=$(GOBIN)/kustomize | ||
else | ||
KUSTOMIZE=$(shell which kustomize) | ||
endif | ||
|
||
# find or download kind | ||
kind: | ||
ifeq (, $(shell which kind)) | ||
@{ \ | ||
set -e ;\ | ||
TEMPDIR=$(mktemp -d);\ | ||
cd $$TEMPDIR ;\ | ||
GO111MODULE=on go get sigs.k8s.io/[email protected] ;\ | ||
} | ||
KIND=$(GOBIN)/kind | ||
else | ||
KIND=$(shell which kind) | ||
endif | ||
|
||
# find or download ginkgo | ||
ginkgo: | ||
ifeq (, $(shell which ginkgo)) | ||
@{ \ | ||
set -e ;\ | ||
TEMPDIR=$(mktemp -d);\ | ||
cd $$TEMPDIR ;\ | ||
GO111MODULE=on go get github.com/onsi/ginkgo/ginkgo ;\ | ||
} | ||
GINKGO=$(GOBIN)/ginkgo | ||
else | ||
GINKGO=$(shell which ginkgo) | ||
endif | ||
|
||
# find or download kubectl | ||
kubectl: | ||
ifeq (, $(shell which kubectl)) | ||
@{ \ | ||
set -e ;\ | ||
curl -LO "https://dl.k8s.io/release/$$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/$(GOOS)/$(GOARCH)/kubectl" ;\ | ||
chmod a+x kubectl ;\ | ||
mv kubectl $(GOBIN)/kubectl ;\ | ||
} | ||
KUBECTL=$(GOBIN)/kubectl | ||
else | ||
KUBECTL=$(shell which kubectl) | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.