Skip to content

Commit

Permalink
Generate protobuf files for api types (#967)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Nov 13, 2019
1 parent decea34 commit 69ef388
Show file tree
Hide file tree
Showing 179 changed files with 31,629 additions and 638 deletions.
42 changes: 40 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ openapi-%:
openapi-gen \
--v 1 --logtostderr \
--go-header-file "./hack/license/go.txt" \
--input-dirs "$(GO_PKG)/$(REPO)/apis/$(subst _,/,$*),k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr,k8s.io/apimachinery/pkg/version,k8s.io/api/core/v1,k8s.io/api/apps/v1,kmodules.xyz/offshoot-api/api/v1,github.com/appscode/go/encoding/json/types,kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1,k8s.io/api/rbac/v1,kmodules.xyz/objectstore-api/api/v1" \
--input-dirs "$(GO_PKG)/$(REPO)/apis/$(subst _,/,$*),k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr,k8s.io/apimachinery/pkg/version,k8s.io/api/core/v1,k8s.io/api/apps/v1,kmodules.xyz/offshoot-api/api/v1,github.com/appscode/go/encoding/json/types,kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1,k8s.io/api/rbac/v1,kmodules.xyz/objectstore-api/api/v1,kmodules.xyz/prober/api/v1" \
--output-package "$(GO_PKG)/$(REPO)/apis/$(subst _,/,$*)" \
--report-filename api/api-rules/violation_exceptions.list

Expand Down Expand Up @@ -234,8 +234,46 @@ label-crds: $(BUILD_DIRS)
mv bin/crd.yaml $$f; \
done

.PHONY: gen-crd-protos
gen-crd-protos: $(addprefix gen-crd-protos-, $(subst :,_,repositories:v1alpha1 stash:v1alpha1)) gen-crd-protos-stash-v1beta1

gen-crd-protos-%:
@echo "Generating protobuf for $(subst _,/,$*)"
@docker run --rm \
-u $$(id -u):$$(id -g) \
-v /tmp:/.cache \
-v $$(pwd):$(DOCKER_REPO_ROOT) \
-w $(DOCKER_REPO_ROOT) \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
$(CODE_GENERATOR_IMAGE) \
go-to-protobuf \
--go-header-file "./hack/license/go.txt" \
--proto-import=$(DOCKER_REPO_ROOT)/vendor \
--proto-import=$(DOCKER_REPO_ROOT)/third_party/protobuf \
--apimachinery-packages=-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/apis/meta/v1,-k8s.io/apimachinery/pkg/apis/meta/v1beta1,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/util/intstr \
--packages=-k8s.io/api/core/v1,-kmodules.xyz/offshoot-api/api/v1,-kmodules.xyz/objectstore-api/api/v1,-kmodules.xyz/prober/api/v1,stash.appscode.dev/stash/apis/$(subst _,/,$*)

.PHONY: gen-crd-protos-stash-v1beta1
gen-crd-protos-stash-v1beta1:
@echo "Generating protobuf for stash/v1beta1"
@docker run --rm \
-u $$(id -u):$$(id -g) \
-v /tmp:/.cache \
-v $$(pwd):$(DOCKER_REPO_ROOT) \
-w $(DOCKER_REPO_ROOT) \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
$(CODE_GENERATOR_IMAGE) \
go-to-protobuf \
--go-header-file "./hack/license/go.txt" \
--proto-import=$(DOCKER_REPO_ROOT)/vendor \
--proto-import=$(DOCKER_REPO_ROOT)/third_party/protobuf \
--apimachinery-packages=-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/apis/meta/v1,-k8s.io/apimachinery/pkg/apis/meta/v1beta1,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/util/intstr \
--packages=-k8s.io/api/core/v1,-kmodules.xyz/offshoot-api/api/v1,-kmodules.xyz/objectstore-api/api/v1,-kmodules.xyz/prober/api/v1,-stash.appscode.dev/stash/apis/stash/v1alpha1,stash.appscode.dev/stash/apis/stash/v1beta1

.PHONY: manifests
manifests: gen-crds label-crds
manifests: gen-crds label-crds gen-crd-protos

.PHONY: gen
gen: clientset openapi manifests
Expand Down
242 changes: 236 additions & 6 deletions api/crds/stash.appscode.com_backupbatches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,8 @@ spec:
type: array
type: object
httpGet:
description: HTTPGet specifies the http request to
perform.
description: HTTPGet specifies the http Get request
to perform.
properties:
host:
description: Host name to connect to, defaults
Expand Down Expand Up @@ -910,6 +910,63 @@ spec:
required:
- port
type: object
httpPost:
description: HTTPPost specifies the http Post request
to perform.
properties:
body:
description: Body to set in the request.
type: string
form:
additionalProperties:
properties:
values:
items:
type: string
type: array
type: object
description: Form to set in the request body.
type: object
host:
description: Host name to connect to, defaults
to the pod IP. You probably want to set "Host"
in httpHeaders instead.
type: string
httpHeaders:
description: Custom headers to set in the request.
HTTP allows repeated headers.
items:
description: HTTPHeader describes a custom header
to be used in HTTP probes
properties:
name:
description: The header field name
type: string
value:
description: The header field value
type: string
required:
- name
- value
type: object
type: array
path:
description: Path to access on the HTTP server.
type: string
port:
anyOf:
- type: string
- type: integer
description: Name or number of the port to access
on the container. Number must be in the range
1 to 65535. Name must be an IANA_SVC_NAME.
scheme:
description: Scheme to use for connecting to the
host. Defaults to HTTP.
type: string
required:
- port
type: object
tcpSocket:
description: 'TCPSocket specifies an action involving
a TCP port. TCP hooks not yet supported TODO: implement
Expand Down Expand Up @@ -953,9 +1010,66 @@ spec:
type: array
type: object
httpGet:
description: HTTPGet specifies the http request to
perform.
description: HTTPGet specifies the http Get request
to perform.
properties:
host:
description: Host name to connect to, defaults
to the pod IP. You probably want to set "Host"
in httpHeaders instead.
type: string
httpHeaders:
description: Custom headers to set in the request.
HTTP allows repeated headers.
items:
description: HTTPHeader describes a custom header
to be used in HTTP probes
properties:
name:
description: The header field name
type: string
value:
description: The header field value
type: string
required:
- name
- value
type: object
type: array
path:
description: Path to access on the HTTP server.
type: string
port:
anyOf:
- type: string
- type: integer
description: Name or number of the port to access
on the container. Number must be in the range
1 to 65535. Name must be an IANA_SVC_NAME.
scheme:
description: Scheme to use for connecting to the
host. Defaults to HTTP.
type: string
required:
- port
type: object
httpPost:
description: HTTPPost specifies the http Post request
to perform.
properties:
body:
description: Body to set in the request.
type: string
form:
additionalProperties:
properties:
values:
items:
type: string
type: array
type: object
description: Form to set in the request body.
type: object
host:
description: Host name to connect to, defaults
to the pod IP. You probably want to set "Host"
Expand Down Expand Up @@ -3592,7 +3706,7 @@ spec:
type: array
type: object
httpGet:
description: HTTPGet specifies the http request to perform.
description: HTTPGet specifies the http Get request to perform.
properties:
host:
description: Host name to connect to, defaults to the pod
Expand Down Expand Up @@ -3633,6 +3747,61 @@ spec:
required:
- port
type: object
httpPost:
description: HTTPPost specifies the http Post request to perform.
properties:
body:
description: Body to set in the request.
type: string
form:
additionalProperties:
properties:
values:
items:
type: string
type: array
type: object
description: Form to set in the request body.
type: object
host:
description: Host name to connect to, defaults to the pod
IP. You probably want to set "Host" in httpHeaders instead.
type: string
httpHeaders:
description: Custom headers to set in the request. HTTP
allows repeated headers.
items:
description: HTTPHeader describes a custom header to be
used in HTTP probes
properties:
name:
description: The header field name
type: string
value:
description: The header field value
type: string
required:
- name
- value
type: object
type: array
path:
description: Path to access on the HTTP server.
type: string
port:
anyOf:
- type: string
- type: integer
description: Name or number of the port to access on the
container. Number must be in the range 1 to 65535. Name
must be an IANA_SVC_NAME.
scheme:
description: Scheme to use for connecting to the host. Defaults
to HTTP.
type: string
required:
- port
type: object
tcpSocket:
description: 'TCPSocket specifies an action involving a TCP
port. TCP hooks not yet supported TODO: implement a realistic
Expand Down Expand Up @@ -3674,8 +3843,63 @@ spec:
type: array
type: object
httpGet:
description: HTTPGet specifies the http request to perform.
description: HTTPGet specifies the http Get request to perform.
properties:
host:
description: Host name to connect to, defaults to the pod
IP. You probably want to set "Host" in httpHeaders instead.
type: string
httpHeaders:
description: Custom headers to set in the request. HTTP
allows repeated headers.
items:
description: HTTPHeader describes a custom header to be
used in HTTP probes
properties:
name:
description: The header field name
type: string
value:
description: The header field value
type: string
required:
- name
- value
type: object
type: array
path:
description: Path to access on the HTTP server.
type: string
port:
anyOf:
- type: string
- type: integer
description: Name or number of the port to access on the
container. Number must be in the range 1 to 65535. Name
must be an IANA_SVC_NAME.
scheme:
description: Scheme to use for connecting to the host. Defaults
to HTTP.
type: string
required:
- port
type: object
httpPost:
description: HTTPPost specifies the http Post request to perform.
properties:
body:
description: Body to set in the request.
type: string
form:
additionalProperties:
properties:
values:
items:
type: string
type: array
type: object
description: Form to set in the request body.
type: object
host:
description: Host name to connect to, defaults to the pod
IP. You probably want to set "Host" in httpHeaders instead.
Expand Down Expand Up @@ -3756,20 +3980,26 @@ spec:
dryRun:
type: boolean
keepDaily:
format: int64
type: integer
keepHourly:
format: int64
type: integer
keepLast:
format: int64
type: integer
keepMonthly:
format: int64
type: integer
keepTags:
items:
type: string
type: array
keepWeekly:
format: int64
type: integer
keepYearly:
format: int64
type: integer
name:
type: string
Expand Down
Loading

0 comments on commit 69ef388

Please sign in to comment.