diff --git a/Makefile b/Makefile index e3df83fcb..75a641f19 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ PROJECT = github.com/weaveworks/ignite APIS_DIR = ${PROJECT}/pkg/apis API_DIRS = ${APIS_DIR}/ignite/v1alpha1,${APIS_DIR}/meta/v1alpha1 CACHE_DIR = $(shell pwd)/bin/cache -API_DOCS = docs/api-reference/ignite.md docs/api-reference/meta.md +API_DOCS = api/ignite.md api/meta.md all: binary binary: @@ -49,7 +49,7 @@ tidy: $(API_DOCS) go run hack/cobra.go .PHONY: $(API_DOCS) -$(API_DOCS): docs/api-reference/%.md: $(CACHE_DIR)/go/bin/godoc2md +$(API_DOCS): api/%.md: $(CACHE_DIR)/go/bin/godoc2md mkdir -p $$(dirname $@) bin/tmp/$* mv $(shell pwd)/pkg/apis/$*/v1alpha1/zz_generated* bin/tmp/$* $(MAKE) shell COMMAND="/go/bin/godoc2md /go/src/${PROJECT}/pkg/apis/$*/v1alpha1 > $@" @@ -65,8 +65,8 @@ shell: docker run -it --rm \ -v $(CACHE_DIR)/go:/go \ -v $(CACHE_DIR)/cache:/.cache/go-build \ - -v $(shell pwd):/go/src/github.com/weaveworks/ignite \ - -w /go/src/github.com/weaveworks/ignite \ + -v $(shell pwd):/go/src/${PROJECT} \ + -w /go/src/${PROJECT} \ -u $(shell id -u):$(shell id -g) \ -e GO111MODULE=on \ golang:$(GO_VERSION) \ @@ -75,7 +75,7 @@ shell: autogen: $(MAKE) shell COMMAND="make dockerized-autogen" -dockerized-autogen: /go/bin/deepcopy-gen /go/bin/defaulter-gen /go/bin/conversion-gen +dockerized-autogen: /go/bin/deepcopy-gen /go/bin/defaulter-gen /go/bin/conversion-gen /go/bin/openapi-gen # Let the boilerplate be empty touch /tmp/boilerplate /go/bin/deepcopy-gen \ @@ -93,6 +93,15 @@ dockerized-autogen: /go/bin/deepcopy-gen /go/bin/defaulter-gen /go/bin/conversio --input-dirs ${API_DIRS} \ -O zz_generated.conversion \ -h /tmp/boilerplate + + /go/bin/openapi-gen \ + --input-dirs ${API_DIRS} \ + --output-package ${PROJECT}/api/openapi \ + --report-filename api/openapi/violations.txt \ + -h /tmp/boilerplate /go/bin/%: vendor go install k8s.io/code-generator/cmd/$* + +/go/bin/openapi-gen: + go install k8s.io/kube-openapi/cmd/openapi-gen diff --git a/api/README.md b/api/README.md new file mode 100644 index 000000000..6434ea256 --- /dev/null +++ b/api/README.md @@ -0,0 +1,15 @@ +## Ignite API + +The Ignite API types use the [`k8s.io/apimachinery`](https://github.com/kubernetes/apimachinery) framework, and +similar conventions as the Kubernetes API types. That said, the Ignite API types don't (at the moment at least) +have any connection or depend on Kubernetes itself in any way. + +The API types are used for two primary things: + + - Letting end users [declaratively specify advanced configuration](../docs/declarative-config.md) (e.g. `ignite create --config`) + - Persisting internal data on disk in a standardized way. + +Please refer to the (autogenerated) docs for the API types: + + - `ignite.weave.works/v1alpha1` in [ignite.md](ignite.md) + - The meta-package containing generic types [meta.md](meta.md) diff --git a/api/openapi/openapi_generated.go b/api/openapi/openapi_generated.go new file mode 100644 index 000000000..9b344ff40 --- /dev/null +++ b/api/openapi/openapi_generated.go @@ -0,0 +1,755 @@ +// +build !ignore_autogenerated + +// Code generated by openapi-gen. DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package openapi + +import ( + spec "github.com/go-openapi/spec" + common "k8s.io/kube-openapi/pkg/common" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.FileMapping": schema_pkg_apis_ignite_v1alpha1_FileMapping(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.Image": schema_pkg_apis_ignite_v1alpha1_Image(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageClaim": schema_pkg_apis_ignite_v1alpha1_ImageClaim(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSource": schema_pkg_apis_ignite_v1alpha1_ImageSource(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSpec": schema_pkg_apis_ignite_v1alpha1_ImageSpec(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.Kernel": schema_pkg_apis_ignite_v1alpha1_Kernel(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.KernelClaim": schema_pkg_apis_ignite_v1alpha1_KernelClaim(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.KernelSpec": schema_pkg_apis_ignite_v1alpha1_KernelSpec(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.Pool": schema_pkg_apis_ignite_v1alpha1_Pool(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolDevice": schema_pkg_apis_ignite_v1alpha1_PoolDevice(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolSpec": schema_pkg_apis_ignite_v1alpha1_PoolSpec(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolStatus": schema_pkg_apis_ignite_v1alpha1_PoolStatus(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.SSH": schema_pkg_apis_ignite_v1alpha1_SSH(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VM": schema_pkg_apis_ignite_v1alpha1_VM(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VMSpec": schema_pkg_apis_ignite_v1alpha1_VMSpec(ref), + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VMStatus": schema_pkg_apis_ignite_v1alpha1_VMStatus(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.APIType": schema_pkg_apis_meta_v1alpha1_APIType(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.DMID": schema_pkg_apis_meta_v1alpha1_DMID(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta": schema_pkg_apis_meta_v1alpha1_ObjectMeta(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.PortMapping": schema_pkg_apis_meta_v1alpha1_PortMapping(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size": schema_pkg_apis_meta_v1alpha1_Size(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Time": schema_pkg_apis_meta_v1alpha1_Time(ref), + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.TypeMeta": schema_pkg_apis_meta_v1alpha1_TypeMeta(ref), + } +} + +func schema_pkg_apis_ignite_v1alpha1_FileMapping(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FileMapping defines mappings between files on the host and VM", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "hostPath": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "vmPath": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"hostPath", "vmPath"}, + }, + }, + } +} + +func schema_pkg_apis_ignite_v1alpha1_Image(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Image represents a cached OCI image ready to be used with Ignite", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "TypeMeta": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"), + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "meta.ObjectMeta is also embedded into the struct, and defines the human-readable name, and the machine-readable ID Name is available at the .metadata.name JSON path ID is available at the .metadata.uid JSON path (the Go type is k8s.io/apimachinery/pkg/types.UID, which is only a typed string)", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSpec"), + }, + }, + }, + Required: []string{"TypeMeta", "metadata", "spec"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSpec", "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_ImageClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ImageClaim specifies a claim to import an image", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "ref": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "ref", "uid"}, + }, + }, + } +} + +func schema_pkg_apis_ignite_v1alpha1_ImageSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ImageSource defines where the image was imported from", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type defines how the image was imported", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the source's ID (e.g. the Docker image ID)", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name defines the user-friendly name of the imported source", + Type: []string{"string"}, + Format: "", + }, + }, + "size": { + SchemaProps: spec.SchemaProps{ + Description: "Size defines the size of the source in bytes", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + }, + Required: []string{"type", "id", "name", "size"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_ImageSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ImageSpec declares what the image contains", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "source": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSource"), + }, + }, + }, + Required: []string{"source"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSource"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_Kernel(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Kernel is a serializable object that caches information about imported kernels This file is stored in /var/lib/firecracker/kernels/{oci-image-digest}/metadata.json", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "TypeMeta": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"), + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "meta.ObjectMeta is also embedded into the struct, and defines the human-readable name, and the machine-readable ID Name is available at the .metadata.name JSON path ID is available at the .metadata.uid JSON path (the Go type is k8s.io/apimachinery/pkg/types.UID, which is only a typed string)", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.KernelSpec"), + }, + }, + }, + Required: []string{"TypeMeta", "metadata", "spec"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.KernelSpec", "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_KernelClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "cmdline": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"uid", "cmdline"}, + }, + }, + } +} + +func schema_pkg_apis_ignite_v1alpha1_KernelSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "KernelSpec describes the properties of a kernel", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "source": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSource"), + }, + }, + }, + Required: []string{"version", "source"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageSource"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_Pool(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Pool defines device mapper pool database This file is managed by the snapshotter part of Ignite, and the file (existing as a singleton) is present at /var/lib/firecracker/snapshotter/pool.json", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "TypeMeta": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolStatus"), + }, + }, + }, + Required: []string{"TypeMeta", "spec", "status"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolSpec", "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_PoolDevice(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PoolDevice defines one device in the pool", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "size": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + "parent": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.DMID"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type specifies the type of the contents of the device", + Type: []string{"string"}, + Format: "", + }, + }, + "metadataPath": { + SchemaProps: spec.SchemaProps{ + Description: "MetadataPath points to the JSON/YAML file with metadata about this device This is most often of the format /var/lib/firecracker/{type}/{id}/metadata.json", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"size", "parent", "type", "metadataPath"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.DMID", "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_PoolSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PoolSpec defines the Pool's specification", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "metadataSize": { + SchemaProps: spec.SchemaProps{ + Description: "MetadataSize specifies the size of the pool's metadata", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + "dataSize": { + SchemaProps: spec.SchemaProps{ + Description: "DataSize specifies the size of the pool's data", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + "allocationSize": { + SchemaProps: spec.SchemaProps{ + Description: "AllocationSize specifies the smallest size that can be allocated at a time", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + "metadataPath": { + SchemaProps: spec.SchemaProps{ + Description: "MetadataPath points to the file where device mapper stores all metadata information Defaults to constants.SNAPSHOTTER_METADATA_PATH", + Type: []string{"string"}, + Format: "", + }, + }, + "dataPath": { + SchemaProps: spec.SchemaProps{ + Description: "DataPath points to the backing physical device or sparse file (to be loop mounted) for the pool Defaults to constants.SNAPSHOTTER_DATA_PATH", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"metadataSize", "dataSize", "allocationSize", "metadataPath", "dataPath"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_PoolStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PoolStatus defines the Pool's current status", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "devices": { + SchemaProps: spec.SchemaProps{ + Description: "The Devices array needs to contain pointers to accommodate \"holes\" in the mapping Where devices have been deleted, the pointer is nil", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolDevice"), + }, + }, + }, + }, + }, + }, + Required: []string{"devices"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.PoolDevice"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_SSH(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SSH specifies different ways to connect via SSH to the VM", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "publicKey": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"publicKey"}, + }, + }, + } +} + +func schema_pkg_apis_ignite_v1alpha1_VM(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VM represents a virtual machine run by Firecracker These files are stored in /var/lib/firecracker/vm/{vm-id}/metadata.json", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "TypeMeta": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"), + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "meta.ObjectMeta is also embedded into the struct, and defines the human-readable name, and the machine-readable ID Name is available at the .metadata.name JSON path ID is available at the .metadata.uid JSON path (the Go type is k8s.io/apimachinery/pkg/types.UID, which is only a typed string)", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VMSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VMStatus"), + }, + }, + }, + Required: []string{"TypeMeta", "metadata", "spec", "status"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VMSpec", "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.VMStatus", "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_VMSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VMSpec describes the configuration of a VM", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageClaim"), + }, + }, + "kernel": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.KernelClaim"), + }, + }, + "cpus": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "memory": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + "diskSize": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"), + }, + }, + "ports": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.PortMapping"), + }, + }, + }, + }, + }, + "copyFiles": { + SchemaProps: spec.SchemaProps{ + Description: "This will be done at either \"ignite start\" or \"ignite create\" time", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.FileMapping"), + }, + }, + }, + }, + }, + "ssh": { + SchemaProps: spec.SchemaProps{ + Description: "SSH specifies how the SSH setup should be done SSH appends to CopyFiles when active nil here means \"don't do anything special\" An empty struct means \"generate a new SSH key and copy it in\" Specifying a path means \"use this public key\"", + Ref: ref("github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.SSH"), + }, + }, + }, + Required: []string{"image", "kernel", "cpus", "memory", "diskSize"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.FileMapping", "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.ImageClaim", "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.KernelClaim", "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1.SSH", "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.PortMapping", "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Size"}, + } +} + +func schema_pkg_apis_ignite_v1alpha1_VMStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VMStatus defines the status of a VM", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "state": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "ipAddresses": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "byte", + }, + }, + }, + }, + }, + }, + Required: []string{"state", "ipAddresses"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1alpha1_APIType(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIType is a struct implementing Object, used for unmarshalling unknown objects into this intermediate type where .Name, .UID, .Kind and .APIVersion become easily available", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "TypeMeta": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"), + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta"), + }, + }, + }, + Required: []string{"TypeMeta", "metadata"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.ObjectMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"}, + } +} + +func schema_pkg_apis_meta_v1alpha1_DMID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DMID specifies the format for device mapper IDs", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"index"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1alpha1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectMeta have to be embedded into any serializable object. It provides the .GetName() and .GetUID() methods that help implement the Object interface", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "created": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Time"), + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{ + "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1.Time"}, + } +} + +func schema_pkg_apis_meta_v1alpha1_PortMapping(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PortMapping defines a port mapping between the VM and the host", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "hostPort": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "vmPort": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"hostPort", "vmPort"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1alpha1_Size(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Size specifies a common unit for data sizes", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "ByteSize": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"ByteSize"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1alpha1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Time": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + }, + Required: []string{"Time"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1alpha1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta is an alias for the k8s/apimachinery TypeMeta with some additional methods", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "TypeMeta": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"), + }, + }, + }, + Required: []string{"TypeMeta"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"}, + } +} diff --git a/api/openapi/violations.txt b/api/openapi/violations.txt new file mode 100644 index 000000000..908643edb --- /dev/null +++ b/api/openapi/violations.txt @@ -0,0 +1,6 @@ +API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1,KernelClaim,CmdLine +API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1,VMSpec,CPUs +API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1,DMID,index +API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1,Size,ByteSize +API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1,Time,Time +API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1,TypeMeta,TypeMeta diff --git a/pkg/apis/ignite/v1alpha1/doc.go b/pkg/apis/ignite/v1alpha1/doc.go index 41336af8e..82fa190e8 100644 --- a/pkg/apis/ignite/v1alpha1/doc.go +++ b/pkg/apis/ignite/v1alpha1/doc.go @@ -1,3 +1,4 @@ // +k8s:deepcopy-gen=package // +k8s:defaulter-gen=TypeMeta +// +k8s:openapi-gen=true package v1alpha1 diff --git a/pkg/apis/meta/v1alpha1/doc.go b/pkg/apis/meta/v1alpha1/doc.go index 30f47fcdd..c24797914 100644 --- a/pkg/apis/meta/v1alpha1/doc.go +++ b/pkg/apis/meta/v1alpha1/doc.go @@ -1,2 +1,3 @@ // +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true package v1alpha1