apiextensions: move the CRD API types to k8s.io/apiextensions-api

Add the k8s.io/apiextensions-api staging module and move the v1 and
v1beta1 types there. The old packages keep the conversions and alias the
moved identifiers in a generated deprecated.go.
This commit is contained in:
Yongrui Lin committed 2026-10-27 23:12:24 +00:00
1 parent 7f2897a0f4
commit 627c2ac477
54 files changed
+1347 -96

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ find_files() {
\) \
\( -wholename './staging/src/k8s.io/api/*/v*/types.go' \
-o -wholename './staging/src/k8s.io/kube-aggregator/pkg/apis/*/v*/types.go' \
-o -wholename './staging/src/k8s.io/apiextensions-apiserver/pkg/apis/*/v*/types.go' \
-o -wholename './staging/src/k8s.io/apiextensions-api/pkg/apis/*/v*/types.go' \
\)
}
+1 -1
View File
@@ -44,7 +44,7 @@ find_files() {
\) \
\( -wholename './staging/src/k8s.io/api/*/v*/types.go' \
-o -wholename './staging/src/k8s.io/kube-aggregator/pkg/apis/*/v*/types.go' \
-o -wholename './staging/src/k8s.io/apiextensions-apiserver/pkg/apis/*/v*/types.go' \
-o -wholename './staging/src/k8s.io/apiextensions-api/pkg/apis/*/v*/types.go' \
\)
}
+1 -1
View File
@@ -31,7 +31,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
DIRGLOBS=(
"staging/src/k8s.io/api/**/*/doc.go"
"staging/src/k8s.io/kube-aggregator/pkg/apis/**/*/doc.go"
"staging/src/k8s.io/apiextensions-apiserver/pkg/apis/**/*/doc.go"
"staging/src/k8s.io/apiextensions-api/pkg/apis/**/*/doc.go"
)
cd "${KUBE_ROOT}"
+1
View File
@@ -7,6 +7,7 @@ top-level k8s.io repositories.
Repositories currently staged here:
- [`k8s.io/api`](https://github.com/kubernetes/api)
- [`k8s.io/apiextensions-api`](https://github.com/kubernetes/apiextensions-api)
- [`k8s.io/apiextensions-apiserver`](https://github.com/kubernetes/apiextensions-apiserver)
- [`k8s.io/apimachinery`](https://github.com/kubernetes/apimachinery)
- [`k8s.io/apiserver`](https://github.com/kubernetes/apiserver)
@@ -175,9 +175,17 @@
- k8s.io/utils/net
- k8s.io/klog
- baseImportPath: "./staging/src/k8s.io/apiextensions-api"
allowedImports:
- k8s.io/apiextensions-api
- k8s.io/apimachinery
- k8s.io/client-go
- k8s.io/utils
- baseImportPath: "./staging/src/k8s.io/apiextensions-apiserver"
allowedImports:
- k8s.io/api
- k8s.io/apiextensions-api
- k8s.io/apiextensions-apiserver
- k8s.io/apimachinery
- k8s.io/apiserver
+21
View File
@@ -866,6 +866,25 @@ rules:
smoke-test: |
# assumes GO111MODULE=on
go build -mod=mod .
- destination: apiextensions-api
branches:
- name: master
dependencies:
- repository: apimachinery
branch: master
- repository: streaming
branch: master
- repository: api
branch: master
- repository: ktesting
branch: master
- repository: client-go
branch: master
source:
branch: master
dirs:
- staging/src/k8s.io/apiextensions-api
library: true
- destination: apiextensions-apiserver
branches:
- name: master
@@ -888,6 +907,8 @@ rules:
branch: master
- repository: ktesting
branch: master
- repository: apiextensions-api
branch: master
source:
branch: master
dirs:
@@ -0,0 +1,2 @@
Sorry, we do not accept changes directly against this repository. Please see
CONTRIBUTING.md for information on where and how to contribute instead.
@@ -0,0 +1,7 @@
# Contributing guidelines
Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes.
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/apiextensions-api](https://git.k8s.io/kubernetes/staging/src/k8s.io/apiextensions-api) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
@@ -0,0 +1,16 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- deads2k
- sttts
- jpbetz
reviewers:
- deads2k
- sttts
- yue9944882
- jpbetz
- roycaihw
- alexzielenski
- jefftree
labels:
- sig/api-machinery
@@ -0,0 +1,50 @@
> ⚠️ **This is an automatically published [staged repository](https://git.k8s.io/kubernetes/staging#external-repository-staging-area) for Kubernetes**.
> Contributions, including issues and pull requests, should be made to the main Kubernetes repository: [https://github.com/kubernetes/kubernetes](https://github.com/kubernetes/kubernetes).
> This repository is read-only for importing, and not used for direct contributions.
> See [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.
# apiextensions-api
The `apiextensions.k8s.io` API types (`CustomResourceDefinition`, `ConversionReview`)
and their generated clientset, listers, informers and apply configurations.
It only depends on `k8s.io/apimachinery` and `k8s.io/client-go`, so programs that
work with CustomResourceDefinitions don't pull in the server implementation in
[`k8s.io/apiextensions-apiserver`](https://github.com/kubernetes/apiextensions-apiserver).
## Migrating from k8s.io/apiextensions-apiserver
The packages under `k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1`,
`k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1` and
`k8s.io/apiextensions-apiserver/pkg/client` are deprecated aliases of the
packages with the same path in this module. `go fix -inline ./...` rewrites
references to their types, constants and functions. Package-level variables such
as `SchemeGroupVersion` and the clientset's `Scheme` and `Codecs` have to be
updated by hand.
`AddToScheme` and `SchemeBuilder` in this module register the types and their
defaulting functions. The ones in `k8s.io/apiextensions-apiserver` also register
the conversions to the internal version, which only API servers need, so API
servers should keep using those.
## Compatibility
HEAD of this repo will match HEAD of k8s.io/apimachinery and k8s.io/client-go.
## Where does it come from?
`apiextensions-api` is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiextensions-api.
Code changes are made in that location, merged into `k8s.io/kubernetes` and later synced here.
## Community, discussion, contribution, and support
apiextensions-api is maintained by [SIG API Machinery](https://github.com/kubernetes/community/tree/master/sig-api-machinery).
You can reach the maintainers of this project at:
- Slack: [#sig-api-machinery](https://kubernetes.slack.com/messages/sig-api-machinery)
- Mailing List: [kubernetes-sig-api-machinery](https://groups.google.com/a/kubernetes.io/g/sig-api-machinery)
### Code of conduct
Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
@@ -0,0 +1,16 @@
# Defined below are the security contacts for this repo.
#
# They are the contact point for the Product Security Committee to reach out
# to for triaging and handling of incoming issues.
#
# The below names agree to abide by the
# [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy)
# and will be removed and replaced if they violate that agreement.
#
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
# INSTRUCTIONS AT https://kubernetes.io/security/
cheftako
deads2k
lavalamp
sttts
@@ -0,0 +1,3 @@
# Kubernetes Community Code of Conduct
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
@@ -0,0 +1,19 @@
/*
Copyright 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 apiextensionsapi is the root of the k8s.io/apiextensions-api module, which
// contains the apiextensions.k8s.io API types and their generated clients.
package apiextensionsapi
@@ -0,0 +1,11 @@
# See the OWNERS docs at https://go.k8s.io/owners
# Disable inheritance as this is an api owners file
options:
no_parent_owners: true
approvers:
- api-approvers
reviewers:
- api-reviewers
labels:
- kind/api-change
@@ -0,0 +1,27 @@
/*
Copyright 2019 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.
*/
// +k8s:deepcopy-gen=package
// +k8s:protobuf-gen=package
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +k8s:prerelease-lifecycle-gen=true
// +k8s:openapi-model-package=io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1
// +groupName=apiextensions.k8s.io
// Package v1 is the v1 version of the API.
package v1
@@ -26,6 +26,7 @@ import (
var jsTrue = []byte("true")
var jsFalse = []byte("false")
var nullLiteral = []byte(`null`)
// The CBOR parsing related constants and functions below are not exported so they can be
// easily removed at a future date when the CBOR library provides equivalent functionality.
@@ -0,0 +1,62 @@
/*
Copyright 2019 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 v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const GroupName = "apiextensions.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResourceDefinition{},
&CustomResourceDefinitionList{},
&ConversionReview{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addDefaultingFuncs)
}
@@ -0,0 +1,27 @@
/*
Copyright 2017 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.
*/
// +k8s:deepcopy-gen=package
// +k8s:protobuf-gen=package
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +k8s:prerelease-lifecycle-gen=true
// +k8s:openapi-model-package=io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1
// +groupName=apiextensions.k8s.io
// Package v1beta1 is the v1beta1 version of the API.
package v1beta1
@@ -26,6 +26,7 @@ import (
var jsTrue = []byte("true")
var jsFalse = []byte("false")
var nullLiteral = []byte(`null`)
// The CBOR parsing related constants and functions below are not exported so they can be
// easily removed at a future date when the CBOR library provides equivalent functionality.
@@ -0,0 +1,62 @@
/*
Copyright 2017 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 v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const GroupName = "apiextensions.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResourceDefinition{},
&CustomResourceDefinitionList{},
&ConversionReview{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addDefaultingFuncs)
}
@@ -14,6 +14,13 @@ It provides an API for registering `CustomResourceDefinitions`.
This API server provides the implementation for `CustomResourceDefinitions` which is included as
delegate server inside of `kube-apiserver`.
The `apiextensions.k8s.io` API types and their generated clients are published in
[`k8s.io/apiextensions-api`](https://github.com/kubernetes/apiextensions-api), which doesn't depend on
the server libraries. The packages under `pkg/apis/apiextensions/v1`, `pkg/apis/apiextensions/v1beta1`
and `pkg/client` here are deprecated aliases of those, except that `AddToScheme` in
`pkg/apis/apiextensions/v1` and `v1beta1` also registers the conversions to the internal version.
See the [k8s.io/apiextensions-api README](https://github.com/kubernetes/apiextensions-api) for how to migrate.
## Compatibility
@@ -0,0 +1,353 @@
/*
Copyright 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 v1
import (
v1 "k8s.io/apiextensions-api/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConditionStatus instead.
//
//go:fix inline
type ConditionStatus = v1.ConditionStatus
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConversionRequest instead.
//
//go:fix inline
type ConversionRequest = v1.ConversionRequest
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConversionResponse instead.
//
//go:fix inline
type ConversionResponse = v1.ConversionResponse
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConversionReview instead.
//
//go:fix inline
type ConversionReview = v1.ConversionReview
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConversionStrategyType instead.
//
//go:fix inline
type ConversionStrategyType = v1.ConversionStrategyType
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceColumnDefinition instead.
//
//go:fix inline
type CustomResourceColumnDefinition = v1.CustomResourceColumnDefinition
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceConversion instead.
//
//go:fix inline
type CustomResourceConversion = v1.CustomResourceConversion
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinition instead.
//
//go:fix inline
type CustomResourceDefinition = v1.CustomResourceDefinition
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionCondition instead.
//
//go:fix inline
type CustomResourceDefinitionCondition = v1.CustomResourceDefinitionCondition
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionConditionType instead.
//
//go:fix inline
type CustomResourceDefinitionConditionType = v1.CustomResourceDefinitionConditionType
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionList instead.
//
//go:fix inline
type CustomResourceDefinitionList = v1.CustomResourceDefinitionList
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionNames instead.
//
//go:fix inline
type CustomResourceDefinitionNames = v1.CustomResourceDefinitionNames
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionSpec instead.
//
//go:fix inline
type CustomResourceDefinitionSpec = v1.CustomResourceDefinitionSpec
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionStatus instead.
//
//go:fix inline
type CustomResourceDefinitionStatus = v1.CustomResourceDefinitionStatus
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceDefinitionVersion instead.
//
//go:fix inline
type CustomResourceDefinitionVersion = v1.CustomResourceDefinitionVersion
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceSubresourceScale instead.
//
//go:fix inline
type CustomResourceSubresourceScale = v1.CustomResourceSubresourceScale
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceSubresourceStatus instead.
//
//go:fix inline
type CustomResourceSubresourceStatus = v1.CustomResourceSubresourceStatus
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceSubresources instead.
//
//go:fix inline
type CustomResourceSubresources = v1.CustomResourceSubresources
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceValidation instead.
//
//go:fix inline
type CustomResourceValidation = v1.CustomResourceValidation
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ExternalDocumentation instead.
//
//go:fix inline
type ExternalDocumentation = v1.ExternalDocumentation
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.FieldValueErrorReason instead.
//
//go:fix inline
type FieldValueErrorReason = v1.FieldValueErrorReason
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSON instead.
//
//go:fix inline
type JSON = v1.JSON
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaDefinitions instead.
//
//go:fix inline
type JSONSchemaDefinitions = v1.JSONSchemaDefinitions
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaDependencies instead.
//
//go:fix inline
type JSONSchemaDependencies = v1.JSONSchemaDependencies
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaProps instead.
//
//go:fix inline
type JSONSchemaProps = v1.JSONSchemaProps
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaPropsOrArray instead.
//
//go:fix inline
type JSONSchemaPropsOrArray = v1.JSONSchemaPropsOrArray
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaPropsOrBool instead.
//
//go:fix inline
type JSONSchemaPropsOrBool = v1.JSONSchemaPropsOrBool
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaPropsOrStringArray instead.
//
//go:fix inline
type JSONSchemaPropsOrStringArray = v1.JSONSchemaPropsOrStringArray
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.JSONSchemaURL instead.
//
//go:fix inline
type JSONSchemaURL = v1.JSONSchemaURL
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ResourceScope instead.
//
//go:fix inline
type ResourceScope = v1.ResourceScope
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SelectableField instead.
//
//go:fix inline
type SelectableField = v1.SelectableField
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ServiceReference instead.
//
//go:fix inline
type ServiceReference = v1.ServiceReference
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ValidationRule instead.
//
//go:fix inline
type ValidationRule = v1.ValidationRule
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ValidationRules instead.
//
//go:fix inline
type ValidationRules = v1.ValidationRules
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.WebhookClientConfig instead.
//
//go:fix inline
type WebhookClientConfig = v1.WebhookClientConfig
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.WebhookConversion instead.
//
//go:fix inline
type WebhookConversion = v1.WebhookConversion
const (
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ClusterScoped instead.
//
//go:fix inline
ClusterScoped = v1.ClusterScoped
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConditionFalse instead.
//
//go:fix inline
ConditionFalse = v1.ConditionFalse
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConditionTrue instead.
//
//go:fix inline
ConditionTrue = v1.ConditionTrue
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ConditionUnknown instead.
//
//go:fix inline
ConditionUnknown = v1.ConditionUnknown
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.CustomResourceCleanupFinalizer instead.
//
//go:fix inline
CustomResourceCleanupFinalizer = v1.CustomResourceCleanupFinalizer
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.Established instead.
//
//go:fix inline
Established = v1.Established
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.FieldValueDuplicate instead.
//
//go:fix inline
FieldValueDuplicate = v1.FieldValueDuplicate
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.FieldValueForbidden instead.
//
//go:fix inline
FieldValueForbidden = v1.FieldValueForbidden
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.FieldValueInvalid instead.
//
//go:fix inline
FieldValueInvalid = v1.FieldValueInvalid
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.FieldValueRequired instead.
//
//go:fix inline
FieldValueRequired = v1.FieldValueRequired
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.GroupName instead.
//
//go:fix inline
GroupName = v1.GroupName
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.KubeAPIApprovedAnnotation instead.
//
//go:fix inline
KubeAPIApprovedAnnotation = v1.KubeAPIApprovedAnnotation
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.KubernetesAPIApprovalPolicyConformant instead.
//
//go:fix inline
KubernetesAPIApprovalPolicyConformant = v1.KubernetesAPIApprovalPolicyConformant
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.NamesAccepted instead.
//
//go:fix inline
NamesAccepted = v1.NamesAccepted
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.NamespaceScoped instead.
//
//go:fix inline
NamespaceScoped = v1.NamespaceScoped
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.NonStructuralSchema instead.
//
//go:fix inline
NonStructuralSchema = v1.NonStructuralSchema
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.NoneConverter instead.
//
//go:fix inline
NoneConverter = v1.NoneConverter
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.StorageMigrating instead.
//
//go:fix inline
StorageMigrating = v1.StorageMigrating
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.Terminating instead.
//
//go:fix inline
Terminating = v1.Terminating
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.WebhookConverter instead.
//
//go:fix inline
WebhookConverter = v1.WebhookConverter
)
var (
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ErrIntOverflowGenerated instead.
ErrIntOverflowGenerated = v1.ErrIntOverflowGenerated
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ErrInvalidLengthGenerated instead.
ErrInvalidLengthGenerated = v1.ErrInvalidLengthGenerated
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.ErrUnexpectedEndOfGroupGenerated instead.
ErrUnexpectedEndOfGroupGenerated = v1.ErrUnexpectedEndOfGroupGenerated
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SchemeGroupVersion instead.
SchemeGroupVersion = v1.SchemeGroupVersion
)
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.Kind instead.
//
//go:fix inline
func Kind(kind string) schema.GroupKind {
return v1.Kind(kind)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.RegisterDefaults instead.
//
//go:fix inline
func RegisterDefaults(scheme *runtime.Scheme) error {
return v1.RegisterDefaults(scheme)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.Resource instead.
//
//go:fix inline
func Resource(resource string) schema.GroupResource {
return v1.Resource(resource)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SetDefaults_CustomResourceDefinition instead.
//
//go:fix inline
func SetDefaults_CustomResourceDefinition(obj *v1.CustomResourceDefinition) {
v1.SetDefaults_CustomResourceDefinition(obj)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SetDefaults_CustomResourceDefinitionSpec instead.
//
//go:fix inline
func SetDefaults_CustomResourceDefinitionSpec(obj *v1.CustomResourceDefinitionSpec) {
v1.SetDefaults_CustomResourceDefinitionSpec(obj)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SetDefaults_ServiceReference instead.
//
//go:fix inline
func SetDefaults_ServiceReference(obj *v1.ServiceReference) {
v1.SetDefaults_ServiceReference(obj)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SetObjectDefaults_CustomResourceDefinition instead.
//
//go:fix inline
func SetObjectDefaults_CustomResourceDefinition(in *v1.CustomResourceDefinition) {
v1.SetObjectDefaults_CustomResourceDefinition(in)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1.SetObjectDefaults_CustomResourceDefinitionList instead.
//
//go:fix inline
func SetObjectDefaults_CustomResourceDefinitionList(in *v1.CustomResourceDefinitionList) {
v1.SetObjectDefaults_CustomResourceDefinitionList(in)
}
@@ -14,15 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package
// +k8s:protobuf-gen=package
// +k8s:conversion-gen=k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +k8s:prerelease-lifecycle-gen=true
// +k8s:openapi-model-package=io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1
// +k8s:conversion-gen-external-types=k8s.io/apiextensions-api/pkg/apis/apiextensions/v1
// +groupName=apiextensions.k8s.io
// Package v1 is the v1 version of the API.
// Package v1 contains the conversions between the internal apiextensions types
// and k8s.io/apiextensions-api/pkg/apis/apiextensions/v1, and deprecated aliases
// of the identifiers that package had when the types moved there.
package v1
@@ -17,46 +17,16 @@ limitations under the License.
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apiextensions-api/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const GroupName = "apiextensions.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs)
// SchemeBuilder registers the types and defaulting functions of
// k8s.io/apiextensions-api/pkg/apis/apiextensions/v1 and the conversions to the
// internal version. It is separate from that package's builder so that
// importing this package doesn't change what the other one registers.
SchemeBuilder = runtime.NewSchemeBuilder(v1.AddToScheme)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResourceDefinition{},
&CustomResourceDefinitionList{},
&ConversionReview{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addDefaultingFuncs)
}
@@ -0,0 +1,344 @@
/*
Copyright 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 v1beta1
import (
v1beta1 "k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConditionStatus instead.
//
//go:fix inline
type ConditionStatus = v1beta1.ConditionStatus
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConversionRequest instead.
//
//go:fix inline
type ConversionRequest = v1beta1.ConversionRequest
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConversionResponse instead.
//
//go:fix inline
type ConversionResponse = v1beta1.ConversionResponse
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConversionReview instead.
//
//go:fix inline
type ConversionReview = v1beta1.ConversionReview
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConversionStrategyType instead.
//
//go:fix inline
type ConversionStrategyType = v1beta1.ConversionStrategyType
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceColumnDefinition instead.
//
//go:fix inline
type CustomResourceColumnDefinition = v1beta1.CustomResourceColumnDefinition
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceConversion instead.
//
//go:fix inline
type CustomResourceConversion = v1beta1.CustomResourceConversion
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinition instead.
//
//go:fix inline
type CustomResourceDefinition = v1beta1.CustomResourceDefinition
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionCondition instead.
//
//go:fix inline
type CustomResourceDefinitionCondition = v1beta1.CustomResourceDefinitionCondition
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionConditionType instead.
//
//go:fix inline
type CustomResourceDefinitionConditionType = v1beta1.CustomResourceDefinitionConditionType
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionList instead.
//
//go:fix inline
type CustomResourceDefinitionList = v1beta1.CustomResourceDefinitionList
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionNames instead.
//
//go:fix inline
type CustomResourceDefinitionNames = v1beta1.CustomResourceDefinitionNames
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionSpec instead.
//
//go:fix inline
type CustomResourceDefinitionSpec = v1beta1.CustomResourceDefinitionSpec
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionStatus instead.
//
//go:fix inline
type CustomResourceDefinitionStatus = v1beta1.CustomResourceDefinitionStatus
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceDefinitionVersion instead.
//
//go:fix inline
type CustomResourceDefinitionVersion = v1beta1.CustomResourceDefinitionVersion
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceSubresourceScale instead.
//
//go:fix inline
type CustomResourceSubresourceScale = v1beta1.CustomResourceSubresourceScale
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceSubresourceStatus instead.
//
//go:fix inline
type CustomResourceSubresourceStatus = v1beta1.CustomResourceSubresourceStatus
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceSubresources instead.
//
//go:fix inline
type CustomResourceSubresources = v1beta1.CustomResourceSubresources
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceValidation instead.
//
//go:fix inline
type CustomResourceValidation = v1beta1.CustomResourceValidation
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ExternalDocumentation instead.
//
//go:fix inline
type ExternalDocumentation = v1beta1.ExternalDocumentation
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.FieldValueErrorReason instead.
//
//go:fix inline
type FieldValueErrorReason = v1beta1.FieldValueErrorReason
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSON instead.
//
//go:fix inline
type JSON = v1beta1.JSON
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaDefinitions instead.
//
//go:fix inline
type JSONSchemaDefinitions = v1beta1.JSONSchemaDefinitions
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaDependencies instead.
//
//go:fix inline
type JSONSchemaDependencies = v1beta1.JSONSchemaDependencies
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaProps instead.
//
//go:fix inline
type JSONSchemaProps = v1beta1.JSONSchemaProps
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaPropsOrArray instead.
//
//go:fix inline
type JSONSchemaPropsOrArray = v1beta1.JSONSchemaPropsOrArray
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaPropsOrBool instead.
//
//go:fix inline
type JSONSchemaPropsOrBool = v1beta1.JSONSchemaPropsOrBool
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaPropsOrStringArray instead.
//
//go:fix inline
type JSONSchemaPropsOrStringArray = v1beta1.JSONSchemaPropsOrStringArray
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.JSONSchemaURL instead.
//
//go:fix inline
type JSONSchemaURL = v1beta1.JSONSchemaURL
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ResourceScope instead.
//
//go:fix inline
type ResourceScope = v1beta1.ResourceScope
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SelectableField instead.
//
//go:fix inline
type SelectableField = v1beta1.SelectableField
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ServiceReference instead.
//
//go:fix inline
type ServiceReference = v1beta1.ServiceReference
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ValidationRule instead.
//
//go:fix inline
type ValidationRule = v1beta1.ValidationRule
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ValidationRules instead.
//
//go:fix inline
type ValidationRules = v1beta1.ValidationRules
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.WebhookClientConfig instead.
//
//go:fix inline
type WebhookClientConfig = v1beta1.WebhookClientConfig
const (
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ClusterScoped instead.
//
//go:fix inline
ClusterScoped = v1beta1.ClusterScoped
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConditionFalse instead.
//
//go:fix inline
ConditionFalse = v1beta1.ConditionFalse
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConditionTrue instead.
//
//go:fix inline
ConditionTrue = v1beta1.ConditionTrue
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ConditionUnknown instead.
//
//go:fix inline
ConditionUnknown = v1beta1.ConditionUnknown
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.CustomResourceCleanupFinalizer instead.
//
//go:fix inline
CustomResourceCleanupFinalizer = v1beta1.CustomResourceCleanupFinalizer
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.Established instead.
//
//go:fix inline
Established = v1beta1.Established
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.FieldValueDuplicate instead.
//
//go:fix inline
FieldValueDuplicate = v1beta1.FieldValueDuplicate
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.FieldValueForbidden instead.
//
//go:fix inline
FieldValueForbidden = v1beta1.FieldValueForbidden
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.FieldValueInvalid instead.
//
//go:fix inline
FieldValueInvalid = v1beta1.FieldValueInvalid
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.FieldValueRequired instead.
//
//go:fix inline
FieldValueRequired = v1beta1.FieldValueRequired
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.GroupName instead.
//
//go:fix inline
GroupName = v1beta1.GroupName
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.KubeAPIApprovedAnnotation instead.
//
//go:fix inline
KubeAPIApprovedAnnotation = v1beta1.KubeAPIApprovedAnnotation
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.KubernetesAPIApprovalPolicyConformant instead.
//
//go:fix inline
KubernetesAPIApprovalPolicyConformant = v1beta1.KubernetesAPIApprovalPolicyConformant
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.NamesAccepted instead.
//
//go:fix inline
NamesAccepted = v1beta1.NamesAccepted
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.NamespaceScoped instead.
//
//go:fix inline
NamespaceScoped = v1beta1.NamespaceScoped
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.NonStructuralSchema instead.
//
//go:fix inline
NonStructuralSchema = v1beta1.NonStructuralSchema
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.NoneConverter instead.
//
//go:fix inline
NoneConverter = v1beta1.NoneConverter
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.Terminating instead.
//
//go:fix inline
Terminating = v1beta1.Terminating
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.WebhookConverter instead.
//
//go:fix inline
WebhookConverter = v1beta1.WebhookConverter
)
var (
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ErrIntOverflowGenerated instead.
ErrIntOverflowGenerated = v1beta1.ErrIntOverflowGenerated
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ErrInvalidLengthGenerated instead.
ErrInvalidLengthGenerated = v1beta1.ErrInvalidLengthGenerated
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.ErrUnexpectedEndOfGroupGenerated instead.
ErrUnexpectedEndOfGroupGenerated = v1beta1.ErrUnexpectedEndOfGroupGenerated
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SchemeGroupVersion instead.
SchemeGroupVersion = v1beta1.SchemeGroupVersion
)
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.Kind instead.
//
//go:fix inline
func Kind(kind string) schema.GroupKind {
return v1beta1.Kind(kind)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.RegisterDefaults instead.
//
//go:fix inline
func RegisterDefaults(scheme *runtime.Scheme) error {
return v1beta1.RegisterDefaults(scheme)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.Resource instead.
//
//go:fix inline
func Resource(resource string) schema.GroupResource {
return v1beta1.Resource(resource)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SetDefaults_CustomResourceDefinition instead.
//
//go:fix inline
func SetDefaults_CustomResourceDefinition(obj *v1beta1.CustomResourceDefinition) {
v1beta1.SetDefaults_CustomResourceDefinition(obj)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SetDefaults_CustomResourceDefinitionSpec instead.
//
//go:fix inline
func SetDefaults_CustomResourceDefinitionSpec(obj *v1beta1.CustomResourceDefinitionSpec) {
v1beta1.SetDefaults_CustomResourceDefinitionSpec(obj)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SetDefaults_ServiceReference instead.
//
//go:fix inline
func SetDefaults_ServiceReference(obj *v1beta1.ServiceReference) {
v1beta1.SetDefaults_ServiceReference(obj)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SetObjectDefaults_CustomResourceDefinition instead.
//
//go:fix inline
func SetObjectDefaults_CustomResourceDefinition(in *v1beta1.CustomResourceDefinition) {
v1beta1.SetObjectDefaults_CustomResourceDefinition(in)
}
// Deprecated: Use k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1.SetObjectDefaults_CustomResourceDefinitionList instead.
//
//go:fix inline
func SetObjectDefaults_CustomResourceDefinitionList(in *v1beta1.CustomResourceDefinitionList) {
v1beta1.SetObjectDefaults_CustomResourceDefinitionList(in)
}
@@ -14,15 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package
// +k8s:protobuf-gen=package
// +k8s:conversion-gen=k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +k8s:prerelease-lifecycle-gen=true
// +k8s:openapi-model-package=io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1
// +k8s:conversion-gen-external-types=k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1
// +groupName=apiextensions.k8s.io
// Package v1beta1 is the v1beta1 version of the API.
// Package v1beta1 contains the conversions between the internal apiextensions types
// and k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1, and deprecated aliases
// of the identifiers that package had when the types moved there.
package v1beta1
@@ -17,46 +17,16 @@ limitations under the License.
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1beta1 "k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const GroupName = "apiextensions.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs)
// SchemeBuilder registers the types and defaulting functions of
// k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1 and the conversions to the
// internal version. It is separate from that package's builder so that
// importing this package doesn't change what the other one registers.
SchemeBuilder = runtime.NewSchemeBuilder(v1beta1.AddToScheme)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResourceDefinition{},
&CustomResourceDefinitionList{},
&ConversionReview{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addDefaultingFuncs)
}
@@ -17,7 +17,9 @@ limitations under the License.
package api
import (
"path"
"reflect"
"strings"
"testing"
"k8s.io/apimachinery/pkg/runtime"
@@ -50,10 +52,15 @@ func TestOpenAPIDefinitionNames(t *testing.T) {
lookupName := namer.OpenAPIModelName()
rtype := reflect.TypeOf(example).Elem()
reflectName := util.ToRESTFriendlyName(rtype.PkgPath() + "." + rtype.Name())
wantName := util.ToRESTFriendlyName(rtype.PkgPath() + "." + rtype.Name())
if strings.HasPrefix(rtype.PkgPath(), "k8s.io/apiextensions-api/") {
// The types moved to k8s.io/apiextensions-api but keep the model names
// of their old package, which are part of the published OpenAPI.
wantName = "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions." + path.Base(rtype.PkgPath()) + "." + rtype.Name()
}
if lookupName != reflectName {
t.Errorf("expected %v, got %v", reflectName, lookupName)
if lookupName != wantName {
t.Errorf("expected %v, got %v", wantName, lookupName)
}
})
}
@@ -0,0 +1,74 @@
/*
Copyright 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 (
"testing"
typesv1 "k8s.io/apiextensions-api/pkg/apis/apiextensions/v1"
typesv1beta1 "k8s.io/apiextensions-api/pkg/apis/apiextensions/v1beta1"
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
)
// TestAddToScheme pins down what each AddToScheme registers since the types
// moved to k8s.io/apiextensions-api: both packages register the types and their
// defaulting functions, only the apiextensions-apiserver packages add the
// conversions to the internal version.
func TestAddToScheme(t *testing.T) {
tests := []struct {
name string
addToScheme func(*runtime.Scheme) error
obj runtime.Object
wantConversions bool
}{
{name: "apiextensions-apiserver v1", addToScheme: apiextensionsv1.AddToScheme, obj: &typesv1.CustomResourceDefinition{}, wantConversions: true},
{name: "apiextensions-apiserver v1beta1", addToScheme: apiextensionsv1beta1.AddToScheme, obj: &typesv1beta1.CustomResourceDefinition{}, wantConversions: true},
{name: "apiextensions v1", addToScheme: typesv1.AddToScheme, obj: &typesv1.CustomResourceDefinition{}},
{name: "apiextensions v1beta1", addToScheme: typesv1beta1.AddToScheme, obj: &typesv1beta1.CustomResourceDefinition{}},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
scheme := runtime.NewScheme()
if err := tc.addToScheme(scheme); err != nil {
t.Fatal(err)
}
scheme.Default(tc.obj)
var defaulted bool
switch crd := tc.obj.(type) {
case *typesv1.CustomResourceDefinition:
defaulted = crd.Spec.Conversion != nil && crd.Spec.Conversion.Strategy == typesv1.NoneConverter
case *typesv1beta1.CustomResourceDefinition:
defaulted = crd.Spec.Conversion != nil && crd.Spec.Conversion.Strategy == typesv1beta1.NoneConverter
}
if !defaulted {
t.Errorf("spec.conversion was not defaulted: %#v", tc.obj)
}
err := scheme.Convert(tc.obj, &apiextensions.CustomResourceDefinition{}, nil)
if tc.wantConversions && err != nil {
t.Errorf("conversion to the internal version failed: %v", err)
}
if !tc.wantConversions && err == nil {
t.Error("conversion to the internal version is registered, want it only in k8s.io/apiextensions-apiserver")
}
})
}
}