diff --git a/go.mod b/go.mod index 59ffe57291c..3be33cf3ab8 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/ghodss/yaml v1.0.1-0.20180820084758-c7ce16629ff4 github.com/go-logr/logr v0.1.0 github.com/go-logr/zapr v0.1.1 + github.com/go-openapi/spec v0.19.0 github.com/gobuffalo/packr v1.30.1 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/huandu/xstrings v1.2.0 // indirect diff --git a/test/test-framework/deploy/crds/cache.example.com_memcachedrs_crd.yaml b/test/test-framework/deploy/crds/cache.example.com_memcachedrs_crd.yaml index 817d21e5025..9ffb3fab46d 100644 --- a/test/test-framework/deploy/crds/cache.example.com_memcachedrs_crd.yaml +++ b/test/test-framework/deploy/crds/cache.example.com_memcachedrs_crd.yaml @@ -14,20 +14,22 @@ spec: status: {} validation: openAPIV3Schema: + description: MemcachedRS is the Schema for the memcachedrs API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string metadata: type: object spec: + description: MemcachedRSSpec defines the desired state of MemcachedRS properties: numNodes: format: int32 @@ -36,6 +38,7 @@ spec: - numNodes type: object status: + description: MemcachedRSStatus defines the observed state of MemcachedRS properties: nodeList: items: @@ -47,6 +50,7 @@ spec: - nodeList - test type: object + type: object version: v1alpha1 versions: - name: v1alpha1 diff --git a/test/test-framework/deploy/crds/cache.example.com_memcacheds_crd.yaml b/test/test-framework/deploy/crds/cache.example.com_memcacheds_crd.yaml index 53bf81fab7a..0109edbab9a 100644 --- a/test/test-framework/deploy/crds/cache.example.com_memcacheds_crd.yaml +++ b/test/test-framework/deploy/crds/cache.example.com_memcacheds_crd.yaml @@ -10,38 +10,48 @@ spec: plural: memcacheds singular: memcached scope: Namespaced + subresources: + status: {} validation: openAPIV3Schema: + description: Memcached is the Schema for the memcacheds API properties: apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string metadata: type: object spec: + description: MemcachedSpec defines the desired state of Memcached properties: size: + description: Size is the size of the memcached deployment format: int32 type: integer - test: - type: string required: - size type: object status: + description: MemcachedStatus defines the observed state of Memcached properties: nodes: + description: Nodes are the names of the memcached pods items: type: string type: array required: - nodes type: object + type: object version: v1alpha1 versions: - name: v1alpha1 served: true storage: true - subresources: - status: {} diff --git a/test/test-framework/pkg/apis/cache/v1alpha1/memcachedrs_types.go b/test/test-framework/pkg/apis/cache/v1alpha1/memcachedrs_types.go index 2fafc0ae329..7f739964447 100644 --- a/test/test-framework/pkg/apis/cache/v1alpha1/memcachedrs_types.go +++ b/test/test-framework/pkg/apis/cache/v1alpha1/memcachedrs_types.go @@ -40,6 +40,7 @@ type MemcachedRSStatus struct { // MemcachedRS is the Schema for the memcachedrs API // +k8s:openapi-gen=true // +kubebuilder:subresource:status +// +kubebuilder:resource:path=memcachedrs,scope=Namespaced type MemcachedRS struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.deepcopy.go b/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.deepcopy.go index 2fb85723fe7..a9a4c89c637 100644 --- a/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.deepcopy.go +++ b/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.deepcopy.go @@ -1,6 +1,6 @@ // +build !ignore_autogenerated -// Code generated by deepcopy-gen. DO NOT EDIT. +// Code generated by operator-sdk. DO NOT EDIT. package v1alpha1 @@ -40,7 +40,7 @@ func (in *Memcached) DeepCopyObject() runtime.Object { func (in *MemcachedList) DeepCopyInto(out *MemcachedList) { *out = *in out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]Memcached, len(*in)) @@ -101,7 +101,7 @@ func (in *MemcachedRS) DeepCopyObject() runtime.Object { func (in *MemcachedRSList) DeepCopyInto(out *MemcachedRSList) { *out = *in out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]MemcachedRS, len(*in)) diff --git a/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.openapi.go b/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.openapi.go new file mode 100644 index 00000000000..e503445714f --- /dev/null +++ b/test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.openapi.go @@ -0,0 +1,221 @@ +// +build !ignore_autogenerated + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package v1alpha1 + +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/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.Memcached": schema_pkg_apis_cache_v1alpha1_Memcached(ref), + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRS": schema_pkg_apis_cache_v1alpha1_MemcachedRS(ref), + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSSpec": schema_pkg_apis_cache_v1alpha1_MemcachedRSSpec(ref), + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSStatus": schema_pkg_apis_cache_v1alpha1_MemcachedRSStatus(ref), + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedSpec": schema_pkg_apis_cache_v1alpha1_MemcachedSpec(ref), + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedStatus": schema_pkg_apis_cache_v1alpha1_MemcachedStatus(ref), + } +} + +func schema_pkg_apis_cache_v1alpha1_Memcached(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Memcached is the Schema for the memcacheds API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedSpec", "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_cache_v1alpha1_MemcachedRS(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MemcachedRS is the Schema for the memcachedrs API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSSpec", "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_cache_v1alpha1_MemcachedRSSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MemcachedRSSpec defines the desired state of MemcachedRS", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "numNodes": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"numNodes"}, + }, + }, + } +} + +func schema_pkg_apis_cache_v1alpha1_MemcachedRSStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MemcachedRSStatus defines the observed state of MemcachedRS", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeList": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "test": { + SchemaProps: spec.SchemaProps{ + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"nodeList", "test"}, + }, + }, + } +} + +func schema_pkg_apis_cache_v1alpha1_MemcachedSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MemcachedSpec defines the desired state of Memcached", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "size": { + SchemaProps: spec.SchemaProps{ + Description: "Size is the size of the memcached deployment", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"size"}, + }, + }, + } +} + +func schema_pkg_apis_cache_v1alpha1_MemcachedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MemcachedStatus defines the observed state of Memcached", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Nodes are the names of the memcached pods", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"nodes"}, + }, + }, + } +}