Skip to content

Commit 296e3e7

Browse files
1gtmtamalsaha
andauthored
[cherry-pick] Speed up schema generation process (#663) (#669)
/cherry-pick Signed-off-by: Tamal Saha <tamal@appscode.com> Co-authored-by: Tamal Saha <tamal@appscode.com>
1 parent 7a9825f commit 296e3e7

File tree

1,671 files changed

+22605
-297966
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,671 files changed

+22605
-297966
lines changed

Makefile

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BIN := stash-mongodb
2020
COMPRESS ?= no
2121

2222
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
23-
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,crdVersions={v1beta1,v1}"
23+
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,crdVersions={v1}"
2424
# https://github.com/appscodelabs/gengo-builder
2525
CODE_GENERATOR_IMAGE ?= appscode/gengo:release-1.18
2626
API_GROUPS ?= installer:v1alpha1
@@ -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 linux/arm64
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_stashmongodbs.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_stashmongodbs.v1.yaml spec.versions[0].schema.openAPIV3Schema.properties.spec > /tmp/stash-mongodb-values.openapiv3_schema.yaml
261-
@yq d /tmp/stash-mongodb-values.openapiv3_schema.yaml description > charts/stash-mongodb/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-mongodb
@@ -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/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Install MongoDB 4.0.3 backup or restore plugin for Stash as below.
1515
```console
1616
helm repo add appscode https://charts.appscode.com/stable/
1717
helm repo update
18-
helm install appscode/stash-mongodb --name=stash-mongodb-4.0.3 --version=4.0.3
18+
helm install stash-mongodb-4.1.13 appscode/stash-mongodb --version=4.1.13 --namespace=kube-system
1919
```
2020

2121
To install catalog for all supported MongoDB versions, please visit [here](https://github.com/stashed/catalog).
@@ -25,7 +25,7 @@ To install catalog for all supported MongoDB versions, please visit [here](https
2525
Uninstall MongoDB 4.0.3 backup or restore plugin for Stash as below.
2626

2727
```console
28-
helm delete stash-mongodb-4.0.3
28+
helm delete stash-mongodb--4.1.13 --namespace=kube-system
2929
```
3030

3131
## Support

api/crds/bindata.go

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

0 commit comments

Comments
 (0)