Merge pull request #116039 from liggitt/crd-compat

Add CRD compatibility fixtures
This commit is contained in:
Kubernetes Prow Robot 2023-02-27 14:55:16 -08:00 committed by GitHub
commit 36402f2833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 1208 additions and 51 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"},
},
},
}

View File

@ -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

View File

@ -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

View File

@ -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)
}

View File

@ -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
}
}
}

View File

@ -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

View File

@ -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"
]
}
}

View File

@ -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:
- <no json tag> 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

View File

@ -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
}
}
}

View File

@ -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

View File

@ -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"
]
}
}

View File

@ -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:
- <no json tag> 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:
- <no json tag> 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

View File

@ -0,0 +1,3 @@
# API serialization compatibility tests
This directory tree contains serialized API objects in json, yaml, and protobuf formats.

View File

@ -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"},
},
},
}

View File

@ -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 = "<no json tag> " + field.Name

View File

@ -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"`

View File

@ -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"},
},
},
}

View File

@ -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"},
},
},
}

View File

@ -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"},
},
},
}