Skip to content

Commit

Permalink
add values.go implementation
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Jul 4, 2022
1 parent f9c8a6a commit c818af3
Show file tree
Hide file tree
Showing 61 changed files with 2,215 additions and 5,323 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@
- Update get started with using kubernetes ingress (#1510)
- Fix command template (#1508)
- Update dependencies version (#1501)
- modify .pb.go & swagger (#1493)
- modify .pb.go & openapi (#1493)
- Add reshape vector proto, remove meta/backup proto (#1492)

:pencil2: Documents
Expand Down
25 changes: 14 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ TENSORFLOW_C_VERSION := $(eval TENSORFLOW_C_VERSION := $(shell cat versions/TENS

OPERATOR_SDK_VERSION := $(eval OPERATOR_SDK_VERSION := $(shell cat versions/OPERATOR_SDK_VERSION))$(OPERATOR_SDK_VERSION)

KIND_VERSION ?= v0.14.0
HELM_VERSION ?= v3.9.0
GOLANGCILINT_VERSION ?= v1.46.2
HELM_DOCS_VERSION ?= 1.11.0
YQ_VERSION ?= v4.25.3
VALDCLI_VERSION ?= v1.5.4
TELEPRESENCE_VERSION ?= 2.6.8
HELM_VERSION ?= v3.9.0
JAEGER_OPERATOR_VERSION ?= 2.30.0
KIND_VERSION ?= v0.14.0
KUBELINTER_VERSION ?= 0.3.0
GOLANGCILINT_VERSION ?= v1.46.2
REVIEWDOG_VERSION ?= v0.14.1
PROTOBUF_VERSION ?= 21.2
JAEGER_OPERATOR_VERSION ?= 2.30.0
REVIEWDOG_VERSION ?= v0.14.1
TELEPRESENCE_VERSION ?= 2.6.8
VALDCLI_VERSION ?= v1.5.4
YQ_VERSION ?= v4.25.3

SWAP_DEPLOYMENT_TYPE ?= deployment
SWAP_IMAGE ?= ""
Expand Down Expand Up @@ -96,7 +96,8 @@ BENCH_DATASET_HDF5_DIR = $(BENCH_DATASET_BASE_DIR)/$(BENCH_DATASET_HDF5_DIR_NAME
PROTOS := $(eval PROTOS := $(shell find apis/proto -type f -regex ".*\.proto"))$(PROTOS)
PROTOS_V1 := $(eval PROTOS_V1 := $(filter apis/proto/v1/%.proto,$(PROTOS)))$(PROTOS_V1)
PBGOS = $(PROTOS:apis/proto/%.proto=apis/grpc/%.pb.go)
SWAGGERS = $(PROTOS:apis/proto/%.proto=apis/swagger/%.swagger.json)
OPENAPISPECS = $(PROTOS:apis/proto/%.proto=apis/openapi/%.openapi.json)
OPENAPIJSONSCHEMAS = $(PROTOS:apis/proto/%.proto=apis/jsonschema/%.schema.json)
PBDOCS = apis/docs/v1/docs.md

ifeq ($(GOARCH),amd64)
Expand Down Expand Up @@ -197,7 +198,7 @@ GO_SOURCES = $(eval GO_SOURCES := $(shell find \
-not -path './hack/benchmark/internal/starter/gateway/*' \
-not -path './hack/gorules/*' \
-not -path './hack/license/*' \
-not -path './hack/swagger/*' \
-not -path './hack/openapi/*' \
-not -path './hack/tools/*' \
-not -path './tests/*' \
-type f \
Expand Down Expand Up @@ -227,7 +228,7 @@ GO_OPTION_SOURCES = $(eval GO_OPTION_SOURCES := $(shell find \
-not -path './hack/benchmark/internal/starter/gateway/*' \
-not -path './hack/gorules/*' \
-not -path './hack/license/*' \
-not -path './hack/swagger/*' \
-not -path './hack/openapi/*' \
-not -path './hack/tools/*' \
-not -path './tests/*' \
-type f \
Expand Down Expand Up @@ -320,7 +321,9 @@ clean:
./*.log \
./*.svg \
./apis/docs \
./apis/openapi \
./apis/swagger \
./apis/jsonschema \
./apis/grpc \
./bench \
./pprof \
Expand Down
35 changes: 25 additions & 10 deletions Makefile.d/proto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,25 @@ proto/all: \
proto/deps \
pbgo \
pbdoc \
swagger
openapi \
jsonschema

.PHONY: pbgo
pbgo: $(PBGOS)

.PHONY: swagger
swagger: $(SWAGGERS)
.PHONY: openapi
openapi: $(OPENAPISPECS)

.PHONY: jsonschema
jsonschema: $(OPENAPIJSONSCHEMAS)

.PHONY: pbdoc
pbdoc: $(PBDOCS)

.PHONY: proto/clean
## clean proto artifacts
proto/clean:
rm -rf apis/grpc apis/swagger apis/docs
rm -rf apis/grpc apis/openapi apis/docs

.PHONY: proto/paths/print
## print proto paths
Expand All @@ -48,7 +52,8 @@ proto/deps: \
$(GOPATH)/bin/protoc-gen-go-grpc \
$(GOPATH)/bin/protoc-gen-go-vtproto \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-jsonschema \
$(GOPATH)/bin/protoc-gen-openapi \
$(GOPATH)/bin/protoc-gen-validate \
$(GOPATH)/bin/prototool \
$(GOPATH)/bin/swagger \
Expand Down Expand Up @@ -112,8 +117,11 @@ $(GOPATH)/bin/protoc-gen-go-grpc:
$(GOPATH)/bin/protoc-gen-grpc-gateway:
$(call go-install, github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway)

$(GOPATH)/bin/protoc-gen-swagger:
$(call go-install, github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger)
$(GOPATH)/bin/protoc-gen-openapi:
$(call go-install, github.com/google/gnostic/cmd/protoc-gen-openapi)

$(GOPATH)/bin/protoc-gen-jsonschema:
$(call go-install, github.com/google/gnostic/cmd/protoc-gen-jsonschema)

$(GOPATH)/bin/protoc-gen-validate:
$(call go-install, github.com/envoyproxy/protoc-gen-validate)
Expand All @@ -140,12 +148,19 @@ $(PBGOS): \
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs sed -i -E "s%google.golang.org/grpc/status%github.com/vdaas/vald/internal/net/grpc/status%g"
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs sed -i -E "s%\"io\"%\"github.com/vdaas/vald/internal/io\"%g"

$(SWAGGERS): \
$(OPENAPISPECS): \
$(PROTOS) \
proto/deps
@$(call green, "generating openapi.json files...")
$(call mkdir, $(dir $@))
$(call protoc-gen, $(patsubst apis/openapi/%.openapi.json,apis/proto/%.proto,$@), --openapi_out=enum_type=string:$(dir $@))

$(OPENAPIJSONSCHEMAS): \
$(PROTOS) \
proto/deps
@$(call green, "generating swagger.json files...")
@$(call green, "generating schema.json files...")
$(call mkdir, $(dir $@))
$(call protoc-gen, $(patsubst apis/swagger/%.swagger.json,apis/proto/%.proto,$@), --swagger_out=json_names_for_fields=true:$(dir $@))
$(call protoc-gen, $(patsubst apis/jsonschema/%.schema.json,apis/proto/%.proto,$@), --jsonschema_out=$(dir $@))

$(PBDOCS): \
$(PROTOS) \
Expand Down
24 changes: 24 additions & 0 deletions apis/jsonschema/v1/payload/Control.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"title": "Control",
"$id": "Control.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Control related messages.",
"properties": {
},
"definitions": {
"Control_CreateIndexRequest": {
"title": "CreateIndexRequest",
"type": "object",
"description": "Represent the create index request.",
"properties": {
"poolSize": {
"title": "poolSize",
"type": "integer",
"description": "The pool size of the create index operation.",
"format": "uint32"
}
}
}
}
}
33 changes: 33 additions & 0 deletions apis/jsonschema/v1/payload/Discoverer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"title": "Discoverer",
"$id": "Discoverer.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Discoverer related messages.",
"properties": {
},
"definitions": {
"Discoverer_Request": {
"title": "Request",
"type": "object",
"description": "Represent the dicoverer request.",
"properties": {
"name": {
"title": "name",
"type": "string",
"description": "The agent name to be discover."
},
"namespace": {
"title": "namespace",
"type": "string",
"description": "The namespace to be discover."
},
"node": {
"title": "node",
"type": "string",
"description": "The node to be discover."
}
}
}
}
}
9 changes: 9 additions & 0 deletions apis/jsonschema/v1/payload/Empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"title": "Empty",
"$id": "Empty.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Represent an empty message.",
"properties": {
}
}
44 changes: 44 additions & 0 deletions apis/jsonschema/v1/payload/Filter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"title": "Filter",
"$id": "Filter.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Filter related messages.",
"properties": {
},
"definitions": {
"Filter_Target": {
"title": "Target",
"type": "object",
"description": "Represent the target filter server.",
"properties": {
"host": {
"title": "host",
"type": "string",
"description": "The target hostname."
},
"port": {
"title": "port",
"type": "integer",
"description": "The target port.",
"format": "uint32"
}
}
},
"Filter_Config": {
"title": "Config",
"type": "object",
"description": "Represent filter configuration.",
"properties": {
"targets": {
"title": "targets",
"type": "array",
"items": {
"$ref": "Filter_Target.json"
},
"description": "Represent the filter target configuration."
}
}
}
}
}
Loading

0 comments on commit c818af3

Please sign in to comment.