Skip to content

Commit c5de925

Browse files
committed
secretless: add yq, envtest binaries, and venaficonnections.yaml
1 parent be223f3 commit c5de925

File tree

10 files changed

+4070
-2
lines changed

10 files changed

+4070
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ predicate.json
1313
*.pub
1414
*.tgz
1515

16+
_bin

Makefile

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ build:
4848
install:
4949
cd $(ROOT_DIR) && $(GO_INSTALL)
5050

51-
test:
52-
cd $(ROOT_DIR) && go test ./...
51+
test: _bin/tools/etcd _bin/tools/kube-apiserver
52+
cd $(ROOT_DIR) && KUBEBUILDER_ASSETS=$(ROOT_DIR)/_bin/tools go test ./pkg/client/
5353

5454
vet:
5555
cd $(ROOT_DIR) && go vet ./...
@@ -142,3 +142,69 @@ ci-build: ci-test build build-docker-image build-all-platforms bundle-all-platfo
142142

143143
ci-publish: ci-build push-docker-image
144144
echo "ci-publish is going to be disabled. We are adopting Github actions"
145+
146+
helm_chart_source_dir := deploy/charts/venafi-kubernetes-agent
147+
BINDIR := $(ROOT_DIR)/_bin
148+
149+
.PHONY: generate-manifests
150+
generate-manifests: ## Generates jetstack.io_venaficonnections.yaml.
151+
generate-manifests: | $(NEEDS_GO) _bin/tools/yq
152+
@echo "# DO NOT EDIT. Use 'make generate-manifests' to regenerate." >$(helm_chart_source_dir)/crd_bases/jetstack.io_venaficonnections.yaml
153+
go run ./make/connection_crd >>$(helm_chart_source_dir)/crd_bases/jetstack.io_venaficonnections.yaml
154+
155+
@echo "# DO NOT EDIT. Use 'make generate-manifests' to regenerate." >$(helm_chart_source_dir)/templates/venafi-connection-crd.without-validations.yaml
156+
_bin/tools/yq 'del(.. | ."x-kubernetes-validations"?) | del(.metadata.creationTimestamp)' $(helm_chart_source_dir)/crd_bases/jetstack.io_venaficonnections.yaml >>$(helm_chart_source_dir)/templates/venafi-connection-crd.without-validations.yaml
157+
158+
@echo "# DO NOT EDIT. Use 'make generate-manifests' to regenerate." >$(helm_chart_source_dir)/templates/venafi-connection-crd.yaml
159+
_bin/tools/yq 'del(.metadata.creationTimestamp)' $(helm_chart_source_dir)/crd_bases/jetstack.io_venaficonnections.yaml >> $(helm_chart_source_dir)/templates/venafi-connection-crd.yaml
160+
161+
# This is a lesser version of what's in venafi-enhanced-issuer, and is very
162+
# suboptimal. We will migrate to makefile-modules and klone soon, so I didn't
163+
# want to work too hard on this.
164+
YQ_linux_amd64_SHA256SUM=bd695a6513f1196aeda17b174a15e9c351843fb1cef5f9be0af170f2dd744f08
165+
YQ_darwin_amd64_SHA256SUM=b2ff70e295d02695b284755b2a41bd889cfb37454e1fa71abc3a6ec13b2676cf
166+
YQ_darwin_arm64_SHA256SUM=e9fc15db977875de982e0174ba5dc2cf5ae4a644e18432a4262c96d4439b1686
167+
YQ_VERSION=v4.35.1
168+
169+
_bin/downloaded/tools/yq@$(YQ_VERSION)_%:
170+
mkdir -p _bin/downloaded/tools
171+
curl -L https://github.com/mikefarah/yq/releases/download/$(YQ_VERSION)/yq_$* -o $@
172+
./make/util/checkhash.sh $@ $(YQ_$*_SHA256SUM)
173+
chmod +x $@
174+
175+
HOST_OS=$(shell uname | tr '[:upper:]' '[:lower:]')
176+
HOST_ARCH=$(shell uname -m | sed 's/x86_64/amd64/')
177+
178+
_bin/tools/yq: _bin/downloaded/tools/yq@$(YQ_VERSION)_$(HOST_OS)_$(HOST_ARCH)
179+
@mkdir -p _bin/tools
180+
@cd $(dir $@) && ln -sf $(patsubst _bin/%,../%,$<) $(notdir $@)
181+
182+
KUBEBUILDER_TOOLS_linux_amd64_SHA256SUM=f9699df7b021f71a1ab55329b36b48a798e6ae3a44d2132255fc7e46c6790d4d
183+
KUBEBUILDER_TOOLS_darwin_amd64_SHA256SUM=e1913674bacaa70c067e15649237e1f67d891ba53f367c0a50786b4a274ee047
184+
KUBEBUILDER_TOOLS_darwin_arm64_SHA256SUM=0422632a2bbb0d4d14d7d8b0f05497a4d041c11d770a07b7a55c44bcc5e8ce66
185+
KUBEBUILDER_ASSETS_VERSION=1.27.1
186+
187+
_bin/downloaded/tools/etcd@$(KUBEBUILDER_ASSETS_VERSION)_%: _bin/downloaded/tools/kubebuilder_tools_$(KUBEBUILDER_ASSETS_VERSION)_%.tar.gz | _bin/downloaded/tools
188+
./make/util/checkhash.sh $< $(KUBEBUILDER_TOOLS_$*_SHA256SUM)
189+
@# O writes the specified file to stdout
190+
tar xfO $< kubebuilder/bin/etcd > $@ && chmod 775 $@
191+
192+
_bin/downloaded/tools/kube-apiserver@$(KUBEBUILDER_ASSETS_VERSION)_%: _bin/downloaded/tools/kubebuilder_tools_$(KUBEBUILDER_ASSETS_VERSION)_%.tar.gz | _bin/downloaded/tools
193+
./make/util/checkhash.sh $< $(KUBEBUILDER_TOOLS_$*_SHA256SUM)
194+
@# O writes the specified file to stdout
195+
tar xfO $< kubebuilder/bin/kube-apiserver > $@ && chmod 775 $@
196+
197+
_bin/downloaded/tools/kubebuilder_tools_$(KUBEBUILDER_ASSETS_VERSION)_$(HOST_OS)_$(HOST_ARCH).tar.gz: | _bin/downloaded/tools
198+
curl -L https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-$(KUBEBUILDER_ASSETS_VERSION)-$(HOST_OS)-$(HOST_ARCH).tar.gz -o $@
199+
200+
_bin/downloaded/tools:
201+
@mkdir -p $@
202+
203+
_bin/tools/etcd: _bin/downloaded/tools/etcd@$(KUBEBUILDER_ASSETS_VERSION)_$(HOST_OS)_$(HOST_ARCH)
204+
@mkdir -p _bin/tools
205+
@cd $(dir $@) && ln -sf $(patsubst _bin/%,../%,$<) $(notdir $@)
206+
207+
_bin/tools/kube-apiserver: _bin/downloaded/tools/kube-apiserver@$(KUBEBUILDER_ASSETS_VERSION)_$(HOST_OS)_$(HOST_ARCH)
208+
@mkdir -p _bin/tools
209+
@cd $(dir $@) && ln -sf $(patsubst _bin/%,../%,$<) $(notdir $@)
210+

0 commit comments

Comments
 (0)