diff --git a/api/api-rules/aggregator_violation_exceptions.list b/api/api-rules/aggregator_violation_exceptions.list index b2c97b0088d..ceb20f6a7ca 100644 --- a/api/api-rules/aggregator_violation_exceptions.list +++ b/api/api-rules/aggregator_violation_exceptions.list @@ -34,4 +34,3 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType -API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw diff --git a/api/api-rules/apiextensions_violation_exceptions.list b/api/api-rules/apiextensions_violation_exceptions.list index b2c97b0088d..ceb20f6a7ca 100644 --- a/api/api-rules/apiextensions_violation_exceptions.list +++ b/api/api-rules/apiextensions_violation_exceptions.list @@ -34,4 +34,3 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType -API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw diff --git a/api/api-rules/codegen_violation_exceptions.list b/api/api-rules/codegen_violation_exceptions.list index 0a275601e22..be6a9dbe42c 100644 --- a/api/api-rules/codegen_violation_exceptions.list +++ b/api/api-rules/codegen_violation_exceptions.list @@ -34,7 +34,6 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType -API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example/v1,TestTypeStatus,Blah API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example2/v1,TestTypeStatus,Blah API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example3.io/v1,TestTypeStatus,Blah diff --git a/api/api-rules/sample_apiserver_violation_exceptions.list b/api/api-rules/sample_apiserver_violation_exceptions.list index 62a4b8445d3..d6f38f67e89 100644 --- a/api/api-rules/sample_apiserver_violation_exceptions.list +++ b/api/api-rules/sample_apiserver_violation_exceptions.list @@ -35,4 +35,3 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType -API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw diff --git a/api/api-rules/violation_exceptions.list b/api/api-rules/violation_exceptions.list index 6ec3512a578..50fb2b584da 100644 --- a/api/api-rules/violation_exceptions.list +++ b/api/api-rules/violation_exceptions.list @@ -378,7 +378,6 @@ API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,CephFS API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,StorageOS API rule violation: names_match,k8s.io/api/networking/v1alpha1,ClusterCIDRSpec,IPv4 API rule violation: names_match,k8s.io/api/networking/v1alpha1,ClusterCIDRSpec,IPv6 -API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSON,Raw API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,Ref API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,Schema API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XEmbeddedResource @@ -395,7 +394,6 @@ API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiexten API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaPropsOrStringArray,Property API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaPropsOrStringArray,Schema API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,CustomResourceColumnDefinition,JSONPath -API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSON,Raw API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,Ref API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,Schema API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,XEmbeddedResource @@ -426,7 +424,6 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType -API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,IntVal API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,StrVal API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,Type diff --git a/hack/update-generated-api-compatibility-data.sh b/hack/update-generated-api-compatibility-data.sh index 0ad130aa761..3a0a2c51fc6 100755 --- a/hack/update-generated-api-compatibility-data.sh +++ b/hack/update-generated-api-compatibility-data.sh @@ -28,12 +28,15 @@ export GO111MODULE=on # Nuke old files so we don't accidentally carry stuff forward. rm -f staging/src/k8s.io/api/testdata/HEAD/*.{yaml,json,pb} +rm -f staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/*.{yaml,json,pb} # UPDATE_COMPATIBILITY_FIXTURE_DATA=true regenerates fixture data if needed. # -run //HEAD only runs the test cases comparing against testdata for HEAD. # We suppress the output because we are expecting to have changes. # We suppress the test failure that occurs when there are changes. UPDATE_COMPATIBILITY_FIXTURE_DATA=true go test k8s.io/api -run //HEAD >/dev/null 2>&1 || true +UPDATE_COMPATIBILITY_FIXTURE_DATA=true go test k8s.io/apiextensions-apiserver/pkg/apis -run //HEAD >/dev/null 2>&1 || true # Now that we have regenerated data at HEAD, run the test without suppressing output or failures go test k8s.io/api -run //HEAD -count=1 +go test k8s.io/apiextensions-apiserver/pkg/apis -run //HEAD -count=1 diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index c562bb1cd72..af6ddc0ba39 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -49360,13 +49360,6 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) Format: "", }, }, - "Raw": { - SchemaProps: spec.SchemaProps{ - Description: "Raw will hold the complete serialized object which couldn't be matched with a registered type. Most likely, nothing should be done with this except for passing it through the system.", - Type: []string{"string"}, - Format: "byte", - }, - }, "ContentEncoding": { SchemaProps: spec.SchemaProps{ Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", @@ -49384,7 +49377,7 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) }, }, }, - Required: []string{"Raw", "ContentEncoding", "ContentType"}, + Required: []string{"ContentEncoding", "ContentType"}, }, }, } diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types_jsonschema.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types_jsonschema.go index 277fd7a124a..267a1ab5176 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types_jsonschema.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types_jsonschema.go @@ -240,7 +240,7 @@ type ValidationRule struct { // JSON represents any valid JSON value. // These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil. type JSON struct { - Raw []byte `protobuf:"bytes,1,opt,name=raw"` + Raw []byte `json:"-" protobuf:"bytes,1,opt,name=raw"` } // OpenAPISchemaType is used by the kube-openapi generator when constructing diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types_jsonschema.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types_jsonschema.go index c9d943c9a8a..5de82eb3890 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types_jsonschema.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types_jsonschema.go @@ -240,7 +240,7 @@ type ValidationRule struct { // JSON represents any valid JSON value. // These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil. type JSON struct { - Raw []byte `protobuf:"bytes,1,opt,name=raw"` + Raw []byte `json:"-" protobuf:"bytes,1,opt,name=raw"` } // OpenAPISchemaType is used by the kube-openapi generator when constructing diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/roundtrip_test.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/roundtrip_test.go new file mode 100644 index 00000000000..d01e6dae0f0 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/roundtrip_test.go @@ -0,0 +1,69 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package api + +import ( + "reflect" + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + apiextensionv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiextensionv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + "k8s.io/apimachinery/pkg/api/apitesting/roundtrip" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + _ "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var groups = []runtime.SchemeBuilder{ + apiextensionv1.SchemeBuilder, + apiextensionv1beta1.SchemeBuilder, +} + +func TestCompatibility(t *testing.T) { + scheme := runtime.NewScheme() + for _, builder := range groups { + require.NoError(t, builder.AddToScheme(scheme)) + } + + opts := roundtrip.NewCompatibilityTestOptions(scheme) + + // Fill unstructured JSON field types + opts.FillFuncs = map[reflect.Type]roundtrip.FillFunc{ + reflect.TypeOf(&apiextensionv1.JSON{}): func(s string, i int, obj interface{}) { + obj.(*apiextensionv1.JSON).Raw = []byte(strconv.Quote(s + "Value")) + }, + reflect.TypeOf(&apiextensionv1beta1.JSON{}): func(s string, i int, obj interface{}) { + obj.(*apiextensionv1beta1.JSON).Raw = []byte(strconv.Quote(s + "Value")) + }, + } + + opts.Complete(t) + + // limit to types in apiextensions.k8s.io + filteredKinds := []schema.GroupVersionKind{} + for _, gvk := range opts.Kinds { + if gvk.Group == apiextensionv1.SchemeGroupVersion.Group { + filteredKinds = append(filteredKinds, gvk) + } + } + opts.Kinds = filteredKinds + + opts.Run(t) +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.json b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.json new file mode 100644 index 00000000000..89434644605 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.json @@ -0,0 +1,61 @@ +{ + "kind": "ConversionReview", + "apiVersion": "apiextensions.k8s.io/v1", + "request": { + "uid": "uidValue", + "desiredAPIVersion": "desiredAPIVersionValue", + "objects": [ + { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + } + ] + }, + "response": { + "uid": "uidValue", + "convertedObjects": [ + { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + } + ], + "result": { + "metadata": { + "selfLink": "selfLinkValue", + "resourceVersion": "resourceVersionValue", + "continue": "continueValue", + "remainingItemCount": 4 + }, + "status": "statusValue", + "message": "messageValue", + "reason": "reasonValue", + "details": { + "name": "nameValue", + "group": "groupValue", + "kind": "kindValue", + "uid": "uidValue", + "causes": [ + { + "reason": "reasonValue", + "message": "messageValue", + "field": "fieldValue" + } + ], + "retryAfterSeconds": 5 + }, + "code": 6 + } + } +} \ No newline at end of file diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.pb b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.pb new file mode 100644 index 00000000000..0f2e34ade0b Binary files /dev/null and b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.pb differ diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.yaml b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.yaml new file mode 100644 index 00000000000..5e2bf422a3c --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.ConversionReview.yaml @@ -0,0 +1,41 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: ConversionReview +request: + desiredAPIVersion: desiredAPIVersionValue + objects: + - apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + uid: uidValue +response: + convertedObjects: + - apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + result: + code: 6 + details: + causes: + - field: fieldValue + message: messageValue + reason: reasonValue + group: groupValue + kind: kindValue + name: nameValue + retryAfterSeconds: 5 + uid: uidValue + message: messageValue + metadata: + continue: continueValue + remainingItemCount: 4 + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + reason: reasonValue + status: statusValue + uid: uidValue diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.json b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.json new file mode 100644 index 00000000000..ab9b3fe9b02 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.json @@ -0,0 +1,213 @@ +{ + "kind": "CustomResourceDefinition", + "apiVersion": "apiextensions.k8s.io/v1", + "metadata": { + "name": "nameValue", + "generateName": "generateNameValue", + "namespace": "namespaceValue", + "selfLink": "selfLinkValue", + "uid": "uidValue", + "resourceVersion": "resourceVersionValue", + "generation": 7, + "creationTimestamp": "2008-01-01T01:01:01Z", + "deletionTimestamp": "2009-01-01T01:01:01Z", + "deletionGracePeriodSeconds": 10, + "labels": { + "labelsKey": "labelsValue" + }, + "annotations": { + "annotationsKey": "annotationsValue" + }, + "ownerReferences": [ + { + "apiVersion": "apiVersionValue", + "kind": "kindValue", + "name": "nameValue", + "uid": "uidValue", + "controller": true, + "blockOwnerDeletion": true + } + ], + "finalizers": [ + "finalizersValue" + ], + "managedFields": [ + { + "manager": "managerValue", + "operation": "operationValue", + "apiVersion": "apiVersionValue", + "time": "2004-01-01T01:01:01Z", + "fieldsType": "fieldsTypeValue", + "fieldsV1": {}, + "subresource": "subresourceValue" + } + ] + }, + "spec": { + "group": "groupValue", + "names": { + "plural": "pluralValue", + "singular": "singularValue", + "shortNames": [ + "shortNamesValue" + ], + "kind": "kindValue", + "listKind": "listKindValue", + "categories": [ + "categoriesValue" + ] + }, + "scope": "scopeValue", + "versions": [ + { + "name": "nameValue", + "served": true, + "storage": true, + "deprecated": true, + "deprecationWarning": "deprecationWarningValue", + "schema": { + "openAPIV3Schema": { + "id": "idValue", + "$schema": "$schemaValue", + "$ref": "$refValue", + "description": "descriptionValue", + "type": "typeValue", + "format": "formatValue", + "title": "titleValue", + "default": "defaultValue", + "maximum": 9.5, + "exclusiveMaximum": true, + "minimum": 11.5, + "exclusiveMinimum": true, + "maxLength": 13, + "minLength": 14, + "pattern": "patternValue", + "maxItems": 16, + "minItems": 17, + "uniqueItems": true, + "multipleOf": 19.5, + "enum": [ + "enumValue" + ], + "maxProperties": 21, + "minProperties": 22, + "required": [ + "requiredValue" + ], + "items": [ + {} + ], + "allOf": [ + {} + ], + "oneOf": [ + {} + ], + "anyOf": [ + {} + ], + "properties": { + "propertiesKey": {} + }, + "additionalProperties": true, + "patternProperties": { + "patternPropertiesKey": {} + }, + "dependencies": { + "dependenciesKey": [ + "\u003cno json tag\u003e PropertyValue" + ] + }, + "additionalItems": true, + "definitions": { + "definitionsKey": {} + }, + "externalDocs": { + "description": "descriptionValue", + "url": "urlValue" + }, + "example": "exampleValue", + "nullable": true, + "x-kubernetes-preserve-unknown-fields": true, + "x-kubernetes-embedded-resource": true, + "x-kubernetes-int-or-string": true, + "x-kubernetes-list-map-keys": [ + "x-kubernetes-list-map-keysValue" + ], + "x-kubernetes-list-type": "x-kubernetes-list-typeValue", + "x-kubernetes-map-type": "x-kubernetes-map-typeValue", + "x-kubernetes-validations": [ + { + "rule": "ruleValue", + "message": "messageValue" + } + ] + } + }, + "subresources": { + "status": {}, + "scale": { + "specReplicasPath": "specReplicasPathValue", + "statusReplicasPath": "statusReplicasPathValue", + "labelSelectorPath": "labelSelectorPathValue" + } + }, + "additionalPrinterColumns": [ + { + "name": "nameValue", + "type": "typeValue", + "format": "formatValue", + "description": "descriptionValue", + "priority": 5, + "jsonPath": "jsonPathValue" + } + ] + } + ], + "conversion": { + "strategy": "strategyValue", + "webhook": { + "clientConfig": { + "url": "urlValue", + "service": { + "namespace": "namespaceValue", + "name": "nameValue", + "path": "pathValue", + "port": 4 + }, + "caBundle": "Ag==" + }, + "conversionReviewVersions": [ + "conversionReviewVersionsValue" + ] + } + }, + "preserveUnknownFields": true + }, + "status": { + "conditions": [ + { + "type": "typeValue", + "status": "statusValue", + "lastTransitionTime": "2003-01-01T01:01:01Z", + "reason": "reasonValue", + "message": "messageValue" + } + ], + "acceptedNames": { + "plural": "pluralValue", + "singular": "singularValue", + "shortNames": [ + "shortNamesValue" + ], + "kind": "kindValue", + "listKind": "listKindValue", + "categories": [ + "categoriesValue" + ] + }, + "storedVersions": [ + "storedVersionsValue" + ] + } +} \ No newline at end of file diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.pb b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.pb new file mode 100644 index 00000000000..7c9b481ccba Binary files /dev/null and b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.pb differ diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.yaml b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.yaml new file mode 100644 index 00000000000..a2c640d3642 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1.CustomResourceDefinition.yaml @@ -0,0 +1,158 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue +spec: + conversion: + strategy: strategyValue + webhook: + clientConfig: + caBundle: Ag== + service: + name: nameValue + namespace: namespaceValue + path: pathValue + port: 4 + url: urlValue + conversionReviewVersions: + - conversionReviewVersionsValue + group: groupValue + names: + categories: + - categoriesValue + kind: kindValue + listKind: listKindValue + plural: pluralValue + shortNames: + - shortNamesValue + singular: singularValue + preserveUnknownFields: true + scope: scopeValue + versions: + - additionalPrinterColumns: + - description: descriptionValue + format: formatValue + jsonPath: jsonPathValue + name: nameValue + priority: 5 + type: typeValue + deprecated: true + deprecationWarning: deprecationWarningValue + name: nameValue + schema: + openAPIV3Schema: + $ref: $refValue + $schema: $schemaValue + additionalItems: true + additionalProperties: true + allOf: + - {} + anyOf: + - {} + default: defaultValue + definitions: + definitionsKey: {} + dependencies: + dependenciesKey: + - PropertyValue + description: descriptionValue + enum: + - enumValue + example: exampleValue + exclusiveMaximum: true + exclusiveMinimum: true + externalDocs: + description: descriptionValue + url: urlValue + format: formatValue + id: idValue + items: + - {} + maxItems: 16 + maxLength: 13 + maxProperties: 21 + maximum: 9.5 + minItems: 17 + minLength: 14 + minProperties: 22 + minimum: 11.5 + multipleOf: 19.5 + nullable: true + oneOf: + - {} + pattern: patternValue + patternProperties: + patternPropertiesKey: {} + properties: + propertiesKey: {} + required: + - requiredValue + title: titleValue + type: typeValue + uniqueItems: true + x-kubernetes-embedded-resource: true + x-kubernetes-int-or-string: true + x-kubernetes-list-map-keys: + - x-kubernetes-list-map-keysValue + x-kubernetes-list-type: x-kubernetes-list-typeValue + x-kubernetes-map-type: x-kubernetes-map-typeValue + x-kubernetes-preserve-unknown-fields: true + x-kubernetes-validations: + - message: messageValue + rule: ruleValue + served: true + storage: true + subresources: + scale: + labelSelectorPath: labelSelectorPathValue + specReplicasPath: specReplicasPathValue + statusReplicasPath: statusReplicasPathValue + status: {} +status: + acceptedNames: + categories: + - categoriesValue + kind: kindValue + listKind: listKindValue + plural: pluralValue + shortNames: + - shortNamesValue + singular: singularValue + conditions: + - lastTransitionTime: "2003-01-01T01:01:01Z" + message: messageValue + reason: reasonValue + status: statusValue + type: typeValue + storedVersions: + - storedVersionsValue diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.json b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.json new file mode 100644 index 00000000000..2b129c4e550 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.json @@ -0,0 +1,61 @@ +{ + "kind": "ConversionReview", + "apiVersion": "apiextensions.k8s.io/v1beta1", + "request": { + "uid": "uidValue", + "desiredAPIVersion": "desiredAPIVersionValue", + "objects": [ + { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + } + ] + }, + "response": { + "uid": "uidValue", + "convertedObjects": [ + { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + } + ], + "result": { + "metadata": { + "selfLink": "selfLinkValue", + "resourceVersion": "resourceVersionValue", + "continue": "continueValue", + "remainingItemCount": 4 + }, + "status": "statusValue", + "message": "messageValue", + "reason": "reasonValue", + "details": { + "name": "nameValue", + "group": "groupValue", + "kind": "kindValue", + "uid": "uidValue", + "causes": [ + { + "reason": "reasonValue", + "message": "messageValue", + "field": "fieldValue" + } + ], + "retryAfterSeconds": 5 + }, + "code": 6 + } + } +} \ No newline at end of file diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.pb b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.pb new file mode 100644 index 00000000000..e7acab7bf0e Binary files /dev/null and b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.pb differ diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.yaml b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.yaml new file mode 100644 index 00000000000..63529664306 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.ConversionReview.yaml @@ -0,0 +1,41 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: ConversionReview +request: + desiredAPIVersion: desiredAPIVersionValue + objects: + - apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + uid: uidValue +response: + convertedObjects: + - apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + result: + code: 6 + details: + causes: + - field: fieldValue + message: messageValue + reason: reasonValue + group: groupValue + kind: kindValue + name: nameValue + retryAfterSeconds: 5 + uid: uidValue + message: messageValue + metadata: + continue: continueValue + remainingItemCount: 4 + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + reason: reasonValue + status: statusValue + uid: uidValue diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.json b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.json new file mode 100644 index 00000000000..e9dae99bae8 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.json @@ -0,0 +1,309 @@ +{ + "kind": "CustomResourceDefinition", + "apiVersion": "apiextensions.k8s.io/v1beta1", + "metadata": { + "name": "nameValue", + "generateName": "generateNameValue", + "namespace": "namespaceValue", + "selfLink": "selfLinkValue", + "uid": "uidValue", + "resourceVersion": "resourceVersionValue", + "generation": 7, + "creationTimestamp": "2008-01-01T01:01:01Z", + "deletionTimestamp": "2009-01-01T01:01:01Z", + "deletionGracePeriodSeconds": 10, + "labels": { + "labelsKey": "labelsValue" + }, + "annotations": { + "annotationsKey": "annotationsValue" + }, + "ownerReferences": [ + { + "apiVersion": "apiVersionValue", + "kind": "kindValue", + "name": "nameValue", + "uid": "uidValue", + "controller": true, + "blockOwnerDeletion": true + } + ], + "finalizers": [ + "finalizersValue" + ], + "managedFields": [ + { + "manager": "managerValue", + "operation": "operationValue", + "apiVersion": "apiVersionValue", + "time": "2004-01-01T01:01:01Z", + "fieldsType": "fieldsTypeValue", + "fieldsV1": {}, + "subresource": "subresourceValue" + } + ] + }, + "spec": { + "group": "groupValue", + "version": "versionValue", + "names": { + "plural": "pluralValue", + "singular": "singularValue", + "shortNames": [ + "shortNamesValue" + ], + "kind": "kindValue", + "listKind": "listKindValue", + "categories": [ + "categoriesValue" + ] + }, + "scope": "scopeValue", + "validation": { + "openAPIV3Schema": { + "id": "idValue", + "$schema": "$schemaValue", + "$ref": "$refValue", + "description": "descriptionValue", + "type": "typeValue", + "format": "formatValue", + "title": "titleValue", + "default": "defaultValue", + "maximum": 9.5, + "exclusiveMaximum": true, + "minimum": 11.5, + "exclusiveMinimum": true, + "maxLength": 13, + "minLength": 14, + "pattern": "patternValue", + "maxItems": 16, + "minItems": 17, + "uniqueItems": true, + "multipleOf": 19.5, + "enum": [ + "enumValue" + ], + "maxProperties": 21, + "minProperties": 22, + "required": [ + "requiredValue" + ], + "items": [ + {} + ], + "allOf": [ + {} + ], + "oneOf": [ + {} + ], + "anyOf": [ + {} + ], + "properties": { + "propertiesKey": {} + }, + "additionalProperties": true, + "patternProperties": { + "patternPropertiesKey": {} + }, + "dependencies": { + "dependenciesKey": [ + "\u003cno json tag\u003e PropertyValue" + ] + }, + "additionalItems": true, + "definitions": { + "definitionsKey": {} + }, + "externalDocs": { + "description": "descriptionValue", + "url": "urlValue" + }, + "example": "exampleValue", + "nullable": true, + "x-kubernetes-preserve-unknown-fields": true, + "x-kubernetes-embedded-resource": true, + "x-kubernetes-int-or-string": true, + "x-kubernetes-list-map-keys": [ + "x-kubernetes-list-map-keysValue" + ], + "x-kubernetes-list-type": "x-kubernetes-list-typeValue", + "x-kubernetes-map-type": "x-kubernetes-map-typeValue", + "x-kubernetes-validations": [ + { + "rule": "ruleValue", + "message": "messageValue" + } + ] + } + }, + "subresources": { + "status": {}, + "scale": { + "specReplicasPath": "specReplicasPathValue", + "statusReplicasPath": "statusReplicasPathValue", + "labelSelectorPath": "labelSelectorPathValue" + } + }, + "versions": [ + { + "name": "nameValue", + "served": true, + "storage": true, + "deprecated": true, + "deprecationWarning": "deprecationWarningValue", + "schema": { + "openAPIV3Schema": { + "id": "idValue", + "$schema": "$schemaValue", + "$ref": "$refValue", + "description": "descriptionValue", + "type": "typeValue", + "format": "formatValue", + "title": "titleValue", + "default": "defaultValue", + "maximum": 9.5, + "exclusiveMaximum": true, + "minimum": 11.5, + "exclusiveMinimum": true, + "maxLength": 13, + "minLength": 14, + "pattern": "patternValue", + "maxItems": 16, + "minItems": 17, + "uniqueItems": true, + "multipleOf": 19.5, + "enum": [ + "enumValue" + ], + "maxProperties": 21, + "minProperties": 22, + "required": [ + "requiredValue" + ], + "items": [ + {} + ], + "allOf": [ + {} + ], + "oneOf": [ + {} + ], + "anyOf": [ + {} + ], + "properties": { + "propertiesKey": {} + }, + "additionalProperties": true, + "patternProperties": { + "patternPropertiesKey": {} + }, + "dependencies": { + "dependenciesKey": [ + "\u003cno json tag\u003e PropertyValue" + ] + }, + "additionalItems": true, + "definitions": { + "definitionsKey": {} + }, + "externalDocs": { + "description": "descriptionValue", + "url": "urlValue" + }, + "example": "exampleValue", + "nullable": true, + "x-kubernetes-preserve-unknown-fields": true, + "x-kubernetes-embedded-resource": true, + "x-kubernetes-int-or-string": true, + "x-kubernetes-list-map-keys": [ + "x-kubernetes-list-map-keysValue" + ], + "x-kubernetes-list-type": "x-kubernetes-list-typeValue", + "x-kubernetes-map-type": "x-kubernetes-map-typeValue", + "x-kubernetes-validations": [ + { + "rule": "ruleValue", + "message": "messageValue" + } + ] + } + }, + "subresources": { + "status": {}, + "scale": { + "specReplicasPath": "specReplicasPathValue", + "statusReplicasPath": "statusReplicasPathValue", + "labelSelectorPath": "labelSelectorPathValue" + } + }, + "additionalPrinterColumns": [ + { + "name": "nameValue", + "type": "typeValue", + "format": "formatValue", + "description": "descriptionValue", + "priority": 5, + "JSONPath": "JSONPathValue" + } + ] + } + ], + "additionalPrinterColumns": [ + { + "name": "nameValue", + "type": "typeValue", + "format": "formatValue", + "description": "descriptionValue", + "priority": 5, + "JSONPath": "JSONPathValue" + } + ], + "conversion": { + "strategy": "strategyValue", + "webhookClientConfig": { + "url": "urlValue", + "service": { + "namespace": "namespaceValue", + "name": "nameValue", + "path": "pathValue", + "port": 4 + }, + "caBundle": "Ag==" + }, + "conversionReviewVersions": [ + "conversionReviewVersionsValue" + ] + }, + "preserveUnknownFields": true + }, + "status": { + "conditions": [ + { + "type": "typeValue", + "status": "statusValue", + "lastTransitionTime": "2003-01-01T01:01:01Z", + "reason": "reasonValue", + "message": "messageValue" + } + ], + "acceptedNames": { + "plural": "pluralValue", + "singular": "singularValue", + "shortNames": [ + "shortNamesValue" + ], + "kind": "kindValue", + "listKind": "listKindValue", + "categories": [ + "categoriesValue" + ] + }, + "storedVersions": [ + "storedVersionsValue" + ] + } +} \ No newline at end of file diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.pb b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.pb new file mode 100644 index 00000000000..4116117b177 Binary files /dev/null and b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.pb differ diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.yaml b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.yaml new file mode 100644 index 00000000000..57fbdacb269 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/HEAD/apiextensions.k8s.io.v1beta1.CustomResourceDefinition.yaml @@ -0,0 +1,232 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue +spec: + additionalPrinterColumns: + - JSONPath: JSONPathValue + description: descriptionValue + format: formatValue + name: nameValue + priority: 5 + type: typeValue + conversion: + conversionReviewVersions: + - conversionReviewVersionsValue + strategy: strategyValue + webhookClientConfig: + caBundle: Ag== + service: + name: nameValue + namespace: namespaceValue + path: pathValue + port: 4 + url: urlValue + group: groupValue + names: + categories: + - categoriesValue + kind: kindValue + listKind: listKindValue + plural: pluralValue + shortNames: + - shortNamesValue + singular: singularValue + preserveUnknownFields: true + scope: scopeValue + subresources: + scale: + labelSelectorPath: labelSelectorPathValue + specReplicasPath: specReplicasPathValue + statusReplicasPath: statusReplicasPathValue + status: {} + validation: + openAPIV3Schema: + $ref: $refValue + $schema: $schemaValue + additionalItems: true + additionalProperties: true + allOf: + - {} + anyOf: + - {} + default: defaultValue + definitions: + definitionsKey: {} + dependencies: + dependenciesKey: + - PropertyValue + description: descriptionValue + enum: + - enumValue + example: exampleValue + exclusiveMaximum: true + exclusiveMinimum: true + externalDocs: + description: descriptionValue + url: urlValue + format: formatValue + id: idValue + items: + - {} + maxItems: 16 + maxLength: 13 + maxProperties: 21 + maximum: 9.5 + minItems: 17 + minLength: 14 + minProperties: 22 + minimum: 11.5 + multipleOf: 19.5 + nullable: true + oneOf: + - {} + pattern: patternValue + patternProperties: + patternPropertiesKey: {} + properties: + propertiesKey: {} + required: + - requiredValue + title: titleValue + type: typeValue + uniqueItems: true + x-kubernetes-embedded-resource: true + x-kubernetes-int-or-string: true + x-kubernetes-list-map-keys: + - x-kubernetes-list-map-keysValue + x-kubernetes-list-type: x-kubernetes-list-typeValue + x-kubernetes-map-type: x-kubernetes-map-typeValue + x-kubernetes-preserve-unknown-fields: true + x-kubernetes-validations: + - message: messageValue + rule: ruleValue + version: versionValue + versions: + - additionalPrinterColumns: + - JSONPath: JSONPathValue + description: descriptionValue + format: formatValue + name: nameValue + priority: 5 + type: typeValue + deprecated: true + deprecationWarning: deprecationWarningValue + name: nameValue + schema: + openAPIV3Schema: + $ref: $refValue + $schema: $schemaValue + additionalItems: true + additionalProperties: true + allOf: + - {} + anyOf: + - {} + default: defaultValue + definitions: + definitionsKey: {} + dependencies: + dependenciesKey: + - PropertyValue + description: descriptionValue + enum: + - enumValue + example: exampleValue + exclusiveMaximum: true + exclusiveMinimum: true + externalDocs: + description: descriptionValue + url: urlValue + format: formatValue + id: idValue + items: + - {} + maxItems: 16 + maxLength: 13 + maxProperties: 21 + maximum: 9.5 + minItems: 17 + minLength: 14 + minProperties: 22 + minimum: 11.5 + multipleOf: 19.5 + nullable: true + oneOf: + - {} + pattern: patternValue + patternProperties: + patternPropertiesKey: {} + properties: + propertiesKey: {} + required: + - requiredValue + title: titleValue + type: typeValue + uniqueItems: true + x-kubernetes-embedded-resource: true + x-kubernetes-int-or-string: true + x-kubernetes-list-map-keys: + - x-kubernetes-list-map-keysValue + x-kubernetes-list-type: x-kubernetes-list-typeValue + x-kubernetes-map-type: x-kubernetes-map-typeValue + x-kubernetes-preserve-unknown-fields: true + x-kubernetes-validations: + - message: messageValue + rule: ruleValue + served: true + storage: true + subresources: + scale: + labelSelectorPath: labelSelectorPathValue + specReplicasPath: specReplicasPathValue + statusReplicasPath: statusReplicasPathValue + status: {} +status: + acceptedNames: + categories: + - categoriesValue + kind: kindValue + listKind: listKindValue + plural: pluralValue + shortNames: + - shortNamesValue + singular: singularValue + conditions: + - lastTransitionTime: "2003-01-01T01:01:01Z" + message: messageValue + reason: reasonValue + status: statusValue + type: typeValue + storedVersions: + - storedVersionsValue diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/README.md b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/README.md new file mode 100644 index 00000000000..9755fa574c9 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/testdata/README.md @@ -0,0 +1,3 @@ +# API serialization compatibility tests + +This directory tree contains serialized API objects in json, yaml, and protobuf formats. \ No newline at end of file diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go index ace92750b31..16e0813f01b 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go @@ -3357,13 +3357,6 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) Format: "", }, }, - "Raw": { - SchemaProps: spec.SchemaProps{ - Description: "Raw will hold the complete serialized object which couldn't be matched with a registered type. Most likely, nothing should be done with this except for passing it through the system.", - Type: []string{"string"}, - Format: "byte", - }, - }, "ContentEncoding": { SchemaProps: spec.SchemaProps{ Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", @@ -3381,7 +3374,7 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) }, }, }, - Required: []string{"Raw", "ContentEncoding", "ContentType"}, + Required: []string{"ContentEncoding", "ContentType"}, }, }, } diff --git a/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go b/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go index ea18af12730..4ca7f6c5a0b 100644 --- a/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go +++ b/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go @@ -110,7 +110,11 @@ func fill(dataString string, dataInt int, t reflect.Type, v reflect.Value, fillF // populate with a single-item slice v.Set(reflect.MakeSlice(t, 1, 1)) // recurse to populate the item, preserving the data context - fill(dataString, dataInt, t.Elem(), v.Index(0), fillFuncs, filledTypes) + if t.Elem().Kind() == reflect.Pointer { + fill(dataString, dataInt, t.Elem(), v.Index(0), fillFuncs, filledTypes) + } else { + fill(dataString, dataInt, reflect.PointerTo(t.Elem()), v.Index(0).Addr(), fillFuncs, filledTypes) + } case reflect.Map: // construct the key, which must be a string type, possibly converted to a type alias of string @@ -133,6 +137,10 @@ func fill(dataString string, dataInt int, t reflect.Type, v reflect.Value, fillF // use the json field name, which must be stable dataString := strings.Split(field.Tag.Get("json"), ",")[0] + if dataString == "-" { + // unserialized field, no need to fill it + continue + } if len(dataString) == 0 { // fall back to the struct field name if there is no json field name dataString = " " + field.Name diff --git a/staging/src/k8s.io/apimachinery/pkg/runtime/types.go b/staging/src/k8s.io/apimachinery/pkg/runtime/types.go index 3dc9a5a2f2a..ce77c7910a9 100644 --- a/staging/src/k8s.io/apimachinery/pkg/runtime/types.go +++ b/staging/src/k8s.io/apimachinery/pkg/runtime/types.go @@ -123,7 +123,7 @@ type Unknown struct { // Raw will hold the complete serialized object which couldn't be matched // with a registered type. Most likely, nothing should be done with this // except for passing it through the system. - Raw []byte `protobuf:"bytes,2,opt,name=raw"` + Raw []byte `json:"-" protobuf:"bytes,2,opt,name=raw"` // ContentEncoding is encoding used to encode 'Raw' data. // Unspecified means no encoding. ContentEncoding string `protobuf:"bytes,3,opt,name=contentEncoding"` diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go b/staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go index cc979344454..9c3b8b516ff 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go @@ -2418,13 +2418,6 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) Format: "", }, }, - "Raw": { - SchemaProps: spec.SchemaProps{ - Description: "Raw will hold the complete serialized object which couldn't be matched with a registered type. Most likely, nothing should be done with this except for passing it through the system.", - Type: []string{"string"}, - Format: "byte", - }, - }, "ContentEncoding": { SchemaProps: spec.SchemaProps{ Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", @@ -2442,7 +2435,7 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) }, }, }, - Required: []string{"Raw", "ContentEncoding", "ContentType"}, + Required: []string{"ContentEncoding", "ContentType"}, }, }, } diff --git a/staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go b/staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go index 3414948e996..4ce4bed05ab 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go +++ b/staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go @@ -2421,13 +2421,6 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) Format: "", }, }, - "Raw": { - SchemaProps: spec.SchemaProps{ - Description: "Raw will hold the complete serialized object which couldn't be matched with a registered type. Most likely, nothing should be done with this except for passing it through the system.", - Type: []string{"string"}, - Format: "byte", - }, - }, "ContentEncoding": { SchemaProps: spec.SchemaProps{ Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", @@ -2445,7 +2438,7 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) }, }, }, - Required: []string{"Raw", "ContentEncoding", "ContentType"}, + Required: []string{"ContentEncoding", "ContentType"}, }, }, } diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go index 42dd6391601..d9b808712b3 100644 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go +++ b/staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go @@ -2419,13 +2419,6 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) Format: "", }, }, - "Raw": { - SchemaProps: spec.SchemaProps{ - Description: "Raw will hold the complete serialized object which couldn't be matched with a registered type. Most likely, nothing should be done with this except for passing it through the system.", - Type: []string{"string"}, - Format: "byte", - }, - }, "ContentEncoding": { SchemaProps: spec.SchemaProps{ Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", @@ -2443,7 +2436,7 @@ func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) }, }, }, - Required: []string{"Raw", "ContentEncoding", "ContentType"}, + Required: []string{"ContentEncoding", "ContentType"}, }, }, }