Skip to content

Commit 38d1a2e

Browse files
1gtmtamalsaha
andauthored
[cherry-pick] Speed up schema generation process (#250) (#251)
/cherry-pick Signed-off-by: Tamal Saha <tamal@appscode.com> Co-authored-by: Tamal Saha <tamal@appscode.com>
1 parent 5561dce commit 38d1a2e

File tree

1,669 files changed

+22566
-297790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,669 files changed

+22566
-297790
lines changed

Makefile

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ RESTIC_VER := 0.11.0
5454
### These variables should not need tweaking.
5555
###
5656

57-
SRC_PKGS := api apis cmd pkg
58-
SRC_DIRS := $(SRC_PKGS) hack/gencrd # directories which hold app source (not vendored)
57+
SRC_PKGS := apis cmd pkg
58+
SRC_DIRS := $(SRC_PKGS) # directories which hold app source (not vendored)
5959

6060
DOCKER_PLATFORMS := linux/amd64
6161
BIN_PLATFORMS := $(DOCKER_PLATFORMS)
@@ -202,20 +202,20 @@ gen-crds:
202202
controller-gen \
203203
$(CRD_OPTIONS) \
204204
paths="./apis/..." \
205-
output:crd:artifacts:config=api/crds
205+
output:crd:artifacts:config=crds
206206

207207
crds_to_patch := installer.stash.appscode.com_stashmysqls.yaml
208208

209209
.PHONY: patch-crds
210210
patch-crds: $(addprefix patch-crd-, $(crds_to_patch))
211211
patch-crd-%: $(BUILD_DIRS)
212212
@echo "patching $*"
213-
@kubectl patch -f api/crds/$* -p "$$(cat hack/crd-patch.json)" --type=json --local=true -o yaml > bin/$*
214-
@mv bin/$* api/crds/$*
213+
@kubectl patch -f crds/$* -p "$$(cat hack/crd-patch.json)" --type=json --local=true -o yaml > bin/$*
214+
@mv bin/$* crds/$*
215215

216216
.PHONY: label-crds
217217
label-crds: $(BUILD_DIRS)
218-
@for f in api/crds/*.yaml; do \
218+
@for f in crds/*.yaml; do \
219219
echo "applying app=stash label to $$f"; \
220220
kubectl label --overwrite -f $$f --local=true -o yaml app=stash > bin/crd.yaml; \
221221
mv bin/crd.yaml $$f; \
@@ -248,17 +248,28 @@ gen-bindata:
248248
--rm \
249249
-u $$(id -u):$$(id -g) \
250250
-v $$(pwd):/src \
251-
-w /src/api/crds \
251+
-w /src/crds \
252252
-v /tmp:/.cache \
253253
--env HTTP_PROXY=$(HTTP_PROXY) \
254254
--env HTTPS_PROXY=$(HTTPS_PROXY) \
255255
$(BUILD_IMAGE) \
256256
go-bindata -ignore=\\.go -ignore=\\.DS_Store -mode=0644 -modtime=1573722179 -o bindata.go -pkg crds ./...
257257

258258
.PHONY: gen-values-schema
259-
gen-values-schema:
260-
@yq r api/crds/installer.stash.appscode.com_stashmysqls.v1.yaml spec.versions[0].schema.openAPIV3Schema.properties.spec > /tmp/stash-mysql-values.openapiv3_schema.yaml
261-
@yq d /tmp/stash-mysql-values.openapiv3_schema.yaml description > charts/stash-mysql/values.openapiv3_schema.yaml
259+
gen-values-schema: $(BUILD_DIRS)
260+
@for dir in charts/*/; do \
261+
dir=$${dir%*/}; \
262+
dir=$${dir##*/}; \
263+
crd=$$(echo $$dir | tr -d '-'); \
264+
yq r crds/installer.stash.appscode.com_$${crd}s.yaml spec.versions[0].schema.openAPIV3Schema.properties.spec > bin/values.openapiv3_schema.yaml; \
265+
yq d bin/values.openapiv3_schema.yaml description > charts/$${dir}/values.openapiv3_schema.yaml; \
266+
rm -rf bin/values.openapiv3_schema.yaml; \
267+
done
268+
269+
.PHONY: gen-readme
270+
gen-readme:
271+
@jq -n -c --arg v "$(CHART_VERSION)" '{"version":$$v}' > /tmp/data.json
272+
@render-gotpl --template=hack/templates/readme.txt --data=/tmp/data.json > README.md
262273

263274
.PHONY: gen-chart-doc
264275
gen-chart-doc: gen-chart-doc-stash-mysql
@@ -276,10 +287,10 @@ gen-chart-doc-%:
276287
chart-doc-gen -d ./charts/$*/doc.yaml -v ./charts/$*/values.yaml > ./charts/$*/README.md
277288

278289
.PHONY: manifests
279-
manifests: gen-crds patch-crds label-crds gen-bindata gen-values-schema gen-chart-doc
290+
manifests: gen-crds gen-values-schema gen-chart-doc
280291

281292
.PHONY: gen
282-
gen: clientset gen-crd-protos manifests openapi
293+
gen: clientset manifests
283294

284295
CHART_REGISTRY ?= appscode
285296
CHART_REGISTRY_URL ?= https://charts.appscode.com/stable/

api/crds/bindata.go

Lines changed: 0 additions & 267 deletions
This file was deleted.

api/crds/lib.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)