mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-31 14:44:50 +00:00
Merge pull request #65256 from liggitt/crd-schema-openapi
Automatic merge from submit-queue (batch tested with PRs 65256, 64236, 64919, 64879, 57932). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix CRD OpenAPI schema fixes #65243 depends on https://github.com/kubernetes/kube-openapi/pull/84 without this PR, kubectl complains about creating this CRD with a validation schema (which worked in 1.10): ```yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: resources.mygroup.example.com spec: group: mygroup.example.com version: v1alpha1 scope: Namespaced names: plural: resources singular: resource kind: Kind listKind: KindList validation: openAPIV3Schema: properties: spec: type: array items: type: number ``` > error: error validating "/Users/jliggitt/projects/snippets/crd/crd.yaml": error validating data: [ValidationError(CustomResourceDefinition.spec.validation.openAPIV3Schema.properties.spec.items): unknown field "type" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray, ValidationError(CustomResourceDefinition.spec.validation.openAPIV3Schema.properties.spec.items): missing required field "Schema" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray, ValidationError(CustomResourceDefinition.spec.validation.openAPIV3Schema.properties.spec.items): missing required field "JSONSchemas" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray]; if you choose to ignore these errors, turn validation off with --validate=false that is because the types used to serialize JSONSchema require custom marshaling/unmarshaling, and the OpenAPI generator was not informed of that, so it produced this: ```json { "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray": { "description": "JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps or an array of JSONSchemaProps. Mainly here for serialization purposes.", "required": [ "Schema", "JSONSchemas" ], "properties": { "JSONSchemas": { "type": "array", "items": { "$ref": "#/definitions/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps" } }, "Schema": { "$ref": "#/definitions/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps" } } } } ``` OpenAPI isn't able to represent oneOf/anyOf types correctly currently. Until it can, we definitely shouldn't publish a schema containing required fields which aren't even part of the JSON serialization. This PR implements custom openapi type functions, which omit the properties/required/schema attributes for four specific JSONSchema types. This allows kubectl to continue creating these objects without complaining. /sig api-machinery /assign @sttts ```release-note fixed incorrect OpenAPI schema for CustomResourceDefinition objects ``` Kubernetes-commit: ed6c8b7326bd1a1b845719f4bfb302073a18f03f
This commit is contained in:
102
Godeps/Godeps.json
generated
102
Godeps/Godeps.json
generated
@@ -388,207 +388,207 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
||||
"Rev": "5cb97f8dd690761fe10c1a33b79196c54bc3a965"
|
||||
"Rev": "4b5680bfe1b263cd43815e286098b76c1c9fcb7b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user