Commit 0304ef60 authored by deads2k's avatar deads2k

rename to CustomResourceDefinition

parent 161ba1c9
...@@ -34,7 +34,7 @@ func main() { ...@@ -34,7 +34,7 @@ func main() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
} }
cmd := server.NewCommandStartCustomResourcesServer(os.Stdout, os.Stderr, wait.NeverStop) cmd := server.NewCommandStartCustomResourceDefinitionsServer(os.Stdout, os.Stderr, wait.NeverStop)
cmd.Flags().AddGoFlagSet(flag.CommandLine) cmd.Flags().AddGoFlagSet(flag.CommandLine)
if err := cmd.Execute(); err != nil { if err := cmd.Execute(); err != nil {
panic(err) panic(err)
......
...@@ -30,7 +30,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r ...@@ -30,7 +30,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
if err := announced.NewGroupMetaFactory( if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{ &announced.GroupMetaFactoryArgs{
GroupName: apiextensions.GroupName, GroupName: apiextensions.GroupName,
RootScopedKinds: sets.NewString("CustomResource"), RootScopedKinds: sets.NewString("CustomResourceDefinition"),
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version}, VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
ImportPrefix: "k8s.io/kube-apiextensions-server/pkg/apis/apiextension", ImportPrefix: "k8s.io/kube-apiextensions-server/pkg/apis/apiextension",
AddInternalObjectsToScheme: apiextensions.AddToScheme, AddInternalObjectsToScheme: apiextensions.AddToScheme,
......
...@@ -34,7 +34,7 @@ func TestRoundTripTypes(t *testing.T) { ...@@ -34,7 +34,7 @@ func TestRoundTripTypes(t *testing.T) {
func fuzzerFuncs() []interface{} { func fuzzerFuncs() []interface{} {
return []interface{}{ return []interface{}{
func(obj *apiextensions.CustomResourceSpec, c fuzz.Continue) { func(obj *apiextensions.CustomResourceDefinitionSpec, c fuzz.Continue) {
c.FuzzNoCustom(obj) c.FuzzNoCustom(obj)
// match our defaulter // match our defaulter
......
...@@ -44,8 +44,8 @@ var ( ...@@ -44,8 +44,8 @@ var (
// Adds the list of known types to api.Scheme. // Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error { func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion, scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResource{}, &CustomResourceDefinition{},
&CustomResourceList{}, &CustomResourceDefinitionList{},
) )
return nil return nil
} }
...@@ -18,22 +18,22 @@ package apiextensions ...@@ -18,22 +18,22 @@ package apiextensions
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// CustomResourceSpec describes how a user wants their resource to appear // CustomResourceDefinitionSpec describes how a user wants their resource to appear
type CustomResourceSpec struct { type CustomResourceDefinitionSpec struct {
// Group is the group this resource belongs in // Group is the group this resource belongs in
Group string Group string
// Version is the version this resource belongs in // Version is the version this resource belongs in
Version string Version string
// Names are the names used to describe this custom resource // Names are the names used to describe this custom resource
Names CustomResourceNames Names CustomResourceDefinitionNames
// Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced // Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced
Scope ResourceScope Scope ResourceScope
} }
// CustomResourceNames indicates the names to serve this CustomResource // CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition
type CustomResourceNames struct { type CustomResourceDefinitionNames struct {
// Plural is the plural name of the resource to serve. It must match the name of the CustomResource-registration // Plural is the plural name of the resource to serve. It must match the name of the CustomResourceDefinition-registration
// too: plural.group and it must be all lowercase. // too: plural.group and it must be all lowercase.
Plural string Plural string
// Singular is the singular name of the resource. It must be all lowercase Defaults to lowercased <kind> // Singular is the singular name of the resource. It must be all lowercase Defaults to lowercased <kind>
...@@ -66,20 +66,20 @@ const ( ...@@ -66,20 +66,20 @@ const (
ConditionUnknown ConditionStatus = "Unknown" ConditionUnknown ConditionStatus = "Unknown"
) )
// CustomResourceConditionType is a valid value for CustomResourceCondition.Type // CustomResourceDefinitionConditionType is a valid value for CustomResourceDefinitionCondition.Type
type CustomResourceConditionType string type CustomResourceDefinitionConditionType string
const ( const (
// NameConflict means the names chosen for this CustomResource conflict with others in the group. // NameConflict means the names chosen for this CustomResourceDefinition conflict with others in the group.
NameConflict CustomResourceConditionType = "NameConflict" NameConflict CustomResourceDefinitionConditionType = "NameConflict"
// Terminating means that the CustomResource has been deleted and is cleaning up. // Terminating means that the CustomResourceDefinition has been deleted and is cleaning up.
Terminating CustomResourceConditionType = "Terminating" Terminating CustomResourceDefinitionConditionType = "Terminating"
) )
// CustomResourceCondition contains details for the current condition of this pod. // CustomResourceDefinitionCondition contains details for the current condition of this pod.
type CustomResourceCondition struct { type CustomResourceDefinitionCondition struct {
// Type is the type of the condition. // Type is the type of the condition.
Type CustomResourceConditionType Type CustomResourceDefinitionConditionType
// Status is the status of the condition. // Status is the status of the condition.
// Can be True, False, Unknown. // Can be True, False, Unknown.
Status ConditionStatus Status ConditionStatus
...@@ -94,36 +94,36 @@ type CustomResourceCondition struct { ...@@ -94,36 +94,36 @@ type CustomResourceCondition struct {
Message string Message string
} }
// CustomResourceStatus indicates the state of the CustomResource // CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition
type CustomResourceStatus struct { type CustomResourceDefinitionStatus struct {
// Conditions indicate state for particular aspects of a CustomResource // Conditions indicate state for particular aspects of a CustomResourceDefinition
Conditions []CustomResourceCondition Conditions []CustomResourceDefinitionCondition
// AcceptedNames are the names that are actually being used to serve discovery // AcceptedNames are the names that are actually being used to serve discovery
// They may be different than the names in spec. // They may be different than the names in spec.
AcceptedNames CustomResourceNames AcceptedNames CustomResourceDefinitionNames
} }
// +genclient=true // +genclient=true
// +nonNamespaced=true // +nonNamespaced=true
// CustomResource represents a resource that should be exposed on the API server. Its name MUST be in the format // CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format
// <.spec.name>.<.spec.group>. // <.spec.name>.<.spec.group>.
type CustomResource struct { type CustomResourceDefinition struct {
metav1.TypeMeta metav1.TypeMeta
metav1.ObjectMeta metav1.ObjectMeta
// Spec describes how the user wants the resources to appear // Spec describes how the user wants the resources to appear
Spec CustomResourceSpec Spec CustomResourceDefinitionSpec
// Status indicates the actual state of the CustomResource // Status indicates the actual state of the CustomResourceDefinition
Status CustomResourceStatus Status CustomResourceDefinitionStatus
} }
// CustomResourceList is a list of CustomResource objects. // CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
type CustomResourceList struct { type CustomResourceDefinitionList struct {
metav1.TypeMeta metav1.TypeMeta
metav1.ListMeta metav1.ListMeta
// Items individual CustomResources // Items individual CustomResourceDefinitions
Items []CustomResource Items []CustomResourceDefinition
} }
...@@ -23,17 +23,17 @@ import ( ...@@ -23,17 +23,17 @@ import (
) )
func addDefaultingFuncs(scheme *runtime.Scheme) error { func addDefaultingFuncs(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&CustomResource{}, func(obj interface{}) { SetDefaults_CustomResource(obj.(*CustomResource)) }) scheme.AddTypeDefaultingFunc(&CustomResourceDefinition{}, func(obj interface{}) { SetDefaults_CustomResourceDefinition(obj.(*CustomResourceDefinition)) })
// TODO figure out why I can't seem to get my defaulter generated // TODO figure out why I can't seem to get my defaulter generated
// return RegisterDefaults(scheme) // return RegisterDefaults(scheme)
return nil return nil
} }
func SetDefaults_CustomResource(obj *CustomResource) { func SetDefaults_CustomResourceDefinition(obj *CustomResourceDefinition) {
SetDefaults_CustomResourceSpec(&obj.Spec) SetDefaults_CustomResourceDefinitionSpec(&obj.Spec)
} }
func SetDefaults_CustomResourceSpec(obj *CustomResourceSpec) { func SetDefaults_CustomResourceDefinitionSpec(obj *CustomResourceDefinitionSpec) {
if len(obj.Scope) == 0 { if len(obj.Scope) == 0 {
obj.Scope = NamespaceScoped obj.Scope = NamespaceScoped
} }
......
...@@ -45,8 +45,8 @@ var ( ...@@ -45,8 +45,8 @@ var (
// Adds the list of known types to api.Scheme. // Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error { func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion, scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResource{}, &CustomResourceDefinition{},
&CustomResourceList{}, &CustomResourceDefinitionList{},
) )
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil return nil
......
...@@ -18,22 +18,22 @@ package v1alpha1 ...@@ -18,22 +18,22 @@ package v1alpha1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// CustomResourceSpec describes how a user wants their resource to appear // CustomResourceDefinitionSpec describes how a user wants their resource to appear
type CustomResourceSpec struct { type CustomResourceDefinitionSpec struct {
// Group is the group this resource belongs in // Group is the group this resource belongs in
Group string `json:"group" protobuf:"bytes,1,opt,name=group"` Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
// Version is the version this resource belongs in // Version is the version this resource belongs in
Version string `json:"version" protobuf:"bytes,2,opt,name=version"` Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
// Names are the names used to describe this custom resource // Names are the names used to describe this custom resource
Names CustomResourceNames `json:"names" protobuf:"bytes,3,opt,name=names"` Names CustomResourceDefinitionNames `json:"names" protobuf:"bytes,3,opt,name=names"`
// Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced // Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced
Scope ResourceScope `json:"scope" protobuf:"bytes,4,opt,name=scope,casttype=ResourceScope"` Scope ResourceScope `json:"scope" protobuf:"bytes,4,opt,name=scope,casttype=ResourceScope"`
} }
// CustomResourceNames indicates the names to serve this CustomResource // CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition
type CustomResourceNames struct { type CustomResourceDefinitionNames struct {
// Plural is the plural name of the resource to serve. It must match the name of the CustomResource-registration // Plural is the plural name of the resource to serve. It must match the name of the CustomResourceDefinition-registration
// too: plural.group and it must be all lowercase. // too: plural.group and it must be all lowercase.
Plural string `json:"plural" protobuf:"bytes,1,opt,name=plural"` Plural string `json:"plural" protobuf:"bytes,1,opt,name=plural"`
// Singular is the singular name of the resource. It must be all lowercase Defaults to lowercased <kind> // Singular is the singular name of the resource. It must be all lowercase Defaults to lowercased <kind>
...@@ -66,20 +66,20 @@ const ( ...@@ -66,20 +66,20 @@ const (
ConditionUnknown ConditionStatus = "Unknown" ConditionUnknown ConditionStatus = "Unknown"
) )
// CustomResourceConditionType is a valid value for CustomResourceCondition.Type // CustomResourceDefinitionConditionType is a valid value for CustomResourceDefinitionCondition.Type
type CustomResourceConditionType string type CustomResourceDefinitionConditionType string
const ( const (
// NameConflict means the names chosen for this CustomResource conflict with others in the group. // NameConflict means the names chosen for this CustomResourceDefinition conflict with others in the group.
NameConflict CustomResourceConditionType = "NameConflict" NameConflict CustomResourceDefinitionConditionType = "NameConflict"
// Terminating means that the CustomResource has been deleted and is cleaning up. // Terminating means that the CustomResourceDefinition has been deleted and is cleaning up.
Terminating CustomResourceConditionType = "Terminating" Terminating CustomResourceDefinitionConditionType = "Terminating"
) )
// CustomResourceCondition contains details for the current condition of this pod. // CustomResourceDefinitionCondition contains details for the current condition of this pod.
type CustomResourceCondition struct { type CustomResourceDefinitionCondition struct {
// Type is the type of the condition. // Type is the type of the condition.
Type CustomResourceConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=CustomResourceConditionType"` Type CustomResourceDefinitionConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=CustomResourceDefinitionConditionType"`
// Status is the status of the condition. // Status is the status of the condition.
// Can be True, False, Unknown. // Can be True, False, Unknown.
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
...@@ -94,36 +94,36 @@ type CustomResourceCondition struct { ...@@ -94,36 +94,36 @@ type CustomResourceCondition struct {
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
} }
// CustomResourceStatus indicates the state of the CustomResource // CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition
type CustomResourceStatus struct { type CustomResourceDefinitionStatus struct {
// Conditions indicate state for particular aspects of a CustomResource // Conditions indicate state for particular aspects of a CustomResourceDefinition
Conditions []CustomResourceCondition `json:"conditions" protobuf:"bytes,1,opt,name=conditions"` Conditions []CustomResourceDefinitionCondition `json:"conditions" protobuf:"bytes,1,opt,name=conditions"`
// AcceptedNames are the names that are actually being used to serve discovery // AcceptedNames are the names that are actually being used to serve discovery
// They may be different than the names in spec. // They may be different than the names in spec.
AcceptedNames CustomResourceNames `json:"acceptedNames" protobuf:"bytes,2,opt,name=acceptedNames"` AcceptedNames CustomResourceDefinitionNames `json:"acceptedNames" protobuf:"bytes,2,opt,name=acceptedNames"`
} }
// +genclient=true // +genclient=true
// +nonNamespaced=true // +nonNamespaced=true
// CustomResource represents a resource that should be exposed on the API server. Its name MUST be in the format // CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format
// <.spec.name>.<.spec.group>. // <.spec.name>.<.spec.group>.
type CustomResource struct { type CustomResourceDefinition struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec describes how the user wants the resources to appear // Spec describes how the user wants the resources to appear
Spec CustomResourceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` Spec CustomResourceDefinitionSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Status indicates the actual state of the CustomResource // Status indicates the actual state of the CustomResourceDefinition
Status CustomResourceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` Status CustomResourceDefinitionStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
} }
// CustomResourceList is a list of CustomResource objects. // CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
type CustomResourceList struct { type CustomResourceDefinitionList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items individual CustomResources // Items individual CustomResourceDefinitions
Items []CustomResource `json:"items" protobuf:"bytes,2,rep,name=items"` Items []CustomResourceDefinition `json:"items" protobuf:"bytes,2,rep,name=items"`
} }
...@@ -35,19 +35,19 @@ func init() { ...@@ -35,19 +35,19 @@ func init() {
// to allow building arbitrary schemes. // to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error { func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs( return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResource, InType: reflect.TypeOf(&CustomResource{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceDefinition, InType: reflect.TypeOf(&CustomResourceDefinition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceCondition, InType: reflect.TypeOf(&CustomResourceCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceDefinitionCondition, InType: reflect.TypeOf(&CustomResourceDefinitionCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceList, InType: reflect.TypeOf(&CustomResourceList{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceDefinitionList, InType: reflect.TypeOf(&CustomResourceDefinitionList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceNames, InType: reflect.TypeOf(&CustomResourceNames{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceDefinitionNames, InType: reflect.TypeOf(&CustomResourceDefinitionNames{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceSpec, InType: reflect.TypeOf(&CustomResourceSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceDefinitionSpec, InType: reflect.TypeOf(&CustomResourceDefinitionSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceStatus, InType: reflect.TypeOf(&CustomResourceStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_CustomResourceDefinitionStatus, InType: reflect.TypeOf(&CustomResourceDefinitionStatus{})},
) )
} }
func DeepCopy_v1alpha1_CustomResource(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1alpha1_CustomResourceDefinition(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResource) in := in.(*CustomResourceDefinition)
out := out.(*CustomResource) out := out.(*CustomResourceDefinition)
*out = *in *out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil { if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err return err
...@@ -57,40 +57,40 @@ func DeepCopy_v1alpha1_CustomResource(in interface{}, out interface{}, c *conver ...@@ -57,40 +57,40 @@ func DeepCopy_v1alpha1_CustomResource(in interface{}, out interface{}, c *conver
if newVal, err := c.DeepCopy(&in.Spec); err != nil { if newVal, err := c.DeepCopy(&in.Spec); err != nil {
return err return err
} else { } else {
out.Spec = *newVal.(*CustomResourceSpec) out.Spec = *newVal.(*CustomResourceDefinitionSpec)
} }
if newVal, err := c.DeepCopy(&in.Status); err != nil { if newVal, err := c.DeepCopy(&in.Status); err != nil {
return err return err
} else { } else {
out.Status = *newVal.(*CustomResourceStatus) out.Status = *newVal.(*CustomResourceDefinitionStatus)
} }
return nil return nil
} }
} }
func DeepCopy_v1alpha1_CustomResourceCondition(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1alpha1_CustomResourceDefinitionCondition(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceCondition) in := in.(*CustomResourceDefinitionCondition)
out := out.(*CustomResourceCondition) out := out.(*CustomResourceDefinitionCondition)
*out = *in *out = *in
out.LastTransitionTime = in.LastTransitionTime.DeepCopy() out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
return nil return nil
} }
} }
func DeepCopy_v1alpha1_CustomResourceList(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1alpha1_CustomResourceDefinitionList(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceList) in := in.(*CustomResourceDefinitionList)
out := out.(*CustomResourceList) out := out.(*CustomResourceDefinitionList)
*out = *in *out = *in
if in.Items != nil { if in.Items != nil {
in, out := &in.Items, &out.Items in, out := &in.Items, &out.Items
*out = make([]CustomResource, len(*in)) *out = make([]CustomResourceDefinition, len(*in))
for i := range *in { for i := range *in {
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil { if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
return err return err
} else { } else {
(*out)[i] = *newVal.(*CustomResource) (*out)[i] = *newVal.(*CustomResourceDefinition)
} }
} }
} }
...@@ -98,10 +98,10 @@ func DeepCopy_v1alpha1_CustomResourceList(in interface{}, out interface{}, c *co ...@@ -98,10 +98,10 @@ func DeepCopy_v1alpha1_CustomResourceList(in interface{}, out interface{}, c *co
} }
} }
func DeepCopy_v1alpha1_CustomResourceNames(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1alpha1_CustomResourceDefinitionNames(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceNames) in := in.(*CustomResourceDefinitionNames)
out := out.(*CustomResourceNames) out := out.(*CustomResourceDefinitionNames)
*out = *in *out = *in
if in.ShortNames != nil { if in.ShortNames != nil {
in, out := &in.ShortNames, &out.ShortNames in, out := &in.ShortNames, &out.ShortNames
...@@ -112,40 +112,40 @@ func DeepCopy_v1alpha1_CustomResourceNames(in interface{}, out interface{}, c *c ...@@ -112,40 +112,40 @@ func DeepCopy_v1alpha1_CustomResourceNames(in interface{}, out interface{}, c *c
} }
} }
func DeepCopy_v1alpha1_CustomResourceSpec(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1alpha1_CustomResourceDefinitionSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceSpec) in := in.(*CustomResourceDefinitionSpec)
out := out.(*CustomResourceSpec) out := out.(*CustomResourceDefinitionSpec)
*out = *in *out = *in
if newVal, err := c.DeepCopy(&in.Names); err != nil { if newVal, err := c.DeepCopy(&in.Names); err != nil {
return err return err
} else { } else {
out.Names = *newVal.(*CustomResourceNames) out.Names = *newVal.(*CustomResourceDefinitionNames)
} }
return nil return nil
} }
} }
func DeepCopy_v1alpha1_CustomResourceStatus(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1alpha1_CustomResourceDefinitionStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceStatus) in := in.(*CustomResourceDefinitionStatus)
out := out.(*CustomResourceStatus) out := out.(*CustomResourceDefinitionStatus)
*out = *in *out = *in
if in.Conditions != nil { if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions in, out := &in.Conditions, &out.Conditions
*out = make([]CustomResourceCondition, len(*in)) *out = make([]CustomResourceDefinitionCondition, len(*in))
for i := range *in { for i := range *in {
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil { if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
return err return err
} else { } else {
(*out)[i] = *newVal.(*CustomResourceCondition) (*out)[i] = *newVal.(*CustomResourceDefinitionCondition)
} }
} }
} }
if newVal, err := c.DeepCopy(&in.AcceptedNames); err != nil { if newVal, err := c.DeepCopy(&in.AcceptedNames); err != nil {
return err return err
} else { } else {
out.AcceptedNames = *newVal.(*CustomResourceNames) out.AcceptedNames = *newVal.(*CustomResourceDefinitionNames)
} }
return nil return nil
} }
......
...@@ -26,8 +26,8 @@ import ( ...@@ -26,8 +26,8 @@ import (
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions" "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
) )
// ValidateCustomResource statically validates // ValidateCustomResourceDefinition statically validates
func ValidateCustomResource(obj *apiextensions.CustomResource) field.ErrorList { func ValidateCustomResourceDefinition(obj *apiextensions.CustomResourceDefinition) field.ErrorList {
nameValidationFn := func(name string, prefix bool) []string { nameValidationFn := func(name string, prefix bool) []string {
ret := genericvalidation.NameIsDNSSubdomain(name, prefix) ret := genericvalidation.NameIsDNSSubdomain(name, prefix)
requiredName := obj.Spec.Names.Plural + "." + obj.Spec.Group requiredName := obj.Spec.Names.Plural + "." + obj.Spec.Group
...@@ -38,28 +38,28 @@ func ValidateCustomResource(obj *apiextensions.CustomResource) field.ErrorList { ...@@ -38,28 +38,28 @@ func ValidateCustomResource(obj *apiextensions.CustomResource) field.ErrorList {
} }
allErrs := genericvalidation.ValidateObjectMeta(&obj.ObjectMeta, false, nameValidationFn, field.NewPath("metadata")) allErrs := genericvalidation.ValidateObjectMeta(&obj.ObjectMeta, false, nameValidationFn, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateCustomResourceSpec(&obj.Spec, field.NewPath("spec"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionSpec(&obj.Spec, field.NewPath("spec"))...)
allErrs = append(allErrs, ValidateCustomResourceStatus(&obj.Status, field.NewPath("status"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...)
return allErrs return allErrs
} }
// ValidateCustomResourceUpdate statically validates // ValidateCustomResourceDefinitionUpdate statically validates
func ValidateCustomResourceUpdate(obj, oldObj *apiextensions.CustomResource) field.ErrorList { func ValidateCustomResourceDefinitionUpdate(obj, oldObj *apiextensions.CustomResourceDefinition) field.ErrorList {
allErrs := genericvalidation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata")) allErrs := genericvalidation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateCustomResourceSpecUpdate(&obj.Spec, &oldObj.Spec, field.NewPath("spec"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionSpecUpdate(&obj.Spec, &oldObj.Spec, field.NewPath("spec"))...)
allErrs = append(allErrs, ValidateCustomResourceStatus(&obj.Status, field.NewPath("status"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...)
return allErrs return allErrs
} }
// ValidateUpdateCustomResourceStatus statically validates // ValidateUpdateCustomResourceDefinitionStatus statically validates
func ValidateUpdateCustomResourceStatus(obj, oldObj *apiextensions.CustomResource) field.ErrorList { func ValidateUpdateCustomResourceDefinitionStatus(obj, oldObj *apiextensions.CustomResourceDefinition) field.ErrorList {
allErrs := genericvalidation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata")) allErrs := genericvalidation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateCustomResourceStatus(&obj.Status, field.NewPath("status"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...)
return allErrs return allErrs
} }
// ValidateCustomResourceSpec statically validates // ValidateCustomResourceDefinitionSpec statically validates
func ValidateCustomResourceSpec(spec *apiextensions.CustomResourceSpec, fldPath *field.Path) field.ErrorList { func ValidateCustomResourceDefinitionSpec(spec *apiextensions.CustomResourceDefinitionSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if len(spec.Group) == 0 { if len(spec.Group) == 0 {
...@@ -99,14 +99,14 @@ func ValidateCustomResourceSpec(spec *apiextensions.CustomResourceSpec, fldPath ...@@ -99,14 +99,14 @@ func ValidateCustomResourceSpec(spec *apiextensions.CustomResourceSpec, fldPath
allErrs = append(allErrs, field.Required(fldPath.Child("names", "listKind"), "")) allErrs = append(allErrs, field.Required(fldPath.Child("names", "listKind"), ""))
} }
allErrs = append(allErrs, ValidateCustomResourceNames(&spec.Names, fldPath.Child("names"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionNames(&spec.Names, fldPath.Child("names"))...)
return allErrs return allErrs
} }
// ValidateCustomResourceSpecUpdate statically validates // ValidateCustomResourceDefinitionSpecUpdate statically validates
func ValidateCustomResourceSpecUpdate(spec, oldSpec *apiextensions.CustomResourceSpec, fldPath *field.Path) field.ErrorList { func ValidateCustomResourceDefinitionSpecUpdate(spec, oldSpec *apiextensions.CustomResourceDefinitionSpec, fldPath *field.Path) field.ErrorList {
allErrs := ValidateCustomResourceSpec(spec, fldPath) allErrs := ValidateCustomResourceDefinitionSpec(spec, fldPath)
// these all affect the storage, so you can't change them // these all affect the storage, so you can't change them
genericvalidation.ValidateImmutableField(spec.Group, oldSpec.Group, fldPath.Child("group")) genericvalidation.ValidateImmutableField(spec.Group, oldSpec.Group, fldPath.Child("group"))
...@@ -120,15 +120,15 @@ func ValidateCustomResourceSpecUpdate(spec, oldSpec *apiextensions.CustomResourc ...@@ -120,15 +120,15 @@ func ValidateCustomResourceSpecUpdate(spec, oldSpec *apiextensions.CustomResourc
return allErrs return allErrs
} }
// ValidateCustomResourceStatus statically validates // ValidateCustomResourceDefinitionStatus statically validates
func ValidateCustomResourceStatus(status *apiextensions.CustomResourceStatus, fldPath *field.Path) field.ErrorList { func ValidateCustomResourceDefinitionStatus(status *apiextensions.CustomResourceDefinitionStatus, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
allErrs = append(allErrs, ValidateCustomResourceNames(&status.AcceptedNames, fldPath.Child("acceptedNames"))...) allErrs = append(allErrs, ValidateCustomResourceDefinitionNames(&status.AcceptedNames, fldPath.Child("acceptedNames"))...)
return allErrs return allErrs
} }
// ValidateCustomResourceNames statically validates // ValidateCustomResourceDefinitionNames statically validates
func ValidateCustomResourceNames(names *apiextensions.CustomResourceNames, fldPath *field.Path) field.ErrorList { func ValidateCustomResourceDefinitionNames(names *apiextensions.CustomResourceDefinitionNames, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if errs := validationutil.IsDNS1035Label(names.Plural); len(names.Plural) > 0 && len(errs) > 0 { if errs := validationutil.IsDNS1035Label(names.Plural); len(names.Plural) > 0 && len(errs) > 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("plural"), names.Plural, strings.Join(errs, ","))) allErrs = append(allErrs, field.Invalid(fldPath.Child("plural"), names.Plural, strings.Join(errs, ",")))
......
...@@ -40,19 +40,19 @@ func (v validationMatch) matches(err *field.Error) bool { ...@@ -40,19 +40,19 @@ func (v validationMatch) matches(err *field.Error) bool {
return err.Type == v.errorType && err.Field == v.path.String() return err.Type == v.errorType && err.Field == v.path.String()
} }
func TestValidateCustomResource(t *testing.T) { func TestValidateCustomResourceDefinition(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
resource *apiextensions.CustomResource resource *apiextensions.CustomResourceDefinition
errors []validationMatch errors []validationMatch
}{ }{
{ {
name: "mismatched name", name: "mismatched name",
resource: &apiextensions.CustomResource{ resource: &apiextensions.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{Name: "plural.not.group.com"}, ObjectMeta: metav1.ObjectMeta{Name: "plural.not.group.com"},
Spec: apiextensions.CustomResourceSpec{ Spec: apiextensions.CustomResourceDefinitionSpec{
Group: "group.com", Group: "group.com",
Names: apiextensions.CustomResourceNames{ Names: apiextensions.CustomResourceDefinitionNames{
Plural: "plural", Plural: "plural",
}, },
}, },
...@@ -63,7 +63,7 @@ func TestValidateCustomResource(t *testing.T) { ...@@ -63,7 +63,7 @@ func TestValidateCustomResource(t *testing.T) {
}, },
{ {
name: "missing values", name: "missing values",
resource: &apiextensions.CustomResource{ resource: &apiextensions.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{Name: "plural.group.com"}, ObjectMeta: metav1.ObjectMeta{Name: "plural.group.com"},
}, },
errors: []validationMatch{ errors: []validationMatch{
...@@ -78,21 +78,21 @@ func TestValidateCustomResource(t *testing.T) { ...@@ -78,21 +78,21 @@ func TestValidateCustomResource(t *testing.T) {
}, },
{ {
name: "bad names 01", name: "bad names 01",
resource: &apiextensions.CustomResource{ resource: &apiextensions.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{Name: "plural.group"}, ObjectMeta: metav1.ObjectMeta{Name: "plural.group"},
Spec: apiextensions.CustomResourceSpec{ Spec: apiextensions.CustomResourceDefinitionSpec{
Group: "group", Group: "group",
Version: "ve()*rsion", Version: "ve()*rsion",
Scope: apiextensions.ResourceScope("foo"), Scope: apiextensions.ResourceScope("foo"),
Names: apiextensions.CustomResourceNames{ Names: apiextensions.CustomResourceDefinitionNames{
Plural: "pl()*ural", Plural: "pl()*ural",
Singular: "value()*a", Singular: "value()*a",
Kind: "value()*a", Kind: "value()*a",
ListKind: "value()*a", ListKind: "value()*a",
}, },
}, },
Status: apiextensions.CustomResourceStatus{ Status: apiextensions.CustomResourceDefinitionStatus{
AcceptedNames: apiextensions.CustomResourceNames{ AcceptedNames: apiextensions.CustomResourceDefinitionNames{
Plural: "pl()*ural", Plural: "pl()*ural",
Singular: "value()*a", Singular: "value()*a",
Kind: "value()*a", Kind: "value()*a",
...@@ -116,20 +116,20 @@ func TestValidateCustomResource(t *testing.T) { ...@@ -116,20 +116,20 @@ func TestValidateCustomResource(t *testing.T) {
}, },
{ {
name: "bad names 02", name: "bad names 02",
resource: &apiextensions.CustomResource{ resource: &apiextensions.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{Name: "plural.group"}, ObjectMeta: metav1.ObjectMeta{Name: "plural.group"},
Spec: apiextensions.CustomResourceSpec{ Spec: apiextensions.CustomResourceDefinitionSpec{
Group: "group.c(*&om", Group: "group.c(*&om",
Version: "version", Version: "version",
Names: apiextensions.CustomResourceNames{ Names: apiextensions.CustomResourceDefinitionNames{
Plural: "plural", Plural: "plural",
Singular: "singular", Singular: "singular",
Kind: "matching", Kind: "matching",
ListKind: "matching", ListKind: "matching",
}, },
}, },
Status: apiextensions.CustomResourceStatus{ Status: apiextensions.CustomResourceDefinitionStatus{
AcceptedNames: apiextensions.CustomResourceNames{ AcceptedNames: apiextensions.CustomResourceDefinitionNames{
Plural: "plural", Plural: "plural",
Singular: "singular", Singular: "singular",
Kind: "matching", Kind: "matching",
...@@ -146,7 +146,7 @@ func TestValidateCustomResource(t *testing.T) { ...@@ -146,7 +146,7 @@ func TestValidateCustomResource(t *testing.T) {
} }
for _, tc := range tests { for _, tc := range tests {
errs := ValidateCustomResource(tc.resource) errs := ValidateCustomResourceDefinition(tc.resource)
for _, expectedError := range tc.errors { for _, expectedError := range tc.errors {
found := false found := false
......
...@@ -35,19 +35,19 @@ func init() { ...@@ -35,19 +35,19 @@ func init() {
// to allow building arbitrary schemes. // to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error { func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs( return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResource, InType: reflect.TypeOf(&CustomResource{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceDefinition, InType: reflect.TypeOf(&CustomResourceDefinition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceCondition, InType: reflect.TypeOf(&CustomResourceCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceDefinitionCondition, InType: reflect.TypeOf(&CustomResourceDefinitionCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceList, InType: reflect.TypeOf(&CustomResourceList{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceDefinitionList, InType: reflect.TypeOf(&CustomResourceDefinitionList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceNames, InType: reflect.TypeOf(&CustomResourceNames{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceDefinitionNames, InType: reflect.TypeOf(&CustomResourceDefinitionNames{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceSpec, InType: reflect.TypeOf(&CustomResourceSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceDefinitionSpec, InType: reflect.TypeOf(&CustomResourceDefinitionSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceStatus, InType: reflect.TypeOf(&CustomResourceStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apiextensions_CustomResourceDefinitionStatus, InType: reflect.TypeOf(&CustomResourceDefinitionStatus{})},
) )
} }
func DeepCopy_apiextensions_CustomResource(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_apiextensions_CustomResourceDefinition(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResource) in := in.(*CustomResourceDefinition)
out := out.(*CustomResource) out := out.(*CustomResourceDefinition)
*out = *in *out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil { if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err return err
...@@ -57,40 +57,40 @@ func DeepCopy_apiextensions_CustomResource(in interface{}, out interface{}, c *c ...@@ -57,40 +57,40 @@ func DeepCopy_apiextensions_CustomResource(in interface{}, out interface{}, c *c
if newVal, err := c.DeepCopy(&in.Spec); err != nil { if newVal, err := c.DeepCopy(&in.Spec); err != nil {
return err return err
} else { } else {
out.Spec = *newVal.(*CustomResourceSpec) out.Spec = *newVal.(*CustomResourceDefinitionSpec)
} }
if newVal, err := c.DeepCopy(&in.Status); err != nil { if newVal, err := c.DeepCopy(&in.Status); err != nil {
return err return err
} else { } else {
out.Status = *newVal.(*CustomResourceStatus) out.Status = *newVal.(*CustomResourceDefinitionStatus)
} }
return nil return nil
} }
} }
func DeepCopy_apiextensions_CustomResourceCondition(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_apiextensions_CustomResourceDefinitionCondition(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceCondition) in := in.(*CustomResourceDefinitionCondition)
out := out.(*CustomResourceCondition) out := out.(*CustomResourceDefinitionCondition)
*out = *in *out = *in
out.LastTransitionTime = in.LastTransitionTime.DeepCopy() out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
return nil return nil
} }
} }
func DeepCopy_apiextensions_CustomResourceList(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_apiextensions_CustomResourceDefinitionList(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceList) in := in.(*CustomResourceDefinitionList)
out := out.(*CustomResourceList) out := out.(*CustomResourceDefinitionList)
*out = *in *out = *in
if in.Items != nil { if in.Items != nil {
in, out := &in.Items, &out.Items in, out := &in.Items, &out.Items
*out = make([]CustomResource, len(*in)) *out = make([]CustomResourceDefinition, len(*in))
for i := range *in { for i := range *in {
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil { if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
return err return err
} else { } else {
(*out)[i] = *newVal.(*CustomResource) (*out)[i] = *newVal.(*CustomResourceDefinition)
} }
} }
} }
...@@ -98,10 +98,10 @@ func DeepCopy_apiextensions_CustomResourceList(in interface{}, out interface{}, ...@@ -98,10 +98,10 @@ func DeepCopy_apiextensions_CustomResourceList(in interface{}, out interface{},
} }
} }
func DeepCopy_apiextensions_CustomResourceNames(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_apiextensions_CustomResourceDefinitionNames(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceNames) in := in.(*CustomResourceDefinitionNames)
out := out.(*CustomResourceNames) out := out.(*CustomResourceDefinitionNames)
*out = *in *out = *in
if in.ShortNames != nil { if in.ShortNames != nil {
in, out := &in.ShortNames, &out.ShortNames in, out := &in.ShortNames, &out.ShortNames
...@@ -112,40 +112,40 @@ func DeepCopy_apiextensions_CustomResourceNames(in interface{}, out interface{}, ...@@ -112,40 +112,40 @@ func DeepCopy_apiextensions_CustomResourceNames(in interface{}, out interface{},
} }
} }
func DeepCopy_apiextensions_CustomResourceSpec(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_apiextensions_CustomResourceDefinitionSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceSpec) in := in.(*CustomResourceDefinitionSpec)
out := out.(*CustomResourceSpec) out := out.(*CustomResourceDefinitionSpec)
*out = *in *out = *in
if newVal, err := c.DeepCopy(&in.Names); err != nil { if newVal, err := c.DeepCopy(&in.Names); err != nil {
return err return err
} else { } else {
out.Names = *newVal.(*CustomResourceNames) out.Names = *newVal.(*CustomResourceDefinitionNames)
} }
return nil return nil
} }
} }
func DeepCopy_apiextensions_CustomResourceStatus(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_apiextensions_CustomResourceDefinitionStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*CustomResourceStatus) in := in.(*CustomResourceDefinitionStatus)
out := out.(*CustomResourceStatus) out := out.(*CustomResourceDefinitionStatus)
*out = *in *out = *in
if in.Conditions != nil { if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions in, out := &in.Conditions, &out.Conditions
*out = make([]CustomResourceCondition, len(*in)) *out = make([]CustomResourceDefinitionCondition, len(*in))
for i := range *in { for i := range *in {
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil { if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
return err return err
} else { } else {
(*out)[i] = *newVal.(*CustomResourceCondition) (*out)[i] = *newVal.(*CustomResourceDefinitionCondition)
} }
} }
} }
if newVal, err := c.DeepCopy(&in.AcceptedNames); err != nil { if newVal, err := c.DeepCopy(&in.AcceptedNames); err != nil {
return err return err
} else { } else {
out.AcceptedNames = *newVal.(*CustomResourceNames) out.AcceptedNames = *newVal.(*CustomResourceDefinitionNames)
} }
return nil return nil
} }
......
...@@ -55,6 +55,6 @@ go_library( ...@@ -55,6 +55,6 @@ go_library(
"//vendor/k8s.io/kube-apiextensions-server/pkg/client/informers/internalversion/apiextensions/internalversion:go_default_library", "//vendor/k8s.io/kube-apiextensions-server/pkg/client/informers/internalversion/apiextensions/internalversion:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/client/listers/apiextensions/internalversion:go_default_library", "//vendor/k8s.io/kube-apiextensions-server/pkg/client/listers/apiextensions/internalversion:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/registry/customresource:go_default_library", "//vendor/k8s.io/kube-apiextensions-server/pkg/registry/customresource:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/registry/customresourcestorage:go_default_library", "//vendor/k8s.io/kube-apiextensions-server/pkg/registry/customresourcedefinition:go_default_library",
], ],
) )
...@@ -37,7 +37,7 @@ import ( ...@@ -37,7 +37,7 @@ import (
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1" "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1"
"k8s.io/kube-apiextensions-server/pkg/client/clientset/internalclientset" "k8s.io/kube-apiextensions-server/pkg/client/clientset/internalclientset"
internalinformers "k8s.io/kube-apiextensions-server/pkg/client/informers/internalversion" internalinformers "k8s.io/kube-apiextensions-server/pkg/client/informers/internalversion"
"k8s.io/kube-apiextensions-server/pkg/registry/customresource" "k8s.io/kube-apiextensions-server/pkg/registry/customresourcedefinition"
// make sure the generated client works // make sure the generated client works
_ "k8s.io/kube-apiextensions-server/pkg/client/clientset/clientset" _ "k8s.io/kube-apiextensions-server/pkg/client/clientset/clientset"
...@@ -71,10 +71,10 @@ func init() { ...@@ -71,10 +71,10 @@ func init() {
type Config struct { type Config struct {
GenericConfig *genericapiserver.Config GenericConfig *genericapiserver.Config
CustomResourceRESTOptionsGetter genericregistry.RESTOptionsGetter CustomResourceDefinitionRESTOptionsGetter genericregistry.RESTOptionsGetter
} }
type CustomResources struct { type CustomResourceDefinitions struct {
GenericAPIServer *genericapiserver.GenericAPIServer GenericAPIServer *genericapiserver.GenericAPIServer
} }
...@@ -100,32 +100,32 @@ func (c *Config) SkipComplete() completedConfig { ...@@ -100,32 +100,32 @@ func (c *Config) SkipComplete() completedConfig {
return completedConfig{c} return completedConfig{c}
} }
// New returns a new instance of CustomResources from the given config. // New returns a new instance of CustomResourceDefinitions from the given config.
func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*CustomResources, error) { func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*CustomResourceDefinitions, error) {
genericServer, err := c.Config.GenericConfig.SkipComplete().New(genericapiserver.EmptyDelegate) // completion is done in Complete, no need for a second time genericServer, err := c.Config.GenericConfig.SkipComplete().New(genericapiserver.EmptyDelegate) // completion is done in Complete, no need for a second time
if err != nil { if err != nil {
return nil, err return nil, err
} }
s := &CustomResources{ s := &CustomResourceDefinitions{
GenericAPIServer: genericServer, GenericAPIServer: genericServer,
} }
apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(apiextensions.GroupName, registry, Scheme, metav1.ParameterCodec, Codecs) apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(apiextensions.GroupName, registry, Scheme, metav1.ParameterCodec, Codecs)
apiGroupInfo.GroupMeta.GroupVersion = v1alpha1.SchemeGroupVersion apiGroupInfo.GroupMeta.GroupVersion = v1alpha1.SchemeGroupVersion
v1alpha1storage := map[string]rest.Storage{} v1alpha1storage := map[string]rest.Storage{}
v1alpha1storage["customresources"] = customresource.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter) v1alpha1storage["customresourcedefinitions"] = customresourcedefinition.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter)
apiGroupInfo.VersionedResourcesStorageMap["v1alpha1"] = v1alpha1storage apiGroupInfo.VersionedResourcesStorageMap["v1alpha1"] = v1alpha1storage
if err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil { if err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil {
return nil, err return nil, err
} }
customResourceClient, err := internalclientset.NewForConfig(s.GenericAPIServer.LoopbackClientConfig) customResourceDefinitionClient, err := internalclientset.NewForConfig(s.GenericAPIServer.LoopbackClientConfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }
customResourceInformers := internalinformers.NewSharedInformerFactory(customResourceClient, 5*time.Minute) customResourceDefinitionInformers := internalinformers.NewSharedInformerFactory(customResourceDefinitionClient, 5*time.Minute)
delegateHandler := delegationTarget.UnprotectedHandler() delegateHandler := delegationTarget.UnprotectedHandler()
if delegateHandler == nil { if delegateHandler == nil {
...@@ -140,26 +140,26 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) ...@@ -140,26 +140,26 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
discovery: map[string]*discovery.APIGroupHandler{}, discovery: map[string]*discovery.APIGroupHandler{},
delegate: delegateHandler, delegate: delegateHandler,
} }
customResourceHandler := NewCustomResourceHandler( customResourceDefinitionHandler := NewCustomResourceDefinitionHandler(
versionDiscoveryHandler, versionDiscoveryHandler,
groupDiscoveryHandler, groupDiscoveryHandler,
s.GenericAPIServer.RequestContextMapper(), s.GenericAPIServer.RequestContextMapper(),
customResourceInformers.Apiextensions().InternalVersion().CustomResources().Lister(), customResourceDefinitionInformers.Apiextensions().InternalVersion().CustomResourceDefinitions().Lister(),
delegateHandler, delegateHandler,
c.CustomResourceRESTOptionsGetter, c.CustomResourceDefinitionRESTOptionsGetter,
c.GenericConfig.AdmissionControl, c.GenericConfig.AdmissionControl,
) )
s.GenericAPIServer.Handler.PostGoRestfulMux.Handle("/apis", customResourceHandler) s.GenericAPIServer.Handler.PostGoRestfulMux.Handle("/apis", customResourceDefinitionHandler)
s.GenericAPIServer.Handler.PostGoRestfulMux.HandlePrefix("/apis/", customResourceHandler) s.GenericAPIServer.Handler.PostGoRestfulMux.HandlePrefix("/apis/", customResourceDefinitionHandler)
customResourceController := NewDiscoveryController(customResourceInformers.Apiextensions().InternalVersion().CustomResources(), versionDiscoveryHandler, groupDiscoveryHandler) customResourceDefinitionController := NewDiscoveryController(customResourceDefinitionInformers.Apiextensions().InternalVersion().CustomResourceDefinitions(), versionDiscoveryHandler, groupDiscoveryHandler)
s.GenericAPIServer.AddPostStartHook("start-apiextensions-informers", func(context genericapiserver.PostStartHookContext) error { s.GenericAPIServer.AddPostStartHook("start-apiextensions-informers", func(context genericapiserver.PostStartHookContext) error {
customResourceInformers.Start(context.StopCh) customResourceDefinitionInformers.Start(context.StopCh)
return nil return nil
}) })
s.GenericAPIServer.AddPostStartHook("start-apiextensions-controllers", func(context genericapiserver.PostStartHookContext) error { s.GenericAPIServer.AddPostStartHook("start-apiextensions-controllers", func(context genericapiserver.PostStartHookContext) error {
go customResourceController.Run(context.StopCh) go customResourceDefinitionController.Run(context.StopCh)
return nil return nil
}) })
......
...@@ -40,8 +40,8 @@ type DiscoveryController struct { ...@@ -40,8 +40,8 @@ type DiscoveryController struct {
versionHandler *versionDiscoveryHandler versionHandler *versionDiscoveryHandler
groupHandler *groupDiscoveryHandler groupHandler *groupDiscoveryHandler
customResourceLister listers.CustomResourceLister customResourceDefinitionLister listers.CustomResourceDefinitionLister
customResourcesSynced cache.InformerSynced customResourceDefinitionsSynced cache.InformerSynced
// To allow injection for testing. // To allow injection for testing.
syncFn func(version schema.GroupVersion) error syncFn func(version schema.GroupVersion) error
...@@ -49,20 +49,20 @@ type DiscoveryController struct { ...@@ -49,20 +49,20 @@ type DiscoveryController struct {
queue workqueue.RateLimitingInterface queue workqueue.RateLimitingInterface
} }
func NewDiscoveryController(customResourceInformer informers.CustomResourceInformer, versionHandler *versionDiscoveryHandler, groupHandler *groupDiscoveryHandler) *DiscoveryController { func NewDiscoveryController(customResourceDefinitionInformer informers.CustomResourceDefinitionInformer, versionHandler *versionDiscoveryHandler, groupHandler *groupDiscoveryHandler) *DiscoveryController {
c := &DiscoveryController{ c := &DiscoveryController{
versionHandler: versionHandler, versionHandler: versionHandler,
groupHandler: groupHandler, groupHandler: groupHandler,
customResourceLister: customResourceInformer.Lister(), customResourceDefinitionLister: customResourceDefinitionInformer.Lister(),
customResourcesSynced: customResourceInformer.Informer().HasSynced, customResourceDefinitionsSynced: customResourceDefinitionInformer.Informer().HasSynced,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "DiscoveryController"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "DiscoveryController"),
} }
customResourceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ customResourceDefinitionInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: c.addCustomResource, AddFunc: c.addCustomResourceDefinition,
UpdateFunc: c.updateCustomResource, UpdateFunc: c.updateCustomResourceDefinition,
DeleteFunc: c.deleteCustomResource, DeleteFunc: c.deleteCustomResourceDefinition,
}) })
c.syncFn = c.sync c.syncFn = c.sync
...@@ -75,36 +75,36 @@ func (c *DiscoveryController) sync(version schema.GroupVersion) error { ...@@ -75,36 +75,36 @@ func (c *DiscoveryController) sync(version schema.GroupVersion) error {
apiVersionsForDiscovery := []metav1.GroupVersionForDiscovery{} apiVersionsForDiscovery := []metav1.GroupVersionForDiscovery{}
apiResourcesForDiscovery := []metav1.APIResource{} apiResourcesForDiscovery := []metav1.APIResource{}
customResources, err := c.customResourceLister.List(labels.Everything()) customResourceDefinitions, err := c.customResourceDefinitionLister.List(labels.Everything())
if err != nil { if err != nil {
return err return err
} }
foundVersion := false foundVersion := false
foundGroup := false foundGroup := false
for _, customResource := range customResources { for _, customResourceDefinition := range customResourceDefinitions {
// TODO add status checking // TODO add status checking
if customResource.Spec.Group != version.Group { if customResourceDefinition.Spec.Group != version.Group {
continue continue
} }
foundGroup = true foundGroup = true
apiVersionsForDiscovery = append(apiVersionsForDiscovery, metav1.GroupVersionForDiscovery{ apiVersionsForDiscovery = append(apiVersionsForDiscovery, metav1.GroupVersionForDiscovery{
GroupVersion: customResource.Spec.Group + "/" + customResource.Spec.Version, GroupVersion: customResourceDefinition.Spec.Group + "/" + customResourceDefinition.Spec.Version,
Version: customResource.Spec.Version, Version: customResourceDefinition.Spec.Version,
}) })
if customResource.Spec.Version != version.Version { if customResourceDefinition.Spec.Version != version.Version {
continue continue
} }
foundVersion = true foundVersion = true
apiResourcesForDiscovery = append(apiResourcesForDiscovery, metav1.APIResource{ apiResourcesForDiscovery = append(apiResourcesForDiscovery, metav1.APIResource{
Name: customResource.Spec.Names.Plural, Name: customResourceDefinition.Spec.Names.Plural,
SingularName: customResource.Spec.Names.Singular, SingularName: customResourceDefinition.Spec.Names.Singular,
Namespaced: customResource.Spec.Scope == apiextensions.NamespaceScoped, Namespaced: customResourceDefinition.Spec.Scope == apiextensions.NamespaceScoped,
Kind: customResource.Spec.Names.Kind, Kind: customResourceDefinition.Spec.Names.Kind,
Verbs: metav1.Verbs([]string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"}), Verbs: metav1.Verbs([]string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"}),
ShortNames: customResource.Spec.Names.ShortNames, ShortNames: customResourceDefinition.Spec.Names.ShortNames,
}) })
} }
...@@ -140,7 +140,7 @@ func (c *DiscoveryController) Run(stopCh <-chan struct{}) { ...@@ -140,7 +140,7 @@ func (c *DiscoveryController) Run(stopCh <-chan struct{}) {
glog.Infof("Starting DiscoveryController") glog.Infof("Starting DiscoveryController")
if !cache.WaitForCacheSync(stopCh, c.customResourcesSynced) { if !cache.WaitForCacheSync(stopCh, c.customResourceDefinitionsSynced) {
utilruntime.HandleError(fmt.Errorf("timed out waiting for caches to sync")) utilruntime.HandleError(fmt.Errorf("timed out waiting for caches to sync"))
return return
} }
...@@ -176,36 +176,36 @@ func (c *DiscoveryController) processNextWorkItem() bool { ...@@ -176,36 +176,36 @@ func (c *DiscoveryController) processNextWorkItem() bool {
return true return true
} }
func (c *DiscoveryController) enqueue(obj *apiextensions.CustomResource) { func (c *DiscoveryController) enqueue(obj *apiextensions.CustomResourceDefinition) {
c.queue.Add(schema.GroupVersion{Group: obj.Spec.Group, Version: obj.Spec.Version}) c.queue.Add(schema.GroupVersion{Group: obj.Spec.Group, Version: obj.Spec.Version})
} }
func (c *DiscoveryController) addCustomResource(obj interface{}) { func (c *DiscoveryController) addCustomResourceDefinition(obj interface{}) {
castObj := obj.(*apiextensions.CustomResource) castObj := obj.(*apiextensions.CustomResourceDefinition)
glog.V(4).Infof("Adding customresource %s", castObj.Name) glog.V(4).Infof("Adding customresourcedefinition %s", castObj.Name)
c.enqueue(castObj) c.enqueue(castObj)
} }
func (c *DiscoveryController) updateCustomResource(obj, _ interface{}) { func (c *DiscoveryController) updateCustomResourceDefinition(obj, _ interface{}) {
castObj := obj.(*apiextensions.CustomResource) castObj := obj.(*apiextensions.CustomResourceDefinition)
glog.V(4).Infof("Updating customresource %s", castObj.Name) glog.V(4).Infof("Updating customresourcedefinition %s", castObj.Name)
c.enqueue(castObj) c.enqueue(castObj)
} }
func (c *DiscoveryController) deleteCustomResource(obj interface{}) { func (c *DiscoveryController) deleteCustomResourceDefinition(obj interface{}) {
castObj, ok := obj.(*apiextensions.CustomResource) castObj, ok := obj.(*apiextensions.CustomResourceDefinition)
if !ok { if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown) tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok { if !ok {
glog.Errorf("Couldn't get object from tombstone %#v", obj) glog.Errorf("Couldn't get object from tombstone %#v", obj)
return return
} }
castObj, ok = tombstone.Obj.(*apiextensions.CustomResource) castObj, ok = tombstone.Obj.(*apiextensions.CustomResourceDefinition)
if !ok { if !ok {
glog.Errorf("Tombstone contained object that is not expected %#v", obj) glog.Errorf("Tombstone contained object that is not expected %#v", obj)
return return
} }
} }
glog.V(4).Infof("Deleting customresource %q", castObj.Name) glog.V(4).Infof("Deleting customresourcedefinition %q", castObj.Name)
c.enqueue(castObj) c.enqueue(castObj)
} }
...@@ -11,7 +11,7 @@ go_library( ...@@ -11,7 +11,7 @@ go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"apiextensions_client.go", "apiextensions_client.go",
"customresource.go", "customresourcedefinition.go",
"doc.go", "doc.go",
"generated_expansion.go", "generated_expansion.go",
], ],
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
type ApiextensionsV1alpha1Interface interface { type ApiextensionsV1alpha1Interface interface {
RESTClient() rest.Interface RESTClient() rest.Interface
CustomResourcesGetter CustomResourceDefinitionsGetter
} }
// ApiextensionsV1alpha1Client is used to interact with features provided by the apiextensions.k8s.io group. // ApiextensionsV1alpha1Client is used to interact with features provided by the apiextensions.k8s.io group.
...@@ -33,8 +33,8 @@ type ApiextensionsV1alpha1Client struct { ...@@ -33,8 +33,8 @@ type ApiextensionsV1alpha1Client struct {
restClient rest.Interface restClient rest.Interface
} }
func (c *ApiextensionsV1alpha1Client) CustomResources() CustomResourceInterface { func (c *ApiextensionsV1alpha1Client) CustomResourceDefinitions() CustomResourceDefinitionInterface {
return newCustomResources(c) return newCustomResourceDefinitions(c)
} }
// NewForConfig creates a new ApiextensionsV1alpha1Client for the given config. // NewForConfig creates a new ApiextensionsV1alpha1Client for the given config.
......
/*
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 v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1"
scheme "k8s.io/kube-apiextensions-server/pkg/client/clientset/clientset/scheme"
)
// CustomResourcesGetter has a method to return a CustomResourceInterface.
// A group's client should implement this interface.
type CustomResourcesGetter interface {
CustomResources() CustomResourceInterface
}
// CustomResourceInterface has methods to work with CustomResource resources.
type CustomResourceInterface interface {
Create(*v1alpha1.CustomResource) (*v1alpha1.CustomResource, error)
Update(*v1alpha1.CustomResource) (*v1alpha1.CustomResource, error)
UpdateStatus(*v1alpha1.CustomResource) (*v1alpha1.CustomResource, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.CustomResource, error)
List(opts v1.ListOptions) (*v1alpha1.CustomResourceList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CustomResource, err error)
CustomResourceExpansion
}
// customResources implements CustomResourceInterface
type customResources struct {
client rest.Interface
}
// newCustomResources returns a CustomResources
func newCustomResources(c *ApiextensionsV1alpha1Client) *customResources {
return &customResources{
client: c.RESTClient(),
}
}
// Create takes the representation of a customResource and creates it. Returns the server's representation of the customResource, and an error, if there is any.
func (c *customResources) Create(customResource *v1alpha1.CustomResource) (result *v1alpha1.CustomResource, err error) {
result = &v1alpha1.CustomResource{}
err = c.client.Post().
Resource("customresources").
Body(customResource).
Do().
Into(result)
return
}
// Update takes the representation of a customResource and updates it. Returns the server's representation of the customResource, and an error, if there is any.
func (c *customResources) Update(customResource *v1alpha1.CustomResource) (result *v1alpha1.CustomResource, err error) {
result = &v1alpha1.CustomResource{}
err = c.client.Put().
Resource("customresources").
Name(customResource.Name).
Body(customResource).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *customResources) UpdateStatus(customResource *v1alpha1.CustomResource) (result *v1alpha1.CustomResource, err error) {
result = &v1alpha1.CustomResource{}
err = c.client.Put().
Resource("customresources").
Name(customResource.Name).
SubResource("status").
Body(customResource).
Do().
Into(result)
return
}
// Delete takes name of the customResource and deletes it. Returns an error if one occurs.
func (c *customResources) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Resource("customresources").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *customResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Resource("customresources").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the customResource, and returns the corresponding customResource object, and an error if there is any.
func (c *customResources) Get(name string, options v1.GetOptions) (result *v1alpha1.CustomResource, err error) {
result = &v1alpha1.CustomResource{}
err = c.client.Get().
Resource("customresources").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of CustomResources that match those selectors.
func (c *customResources) List(opts v1.ListOptions) (result *v1alpha1.CustomResourceList, err error) {
result = &v1alpha1.CustomResourceList{}
err = c.client.Get().
Resource("customresources").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested customResources.
func (c *customResources) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Resource("customresources").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched customResource.
func (c *customResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CustomResource, err error) {
result = &v1alpha1.CustomResource{}
err = c.client.Patch(pt).
Resource("customresources").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
/*
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 v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1"
scheme "k8s.io/kube-apiextensions-server/pkg/client/clientset/clientset/scheme"
)
// CustomResourceDefinitionsGetter has a method to return a CustomResourceDefinitionInterface.
// A group's client should implement this interface.
type CustomResourceDefinitionsGetter interface {
CustomResourceDefinitions() CustomResourceDefinitionInterface
}
// CustomResourceDefinitionInterface has methods to work with CustomResourceDefinition resources.
type CustomResourceDefinitionInterface interface {
Create(*v1alpha1.CustomResourceDefinition) (*v1alpha1.CustomResourceDefinition, error)
Update(*v1alpha1.CustomResourceDefinition) (*v1alpha1.CustomResourceDefinition, error)
UpdateStatus(*v1alpha1.CustomResourceDefinition) (*v1alpha1.CustomResourceDefinition, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.CustomResourceDefinition, error)
List(opts v1.ListOptions) (*v1alpha1.CustomResourceDefinitionList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CustomResourceDefinition, err error)
CustomResourceDefinitionExpansion
}
// customResourceDefinitions implements CustomResourceDefinitionInterface
type customResourceDefinitions struct {
client rest.Interface
}
// newCustomResourceDefinitions returns a CustomResourceDefinitions
func newCustomResourceDefinitions(c *ApiextensionsV1alpha1Client) *customResourceDefinitions {
return &customResourceDefinitions{
client: c.RESTClient(),
}
}
// Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *customResourceDefinitions) Create(customResourceDefinition *v1alpha1.CustomResourceDefinition) (result *v1alpha1.CustomResourceDefinition, err error) {
result = &v1alpha1.CustomResourceDefinition{}
err = c.client.Post().
Resource("customresourcedefinitions").
Body(customResourceDefinition).
Do().
Into(result)
return
}
// Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *customResourceDefinitions) Update(customResourceDefinition *v1alpha1.CustomResourceDefinition) (result *v1alpha1.CustomResourceDefinition, err error) {
result = &v1alpha1.CustomResourceDefinition{}
err = c.client.Put().
Resource("customresourcedefinitions").
Name(customResourceDefinition.Name).
Body(customResourceDefinition).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *customResourceDefinitions) UpdateStatus(customResourceDefinition *v1alpha1.CustomResourceDefinition) (result *v1alpha1.CustomResourceDefinition, err error) {
result = &v1alpha1.CustomResourceDefinition{}
err = c.client.Put().
Resource("customresourcedefinitions").
Name(customResourceDefinition.Name).
SubResource("status").
Body(customResourceDefinition).
Do().
Into(result)
return
}
// Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs.
func (c *customResourceDefinitions) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Resource("customresourcedefinitions").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *customResourceDefinitions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Resource("customresourcedefinitions").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any.
func (c *customResourceDefinitions) Get(name string, options v1.GetOptions) (result *v1alpha1.CustomResourceDefinition, err error) {
result = &v1alpha1.CustomResourceDefinition{}
err = c.client.Get().
Resource("customresourcedefinitions").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors.
func (c *customResourceDefinitions) List(opts v1.ListOptions) (result *v1alpha1.CustomResourceDefinitionList, err error) {
result = &v1alpha1.CustomResourceDefinitionList{}
err = c.client.Get().
Resource("customresourcedefinitions").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested customResourceDefinitions.
func (c *customResourceDefinitions) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Resource("customresourcedefinitions").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched customResourceDefinition.
func (c *customResourceDefinitions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CustomResourceDefinition, err error) {
result = &v1alpha1.CustomResourceDefinition{}
err = c.client.Patch(pt).
Resource("customresourcedefinitions").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
...@@ -12,7 +12,7 @@ go_library( ...@@ -12,7 +12,7 @@ go_library(
srcs = [ srcs = [
"doc.go", "doc.go",
"fake_apiextensions_client.go", "fake_apiextensions_client.go",
"fake_customresource.go", "fake_customresourcedefinition.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -26,8 +26,8 @@ type FakeApiextensionsV1alpha1 struct { ...@@ -26,8 +26,8 @@ type FakeApiextensionsV1alpha1 struct {
*testing.Fake *testing.Fake
} }
func (c *FakeApiextensionsV1alpha1) CustomResources() v1alpha1.CustomResourceInterface { func (c *FakeApiextensionsV1alpha1) CustomResourceDefinitions() v1alpha1.CustomResourceDefinitionInterface {
return &FakeCustomResources{c} return &FakeCustomResourceDefinitions{c}
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate
......
...@@ -26,67 +26,67 @@ import ( ...@@ -26,67 +26,67 @@ import (
v1alpha1 "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1" v1alpha1 "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1"
) )
// FakeCustomResources implements CustomResourceInterface // FakeCustomResourceDefinitions implements CustomResourceDefinitionInterface
type FakeCustomResources struct { type FakeCustomResourceDefinitions struct {
Fake *FakeApiextensionsV1alpha1 Fake *FakeApiextensionsV1alpha1
} }
var customresourcesResource = schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "v1alpha1", Resource: "customresources"} var customresourcedefinitionsResource = schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "v1alpha1", Resource: "customresourcedefinitions"}
var customresourcesKind = schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "v1alpha1", Kind: "CustomResource"} var customresourcedefinitionsKind = schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "v1alpha1", Kind: "CustomResourceDefinition"}
func (c *FakeCustomResources) Create(customResource *v1alpha1.CustomResource) (result *v1alpha1.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Create(customResourceDefinition *v1alpha1.CustomResourceDefinition) (result *v1alpha1.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(customresourcesResource, customResource), &v1alpha1.CustomResource{}) Invokes(testing.NewRootCreateAction(customresourcedefinitionsResource, customResourceDefinition), &v1alpha1.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.CustomResource), err return obj.(*v1alpha1.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) Update(customResource *v1alpha1.CustomResource) (result *v1alpha1.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Update(customResourceDefinition *v1alpha1.CustomResourceDefinition) (result *v1alpha1.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(customresourcesResource, customResource), &v1alpha1.CustomResource{}) Invokes(testing.NewRootUpdateAction(customresourcedefinitionsResource, customResourceDefinition), &v1alpha1.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.CustomResource), err return obj.(*v1alpha1.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) UpdateStatus(customResource *v1alpha1.CustomResource) (*v1alpha1.CustomResource, error) { func (c *FakeCustomResourceDefinitions) UpdateStatus(customResourceDefinition *v1alpha1.CustomResourceDefinition) (*v1alpha1.CustomResourceDefinition, error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(customresourcesResource, "status", customResource), &v1alpha1.CustomResource{}) Invokes(testing.NewRootUpdateSubresourceAction(customresourcedefinitionsResource, "status", customResourceDefinition), &v1alpha1.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.CustomResource), err return obj.(*v1alpha1.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeCustomResourceDefinitions) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewRootDeleteAction(customresourcesResource, name), &v1alpha1.CustomResource{}) Invokes(testing.NewRootDeleteAction(customresourcedefinitionsResource, name), &v1alpha1.CustomResourceDefinition{})
return err return err
} }
func (c *FakeCustomResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { func (c *FakeCustomResourceDefinitions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(customresourcesResource, listOptions) action := testing.NewRootDeleteCollectionAction(customresourcedefinitionsResource, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.CustomResourceList{}) _, err := c.Fake.Invokes(action, &v1alpha1.CustomResourceDefinitionList{})
return err return err
} }
func (c *FakeCustomResources) Get(name string, options v1.GetOptions) (result *v1alpha1.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Get(name string, options v1.GetOptions) (result *v1alpha1.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootGetAction(customresourcesResource, name), &v1alpha1.CustomResource{}) Invokes(testing.NewRootGetAction(customresourcedefinitionsResource, name), &v1alpha1.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.CustomResource), err return obj.(*v1alpha1.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) List(opts v1.ListOptions) (result *v1alpha1.CustomResourceList, err error) { func (c *FakeCustomResourceDefinitions) List(opts v1.ListOptions) (result *v1alpha1.CustomResourceDefinitionList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootListAction(customresourcesResource, customresourcesKind, opts), &v1alpha1.CustomResourceList{}) Invokes(testing.NewRootListAction(customresourcedefinitionsResource, customresourcedefinitionsKind, opts), &v1alpha1.CustomResourceDefinitionList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -95,8 +95,8 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *v1alpha1.Custom ...@@ -95,8 +95,8 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *v1alpha1.Custom
if label == nil { if label == nil {
label = labels.Everything() label = labels.Everything()
} }
list := &v1alpha1.CustomResourceList{} list := &v1alpha1.CustomResourceDefinitionList{}
for _, item := range obj.(*v1alpha1.CustomResourceList).Items { for _, item := range obj.(*v1alpha1.CustomResourceDefinitionList).Items {
if label.Matches(labels.Set(item.Labels)) { if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item) list.Items = append(list.Items, item)
} }
...@@ -104,18 +104,18 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *v1alpha1.Custom ...@@ -104,18 +104,18 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *v1alpha1.Custom
return list, err return list, err
} }
// Watch returns a watch.Interface that watches the requested customResources. // Watch returns a watch.Interface that watches the requested customResourceDefinitions.
func (c *FakeCustomResources) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *FakeCustomResourceDefinitions) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(testing.NewRootWatchAction(customresourcesResource, opts)) InvokesWatch(testing.NewRootWatchAction(customresourcedefinitionsResource, opts))
} }
// Patch applies the patch and returns the patched customResource. // Patch applies the patch and returns the patched customResourceDefinition.
func (c *FakeCustomResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(customresourcesResource, name, data, subresources...), &v1alpha1.CustomResource{}) Invokes(testing.NewRootPatchSubresourceAction(customresourcedefinitionsResource, name, data, subresources...), &v1alpha1.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.CustomResource), err return obj.(*v1alpha1.CustomResourceDefinition), err
} }
...@@ -16,4 +16,4 @@ limitations under the License. ...@@ -16,4 +16,4 @@ limitations under the License.
package v1alpha1 package v1alpha1
type CustomResourceExpansion interface{} type CustomResourceDefinitionExpansion interface{}
...@@ -11,7 +11,7 @@ go_library( ...@@ -11,7 +11,7 @@ go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"apiextensions_client.go", "apiextensions_client.go",
"customresource.go", "customresourcedefinition.go",
"doc.go", "doc.go",
"generated_expansion.go", "generated_expansion.go",
], ],
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
type ApiextensionsInterface interface { type ApiextensionsInterface interface {
RESTClient() rest.Interface RESTClient() rest.Interface
CustomResourcesGetter CustomResourceDefinitionsGetter
} }
// ApiextensionsClient is used to interact with features provided by the apiextensions.k8s.io group. // ApiextensionsClient is used to interact with features provided by the apiextensions.k8s.io group.
...@@ -31,8 +31,8 @@ type ApiextensionsClient struct { ...@@ -31,8 +31,8 @@ type ApiextensionsClient struct {
restClient rest.Interface restClient rest.Interface
} }
func (c *ApiextensionsClient) CustomResources() CustomResourceInterface { func (c *ApiextensionsClient) CustomResourceDefinitions() CustomResourceDefinitionInterface {
return newCustomResources(c) return newCustomResourceDefinitions(c)
} }
// NewForConfig creates a new ApiextensionsClient for the given config. // NewForConfig creates a new ApiextensionsClient for the given config.
......
...@@ -25,56 +25,56 @@ import ( ...@@ -25,56 +25,56 @@ import (
scheme "k8s.io/kube-apiextensions-server/pkg/client/clientset/internalclientset/scheme" scheme "k8s.io/kube-apiextensions-server/pkg/client/clientset/internalclientset/scheme"
) )
// CustomResourcesGetter has a method to return a CustomResourceInterface. // CustomResourceDefinitionsGetter has a method to return a CustomResourceDefinitionInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type CustomResourcesGetter interface { type CustomResourceDefinitionsGetter interface {
CustomResources() CustomResourceInterface CustomResourceDefinitions() CustomResourceDefinitionInterface
} }
// CustomResourceInterface has methods to work with CustomResource resources. // CustomResourceDefinitionInterface has methods to work with CustomResourceDefinition resources.
type CustomResourceInterface interface { type CustomResourceDefinitionInterface interface {
Create(*apiextensions.CustomResource) (*apiextensions.CustomResource, error) Create(*apiextensions.CustomResourceDefinition) (*apiextensions.CustomResourceDefinition, error)
Update(*apiextensions.CustomResource) (*apiextensions.CustomResource, error) Update(*apiextensions.CustomResourceDefinition) (*apiextensions.CustomResourceDefinition, error)
UpdateStatus(*apiextensions.CustomResource) (*apiextensions.CustomResource, error) UpdateStatus(*apiextensions.CustomResourceDefinition) (*apiextensions.CustomResourceDefinition, error)
Delete(name string, options *v1.DeleteOptions) error Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*apiextensions.CustomResource, error) Get(name string, options v1.GetOptions) (*apiextensions.CustomResourceDefinition, error)
List(opts v1.ListOptions) (*apiextensions.CustomResourceList, error) List(opts v1.ListOptions) (*apiextensions.CustomResourceDefinitionList, error)
Watch(opts v1.ListOptions) (watch.Interface, error) Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apiextensions.CustomResource, err error) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apiextensions.CustomResourceDefinition, err error)
CustomResourceExpansion CustomResourceDefinitionExpansion
} }
// customResources implements CustomResourceInterface // customResourceDefinitions implements CustomResourceDefinitionInterface
type customResources struct { type customResourceDefinitions struct {
client rest.Interface client rest.Interface
} }
// newCustomResources returns a CustomResources // newCustomResourceDefinitions returns a CustomResourceDefinitions
func newCustomResources(c *ApiextensionsClient) *customResources { func newCustomResourceDefinitions(c *ApiextensionsClient) *customResourceDefinitions {
return &customResources{ return &customResourceDefinitions{
client: c.RESTClient(), client: c.RESTClient(),
} }
} }
// Create takes the representation of a customResource and creates it. Returns the server's representation of the customResource, and an error, if there is any. // Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *customResources) Create(customResource *apiextensions.CustomResource) (result *apiextensions.CustomResource, err error) { func (c *customResourceDefinitions) Create(customResourceDefinition *apiextensions.CustomResourceDefinition) (result *apiextensions.CustomResourceDefinition, err error) {
result = &apiextensions.CustomResource{} result = &apiextensions.CustomResourceDefinition{}
err = c.client.Post(). err = c.client.Post().
Resource("customresources"). Resource("customresourcedefinitions").
Body(customResource). Body(customResourceDefinition).
Do(). Do().
Into(result) Into(result)
return return
} }
// Update takes the representation of a customResource and updates it. Returns the server's representation of the customResource, and an error, if there is any. // Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *customResources) Update(customResource *apiextensions.CustomResource) (result *apiextensions.CustomResource, err error) { func (c *customResourceDefinitions) Update(customResourceDefinition *apiextensions.CustomResourceDefinition) (result *apiextensions.CustomResourceDefinition, err error) {
result = &apiextensions.CustomResource{} result = &apiextensions.CustomResourceDefinition{}
err = c.client.Put(). err = c.client.Put().
Resource("customresources"). Resource("customresourcedefinitions").
Name(customResource.Name). Name(customResourceDefinition.Name).
Body(customResource). Body(customResourceDefinition).
Do(). Do().
Into(result) Into(result)
return return
...@@ -83,22 +83,22 @@ func (c *customResources) Update(customResource *apiextensions.CustomResource) ( ...@@ -83,22 +83,22 @@ func (c *customResources) Update(customResource *apiextensions.CustomResource) (
// UpdateStatus was generated because the type contains a Status member. // UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus(). // Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *customResources) UpdateStatus(customResource *apiextensions.CustomResource) (result *apiextensions.CustomResource, err error) { func (c *customResourceDefinitions) UpdateStatus(customResourceDefinition *apiextensions.CustomResourceDefinition) (result *apiextensions.CustomResourceDefinition, err error) {
result = &apiextensions.CustomResource{} result = &apiextensions.CustomResourceDefinition{}
err = c.client.Put(). err = c.client.Put().
Resource("customresources"). Resource("customresourcedefinitions").
Name(customResource.Name). Name(customResourceDefinition.Name).
SubResource("status"). SubResource("status").
Body(customResource). Body(customResourceDefinition).
Do(). Do().
Into(result) Into(result)
return return
} }
// Delete takes name of the customResource and deletes it. Returns an error if one occurs. // Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs.
func (c *customResources) Delete(name string, options *v1.DeleteOptions) error { func (c *customResourceDefinitions) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Resource("customresources"). Resource("customresourcedefinitions").
Name(name). Name(name).
Body(options). Body(options).
Do(). Do().
...@@ -106,20 +106,20 @@ func (c *customResources) Delete(name string, options *v1.DeleteOptions) error { ...@@ -106,20 +106,20 @@ func (c *customResources) Delete(name string, options *v1.DeleteOptions) error {
} }
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *customResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { func (c *customResourceDefinitions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete(). return c.client.Delete().
Resource("customresources"). Resource("customresourcedefinitions").
VersionedParams(&listOptions, scheme.ParameterCodec). VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options). Body(options).
Do(). Do().
Error() Error()
} }
// Get takes name of the customResource, and returns the corresponding customResource object, and an error if there is any. // Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any.
func (c *customResources) Get(name string, options v1.GetOptions) (result *apiextensions.CustomResource, err error) { func (c *customResourceDefinitions) Get(name string, options v1.GetOptions) (result *apiextensions.CustomResourceDefinition, err error) {
result = &apiextensions.CustomResource{} result = &apiextensions.CustomResourceDefinition{}
err = c.client.Get(). err = c.client.Get().
Resource("customresources"). Resource("customresourcedefinitions").
Name(name). Name(name).
VersionedParams(&options, scheme.ParameterCodec). VersionedParams(&options, scheme.ParameterCodec).
Do(). Do().
...@@ -127,31 +127,31 @@ func (c *customResources) Get(name string, options v1.GetOptions) (result *apiex ...@@ -127,31 +127,31 @@ func (c *customResources) Get(name string, options v1.GetOptions) (result *apiex
return return
} }
// List takes label and field selectors, and returns the list of CustomResources that match those selectors. // List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors.
func (c *customResources) List(opts v1.ListOptions) (result *apiextensions.CustomResourceList, err error) { func (c *customResourceDefinitions) List(opts v1.ListOptions) (result *apiextensions.CustomResourceDefinitionList, err error) {
result = &apiextensions.CustomResourceList{} result = &apiextensions.CustomResourceDefinitionList{}
err = c.client.Get(). err = c.client.Get().
Resource("customresources"). Resource("customresourcedefinitions").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Do(). Do().
Into(result) Into(result)
return return
} }
// Watch returns a watch.Interface that watches the requested customResources. // Watch returns a watch.Interface that watches the requested customResourceDefinitions.
func (c *customResources) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *customResourceDefinitions) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true opts.Watch = true
return c.client.Get(). return c.client.Get().
Resource("customresources"). Resource("customresourcedefinitions").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Watch() Watch()
} }
// Patch applies the patch and returns the patched customResource. // Patch applies the patch and returns the patched customResourceDefinition.
func (c *customResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apiextensions.CustomResource, err error) { func (c *customResourceDefinitions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apiextensions.CustomResourceDefinition, err error) {
result = &apiextensions.CustomResource{} result = &apiextensions.CustomResourceDefinition{}
err = c.client.Patch(pt). err = c.client.Patch(pt).
Resource("customresources"). Resource("customresourcedefinitions").
SubResource(subresources...). SubResource(subresources...).
Name(name). Name(name).
Body(data). Body(data).
......
...@@ -12,7 +12,7 @@ go_library( ...@@ -12,7 +12,7 @@ go_library(
srcs = [ srcs = [
"doc.go", "doc.go",
"fake_apiextensions_client.go", "fake_apiextensions_client.go",
"fake_customresource.go", "fake_customresourcedefinition.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -26,8 +26,8 @@ type FakeApiextensions struct { ...@@ -26,8 +26,8 @@ type FakeApiextensions struct {
*testing.Fake *testing.Fake
} }
func (c *FakeApiextensions) CustomResources() internalversion.CustomResourceInterface { func (c *FakeApiextensions) CustomResourceDefinitions() internalversion.CustomResourceDefinitionInterface {
return &FakeCustomResources{c} return &FakeCustomResourceDefinitions{c}
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate
......
...@@ -26,67 +26,67 @@ import ( ...@@ -26,67 +26,67 @@ import (
apiextensions "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions" apiextensions "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
) )
// FakeCustomResources implements CustomResourceInterface // FakeCustomResourceDefinitions implements CustomResourceDefinitionInterface
type FakeCustomResources struct { type FakeCustomResourceDefinitions struct {
Fake *FakeApiextensions Fake *FakeApiextensions
} }
var customresourcesResource = schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "", Resource: "customresources"} var customresourcedefinitionsResource = schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "", Resource: "customresourcedefinitions"}
var customresourcesKind = schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "", Kind: "CustomResource"} var customresourcedefinitionsKind = schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "", Kind: "CustomResourceDefinition"}
func (c *FakeCustomResources) Create(customResource *apiextensions.CustomResource) (result *apiextensions.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Create(customResourceDefinition *apiextensions.CustomResourceDefinition) (result *apiextensions.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(customresourcesResource, customResource), &apiextensions.CustomResource{}) Invokes(testing.NewRootCreateAction(customresourcedefinitionsResource, customResourceDefinition), &apiextensions.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*apiextensions.CustomResource), err return obj.(*apiextensions.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) Update(customResource *apiextensions.CustomResource) (result *apiextensions.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Update(customResourceDefinition *apiextensions.CustomResourceDefinition) (result *apiextensions.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(customresourcesResource, customResource), &apiextensions.CustomResource{}) Invokes(testing.NewRootUpdateAction(customresourcedefinitionsResource, customResourceDefinition), &apiextensions.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*apiextensions.CustomResource), err return obj.(*apiextensions.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) UpdateStatus(customResource *apiextensions.CustomResource) (*apiextensions.CustomResource, error) { func (c *FakeCustomResourceDefinitions) UpdateStatus(customResourceDefinition *apiextensions.CustomResourceDefinition) (*apiextensions.CustomResourceDefinition, error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(customresourcesResource, "status", customResource), &apiextensions.CustomResource{}) Invokes(testing.NewRootUpdateSubresourceAction(customresourcedefinitionsResource, "status", customResourceDefinition), &apiextensions.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*apiextensions.CustomResource), err return obj.(*apiextensions.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeCustomResourceDefinitions) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewRootDeleteAction(customresourcesResource, name), &apiextensions.CustomResource{}) Invokes(testing.NewRootDeleteAction(customresourcedefinitionsResource, name), &apiextensions.CustomResourceDefinition{})
return err return err
} }
func (c *FakeCustomResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { func (c *FakeCustomResourceDefinitions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(customresourcesResource, listOptions) action := testing.NewRootDeleteCollectionAction(customresourcedefinitionsResource, listOptions)
_, err := c.Fake.Invokes(action, &apiextensions.CustomResourceList{}) _, err := c.Fake.Invokes(action, &apiextensions.CustomResourceDefinitionList{})
return err return err
} }
func (c *FakeCustomResources) Get(name string, options v1.GetOptions) (result *apiextensions.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Get(name string, options v1.GetOptions) (result *apiextensions.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootGetAction(customresourcesResource, name), &apiextensions.CustomResource{}) Invokes(testing.NewRootGetAction(customresourcedefinitionsResource, name), &apiextensions.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*apiextensions.CustomResource), err return obj.(*apiextensions.CustomResourceDefinition), err
} }
func (c *FakeCustomResources) List(opts v1.ListOptions) (result *apiextensions.CustomResourceList, err error) { func (c *FakeCustomResourceDefinitions) List(opts v1.ListOptions) (result *apiextensions.CustomResourceDefinitionList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootListAction(customresourcesResource, customresourcesKind, opts), &apiextensions.CustomResourceList{}) Invokes(testing.NewRootListAction(customresourcedefinitionsResource, customresourcedefinitionsKind, opts), &apiextensions.CustomResourceDefinitionList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -95,8 +95,8 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *apiextensions.C ...@@ -95,8 +95,8 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *apiextensions.C
if label == nil { if label == nil {
label = labels.Everything() label = labels.Everything()
} }
list := &apiextensions.CustomResourceList{} list := &apiextensions.CustomResourceDefinitionList{}
for _, item := range obj.(*apiextensions.CustomResourceList).Items { for _, item := range obj.(*apiextensions.CustomResourceDefinitionList).Items {
if label.Matches(labels.Set(item.Labels)) { if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item) list.Items = append(list.Items, item)
} }
...@@ -104,18 +104,18 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *apiextensions.C ...@@ -104,18 +104,18 @@ func (c *FakeCustomResources) List(opts v1.ListOptions) (result *apiextensions.C
return list, err return list, err
} }
// Watch returns a watch.Interface that watches the requested customResources. // Watch returns a watch.Interface that watches the requested customResourceDefinitions.
func (c *FakeCustomResources) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *FakeCustomResourceDefinitions) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(testing.NewRootWatchAction(customresourcesResource, opts)) InvokesWatch(testing.NewRootWatchAction(customresourcedefinitionsResource, opts))
} }
// Patch applies the patch and returns the patched customResource. // Patch applies the patch and returns the patched customResourceDefinition.
func (c *FakeCustomResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apiextensions.CustomResource, err error) { func (c *FakeCustomResourceDefinitions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apiextensions.CustomResourceDefinition, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(customresourcesResource, name, data, subresources...), &apiextensions.CustomResource{}) Invokes(testing.NewRootPatchSubresourceAction(customresourcedefinitionsResource, name, data, subresources...), &apiextensions.CustomResourceDefinition{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*apiextensions.CustomResource), err return obj.(*apiextensions.CustomResourceDefinition), err
} }
...@@ -16,4 +16,4 @@ limitations under the License. ...@@ -16,4 +16,4 @@ limitations under the License.
package internalversion package internalversion
type CustomResourceExpansion interface{} type CustomResourceDefinitionExpansion interface{}
...@@ -10,7 +10,7 @@ load( ...@@ -10,7 +10,7 @@ load(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"customresource.go", "customresourcedefinition.go",
"interface.go", "interface.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
......
...@@ -30,28 +30,28 @@ import ( ...@@ -30,28 +30,28 @@ import (
time "time" time "time"
) )
// CustomResourceInformer provides access to a shared informer and lister for // CustomResourceDefinitionInformer provides access to a shared informer and lister for
// CustomResources. // CustomResourceDefinitions.
type CustomResourceInformer interface { type CustomResourceDefinitionInformer interface {
Informer() cache.SharedIndexInformer Informer() cache.SharedIndexInformer
Lister() v1alpha1.CustomResourceLister Lister() v1alpha1.CustomResourceDefinitionLister
} }
type customResourceInformer struct { type customResourceDefinitionInformer struct {
factory internalinterfaces.SharedInformerFactory factory internalinterfaces.SharedInformerFactory
} }
func newCustomResourceInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { func newCustomResourceDefinitionInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer( sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{ &cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) { ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.ApiextensionsV1alpha1().CustomResources().List(options) return client.ApiextensionsV1alpha1().CustomResourceDefinitions().List(options)
}, },
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.ApiextensionsV1alpha1().CustomResources().Watch(options) return client.ApiextensionsV1alpha1().CustomResourceDefinitions().Watch(options)
}, },
}, },
&apiextensions_v1alpha1.CustomResource{}, &apiextensions_v1alpha1.CustomResourceDefinition{},
resyncPeriod, resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
) )
...@@ -59,10 +59,10 @@ func newCustomResourceInformer(client clientset.Interface, resyncPeriod time.Dur ...@@ -59,10 +59,10 @@ func newCustomResourceInformer(client clientset.Interface, resyncPeriod time.Dur
return sharedIndexInformer return sharedIndexInformer
} }
func (f *customResourceInformer) Informer() cache.SharedIndexInformer { func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiextensions_v1alpha1.CustomResource{}, newCustomResourceInformer) return f.factory.InformerFor(&apiextensions_v1alpha1.CustomResourceDefinition{}, newCustomResourceDefinitionInformer)
} }
func (f *customResourceInformer) Lister() v1alpha1.CustomResourceLister { func (f *customResourceDefinitionInformer) Lister() v1alpha1.CustomResourceDefinitionLister {
return v1alpha1.NewCustomResourceLister(f.Informer().GetIndexer()) return v1alpha1.NewCustomResourceDefinitionLister(f.Informer().GetIndexer())
} }
...@@ -24,8 +24,8 @@ import ( ...@@ -24,8 +24,8 @@ import (
// Interface provides access to all the informers in this group version. // Interface provides access to all the informers in this group version.
type Interface interface { type Interface interface {
// CustomResources returns a CustomResourceInformer. // CustomResourceDefinitions returns a CustomResourceDefinitionInformer.
CustomResources() CustomResourceInformer CustomResourceDefinitions() CustomResourceDefinitionInformer
} }
type version struct { type version struct {
...@@ -37,7 +37,7 @@ func New(f internalinterfaces.SharedInformerFactory) Interface { ...@@ -37,7 +37,7 @@ func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f} return &version{f}
} }
// CustomResources returns a CustomResourceInformer. // CustomResourceDefinitions returns a CustomResourceDefinitionInformer.
func (v *version) CustomResources() CustomResourceInformer { func (v *version) CustomResourceDefinitions() CustomResourceDefinitionInformer {
return &customResourceInformer{factory: v.SharedInformerFactory} return &customResourceDefinitionInformer{factory: v.SharedInformerFactory}
} }
...@@ -52,8 +52,8 @@ func (f *genericInformer) Lister() cache.GenericLister { ...@@ -52,8 +52,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource { switch resource {
// Group=Apiextensions, Version=V1alpha1 // Group=Apiextensions, Version=V1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("customresources"): case v1alpha1.SchemeGroupVersion.WithResource("customresourcedefinitions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().V1alpha1().CustomResources().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().V1alpha1().CustomResourceDefinitions().Informer()}, nil
} }
......
...@@ -10,7 +10,7 @@ load( ...@@ -10,7 +10,7 @@ load(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"customresource.go", "customresourcedefinition.go",
"interface.go", "interface.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
......
...@@ -30,28 +30,28 @@ import ( ...@@ -30,28 +30,28 @@ import (
time "time" time "time"
) )
// CustomResourceInformer provides access to a shared informer and lister for // CustomResourceDefinitionInformer provides access to a shared informer and lister for
// CustomResources. // CustomResourceDefinitions.
type CustomResourceInformer interface { type CustomResourceDefinitionInformer interface {
Informer() cache.SharedIndexInformer Informer() cache.SharedIndexInformer
Lister() internalversion.CustomResourceLister Lister() internalversion.CustomResourceDefinitionLister
} }
type customResourceInformer struct { type customResourceDefinitionInformer struct {
factory internalinterfaces.SharedInformerFactory factory internalinterfaces.SharedInformerFactory
} }
func newCustomResourceInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { func newCustomResourceDefinitionInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer( sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{ &cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) { ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.Apiextensions().CustomResources().List(options) return client.Apiextensions().CustomResourceDefinitions().List(options)
}, },
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.Apiextensions().CustomResources().Watch(options) return client.Apiextensions().CustomResourceDefinitions().Watch(options)
}, },
}, },
&apiextensions.CustomResource{}, &apiextensions.CustomResourceDefinition{},
resyncPeriod, resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
) )
...@@ -59,10 +59,10 @@ func newCustomResourceInformer(client internalclientset.Interface, resyncPeriod ...@@ -59,10 +59,10 @@ func newCustomResourceInformer(client internalclientset.Interface, resyncPeriod
return sharedIndexInformer return sharedIndexInformer
} }
func (f *customResourceInformer) Informer() cache.SharedIndexInformer { func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiextensions.CustomResource{}, newCustomResourceInformer) return f.factory.InformerFor(&apiextensions.CustomResourceDefinition{}, newCustomResourceDefinitionInformer)
} }
func (f *customResourceInformer) Lister() internalversion.CustomResourceLister { func (f *customResourceDefinitionInformer) Lister() internalversion.CustomResourceDefinitionLister {
return internalversion.NewCustomResourceLister(f.Informer().GetIndexer()) return internalversion.NewCustomResourceDefinitionLister(f.Informer().GetIndexer())
} }
...@@ -24,8 +24,8 @@ import ( ...@@ -24,8 +24,8 @@ import (
// Interface provides access to all the informers in this group version. // Interface provides access to all the informers in this group version.
type Interface interface { type Interface interface {
// CustomResources returns a CustomResourceInformer. // CustomResourceDefinitions returns a CustomResourceDefinitionInformer.
CustomResources() CustomResourceInformer CustomResourceDefinitions() CustomResourceDefinitionInformer
} }
type version struct { type version struct {
...@@ -37,7 +37,7 @@ func New(f internalinterfaces.SharedInformerFactory) Interface { ...@@ -37,7 +37,7 @@ func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f} return &version{f}
} }
// CustomResources returns a CustomResourceInformer. // CustomResourceDefinitions returns a CustomResourceDefinitionInformer.
func (v *version) CustomResources() CustomResourceInformer { func (v *version) CustomResourceDefinitions() CustomResourceDefinitionInformer {
return &customResourceInformer{factory: v.SharedInformerFactory} return &customResourceDefinitionInformer{factory: v.SharedInformerFactory}
} }
...@@ -52,8 +52,8 @@ func (f *genericInformer) Lister() cache.GenericLister { ...@@ -52,8 +52,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource { switch resource {
// Group=Apiextensions, Version=InternalVersion // Group=Apiextensions, Version=InternalVersion
case apiextensions.SchemeGroupVersion.WithResource("customresources"): case apiextensions.SchemeGroupVersion.WithResource("customresourcedefinitions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().InternalVersion().CustomResources().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().InternalVersion().CustomResourceDefinitions().Informer()}, nil
} }
......
...@@ -10,7 +10,7 @@ load( ...@@ -10,7 +10,7 @@ load(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"customresource.go", "customresourcedefinition.go",
"expansion_generated.go", "expansion_generated.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
......
...@@ -26,42 +26,42 @@ import ( ...@@ -26,42 +26,42 @@ import (
apiextensions "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions" apiextensions "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
) )
// CustomResourceLister helps list CustomResources. // CustomResourceDefinitionLister helps list CustomResourceDefinitions.
type CustomResourceLister interface { type CustomResourceDefinitionLister interface {
// List lists all CustomResources in the indexer. // List lists all CustomResourceDefinitions in the indexer.
List(selector labels.Selector) (ret []*apiextensions.CustomResource, err error) List(selector labels.Selector) (ret []*apiextensions.CustomResourceDefinition, err error)
// Get retrieves the CustomResource from the index for a given name. // Get retrieves the CustomResourceDefinition from the index for a given name.
Get(name string) (*apiextensions.CustomResource, error) Get(name string) (*apiextensions.CustomResourceDefinition, error)
CustomResourceListerExpansion CustomResourceDefinitionListerExpansion
} }
// customResourceLister implements the CustomResourceLister interface. // customResourceDefinitionLister implements the CustomResourceDefinitionLister interface.
type customResourceLister struct { type customResourceDefinitionLister struct {
indexer cache.Indexer indexer cache.Indexer
} }
// NewCustomResourceLister returns a new CustomResourceLister. // NewCustomResourceDefinitionLister returns a new CustomResourceDefinitionLister.
func NewCustomResourceLister(indexer cache.Indexer) CustomResourceLister { func NewCustomResourceDefinitionLister(indexer cache.Indexer) CustomResourceDefinitionLister {
return &customResourceLister{indexer: indexer} return &customResourceDefinitionLister{indexer: indexer}
} }
// List lists all CustomResources in the indexer. // List lists all CustomResourceDefinitions in the indexer.
func (s *customResourceLister) List(selector labels.Selector) (ret []*apiextensions.CustomResource, err error) { func (s *customResourceDefinitionLister) List(selector labels.Selector) (ret []*apiextensions.CustomResourceDefinition, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) { err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*apiextensions.CustomResource)) ret = append(ret, m.(*apiextensions.CustomResourceDefinition))
}) })
return ret, err return ret, err
} }
// Get retrieves the CustomResource from the index for a given name. // Get retrieves the CustomResourceDefinition from the index for a given name.
func (s *customResourceLister) Get(name string) (*apiextensions.CustomResource, error) { func (s *customResourceDefinitionLister) Get(name string) (*apiextensions.CustomResourceDefinition, error) {
key := &apiextensions.CustomResource{ObjectMeta: v1.ObjectMeta{Name: name}} key := &apiextensions.CustomResourceDefinition{ObjectMeta: v1.ObjectMeta{Name: name}}
obj, exists, err := s.indexer.Get(key) obj, exists, err := s.indexer.Get(key)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !exists { if !exists {
return nil, errors.NewNotFound(apiextensions.Resource("customresource"), name) return nil, errors.NewNotFound(apiextensions.Resource("customresourcedefinition"), name)
} }
return obj.(*apiextensions.CustomResource), nil return obj.(*apiextensions.CustomResourceDefinition), nil
} }
...@@ -18,6 +18,6 @@ limitations under the License. ...@@ -18,6 +18,6 @@ limitations under the License.
package internalversion package internalversion
// CustomResourceListerExpansion allows custom methods to be added to // CustomResourceDefinitionListerExpansion allows custom methods to be added to
// CustomResourceLister. // CustomResourceDefinitionLister.
type CustomResourceListerExpansion interface{} type CustomResourceDefinitionListerExpansion interface{}
...@@ -10,7 +10,7 @@ load( ...@@ -10,7 +10,7 @@ load(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"customresource.go", "customresourcedefinition.go",
"expansion_generated.go", "expansion_generated.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
......
...@@ -26,42 +26,42 @@ import ( ...@@ -26,42 +26,42 @@ import (
v1alpha1 "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1" v1alpha1 "k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/v1alpha1"
) )
// CustomResourceLister helps list CustomResources. // CustomResourceDefinitionLister helps list CustomResourceDefinitions.
type CustomResourceLister interface { type CustomResourceDefinitionLister interface {
// List lists all CustomResources in the indexer. // List lists all CustomResourceDefinitions in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.CustomResource, err error) List(selector labels.Selector) (ret []*v1alpha1.CustomResourceDefinition, err error)
// Get retrieves the CustomResource from the index for a given name. // Get retrieves the CustomResourceDefinition from the index for a given name.
Get(name string) (*v1alpha1.CustomResource, error) Get(name string) (*v1alpha1.CustomResourceDefinition, error)
CustomResourceListerExpansion CustomResourceDefinitionListerExpansion
} }
// customResourceLister implements the CustomResourceLister interface. // customResourceDefinitionLister implements the CustomResourceDefinitionLister interface.
type customResourceLister struct { type customResourceDefinitionLister struct {
indexer cache.Indexer indexer cache.Indexer
} }
// NewCustomResourceLister returns a new CustomResourceLister. // NewCustomResourceDefinitionLister returns a new CustomResourceDefinitionLister.
func NewCustomResourceLister(indexer cache.Indexer) CustomResourceLister { func NewCustomResourceDefinitionLister(indexer cache.Indexer) CustomResourceDefinitionLister {
return &customResourceLister{indexer: indexer} return &customResourceDefinitionLister{indexer: indexer}
} }
// List lists all CustomResources in the indexer. // List lists all CustomResourceDefinitions in the indexer.
func (s *customResourceLister) List(selector labels.Selector) (ret []*v1alpha1.CustomResource, err error) { func (s *customResourceDefinitionLister) List(selector labels.Selector) (ret []*v1alpha1.CustomResourceDefinition, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) { err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.CustomResource)) ret = append(ret, m.(*v1alpha1.CustomResourceDefinition))
}) })
return ret, err return ret, err
} }
// Get retrieves the CustomResource from the index for a given name. // Get retrieves the CustomResourceDefinition from the index for a given name.
func (s *customResourceLister) Get(name string) (*v1alpha1.CustomResource, error) { func (s *customResourceDefinitionLister) Get(name string) (*v1alpha1.CustomResourceDefinition, error) {
key := &v1alpha1.CustomResource{ObjectMeta: v1.ObjectMeta{Name: name}} key := &v1alpha1.CustomResourceDefinition{ObjectMeta: v1.ObjectMeta{Name: name}}
obj, exists, err := s.indexer.Get(key) obj, exists, err := s.indexer.Get(key)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !exists { if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("customresource"), name) return nil, errors.NewNotFound(v1alpha1.Resource("customresourcedefinition"), name)
} }
return obj.(*v1alpha1.CustomResource), nil return obj.(*v1alpha1.CustomResourceDefinition), nil
} }
...@@ -18,6 +18,6 @@ limitations under the License. ...@@ -18,6 +18,6 @@ limitations under the License.
package v1alpha1 package v1alpha1
// CustomResourceListerExpansion allows custom methods to be added to // CustomResourceDefinitionListerExpansion allows custom methods to be added to
// CustomResourceLister. // CustomResourceDefinitionLister.
type CustomResourceListerExpansion interface{} type CustomResourceDefinitionListerExpansion interface{}
...@@ -32,15 +32,15 @@ import ( ...@@ -32,15 +32,15 @@ import (
const defaultEtcdPathPrefix = "/registry/apiextensions.kubernetes.io" const defaultEtcdPathPrefix = "/registry/apiextensions.kubernetes.io"
type CustomResourcesServerOptions struct { type CustomResourceDefinitionsServerOptions struct {
RecommendedOptions *genericoptions.RecommendedOptions RecommendedOptions *genericoptions.RecommendedOptions
StdOut io.Writer StdOut io.Writer
StdErr io.Writer StdErr io.Writer
} }
func NewCustomResourcesServerOptions(out, errOut io.Writer) *CustomResourcesServerOptions { func NewCustomResourceDefinitionsServerOptions(out, errOut io.Writer) *CustomResourceDefinitionsServerOptions {
o := &CustomResourcesServerOptions{ o := &CustomResourceDefinitionsServerOptions{
RecommendedOptions: genericoptions.NewRecommendedOptions(defaultEtcdPathPrefix, apiserver.Scheme, apiserver.Codecs.LegacyCodec(v1alpha1.SchemeGroupVersion)), RecommendedOptions: genericoptions.NewRecommendedOptions(defaultEtcdPathPrefix, apiserver.Scheme, apiserver.Codecs.LegacyCodec(v1alpha1.SchemeGroupVersion)),
StdOut: out, StdOut: out,
...@@ -50,8 +50,8 @@ func NewCustomResourcesServerOptions(out, errOut io.Writer) *CustomResourcesServ ...@@ -50,8 +50,8 @@ func NewCustomResourcesServerOptions(out, errOut io.Writer) *CustomResourcesServ
return o return o
} }
func NewCommandStartCustomResourcesServer(out, errOut io.Writer, stopCh <-chan struct{}) *cobra.Command { func NewCommandStartCustomResourceDefinitionsServer(out, errOut io.Writer, stopCh <-chan struct{}) *cobra.Command {
o := NewCustomResourcesServerOptions(out, errOut) o := NewCustomResourceDefinitionsServerOptions(out, errOut)
cmd := &cobra.Command{ cmd := &cobra.Command{
Short: "Launch an API extensions API server", Short: "Launch an API extensions API server",
...@@ -63,7 +63,7 @@ func NewCommandStartCustomResourcesServer(out, errOut io.Writer, stopCh <-chan s ...@@ -63,7 +63,7 @@ func NewCommandStartCustomResourcesServer(out, errOut io.Writer, stopCh <-chan s
if err := o.Validate(args); err != nil { if err := o.Validate(args); err != nil {
return err return err
} }
if err := o.RunCustomResourcesServer(stopCh); err != nil { if err := o.RunCustomResourceDefinitionsServer(stopCh); err != nil {
return err return err
} }
return nil return nil
...@@ -76,15 +76,15 @@ func NewCommandStartCustomResourcesServer(out, errOut io.Writer, stopCh <-chan s ...@@ -76,15 +76,15 @@ func NewCommandStartCustomResourcesServer(out, errOut io.Writer, stopCh <-chan s
return cmd return cmd
} }
func (o CustomResourcesServerOptions) Validate(args []string) error { func (o CustomResourceDefinitionsServerOptions) Validate(args []string) error {
return nil return nil
} }
func (o *CustomResourcesServerOptions) Complete() error { func (o *CustomResourceDefinitionsServerOptions) Complete() error {
return nil return nil
} }
func (o CustomResourcesServerOptions) Config() (*apiserver.Config, error) { func (o CustomResourceDefinitionsServerOptions) Config() (*apiserver.Config, error) {
// TODO have a "real" external address // TODO have a "real" external address
if err := o.RecommendedOptions.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{net.ParseIP("127.0.0.1")}); err != nil { if err := o.RecommendedOptions.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{net.ParseIP("127.0.0.1")}); err != nil {
return nil, fmt.Errorf("error creating self-signed certificates: %v", err) return nil, fmt.Errorf("error creating self-signed certificates: %v", err)
...@@ -95,7 +95,7 @@ func (o CustomResourcesServerOptions) Config() (*apiserver.Config, error) { ...@@ -95,7 +95,7 @@ func (o CustomResourcesServerOptions) Config() (*apiserver.Config, error) {
return nil, err return nil, err
} }
customResourceRESTOptionsGetter := apiserver.CustomResourceRESTOptionsGetter{ customResourceDefinitionRESTOptionsGetter := apiserver.CustomResourceDefinitionRESTOptionsGetter{
StorageConfig: o.RecommendedOptions.Etcd.StorageConfig, StorageConfig: o.RecommendedOptions.Etcd.StorageConfig,
StoragePrefix: o.RecommendedOptions.Etcd.StorageConfig.Prefix, StoragePrefix: o.RecommendedOptions.Etcd.StorageConfig.Prefix,
EnableWatchCache: o.RecommendedOptions.Etcd.EnableWatchCache, EnableWatchCache: o.RecommendedOptions.Etcd.EnableWatchCache,
...@@ -103,17 +103,17 @@ func (o CustomResourcesServerOptions) Config() (*apiserver.Config, error) { ...@@ -103,17 +103,17 @@ func (o CustomResourcesServerOptions) Config() (*apiserver.Config, error) {
EnableGarbageCollection: o.RecommendedOptions.Etcd.EnableGarbageCollection, EnableGarbageCollection: o.RecommendedOptions.Etcd.EnableGarbageCollection,
DeleteCollectionWorkers: o.RecommendedOptions.Etcd.DeleteCollectionWorkers, DeleteCollectionWorkers: o.RecommendedOptions.Etcd.DeleteCollectionWorkers,
} }
customResourceRESTOptionsGetter.StorageConfig.Codec = unstructured.UnstructuredJSONScheme customResourceDefinitionRESTOptionsGetter.StorageConfig.Codec = unstructured.UnstructuredJSONScheme
customResourceRESTOptionsGetter.StorageConfig.Copier = apiserver.UnstructuredCopier{} customResourceDefinitionRESTOptionsGetter.StorageConfig.Copier = apiserver.UnstructuredCopier{}
config := &apiserver.Config{ config := &apiserver.Config{
GenericConfig: serverConfig, GenericConfig: serverConfig,
CustomResourceRESTOptionsGetter: customResourceRESTOptionsGetter, CustomResourceDefinitionRESTOptionsGetter: customResourceDefinitionRESTOptionsGetter,
} }
return config, nil return config, nil
} }
func (o CustomResourcesServerOptions) RunCustomResourcesServer(stopCh <-chan struct{}) error { func (o CustomResourceDefinitionsServerOptions) RunCustomResourceDefinitionsServer(stopCh <-chan struct{}) error {
config, err := o.Config() config, err := o.Config()
if err != nil { if err != nil {
return err return err
......
...@@ -15,16 +15,19 @@ go_library( ...@@ -15,16 +15,19 @@ go_library(
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library", "//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library", "//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library",
"//vendor/k8s.io/apiserver/pkg/storage:go_default_library", "//vendor/k8s.io/apiserver/pkg/storage:go_default_library",
"//vendor/k8s.io/apiserver/pkg/storage/names:go_default_library", "//vendor/k8s.io/apiserver/pkg/storage/names:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/apis/apiextensions:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/validation:go_default_library",
], ],
) )
...@@ -17,10 +17,12 @@ limitations under the License. ...@@ -17,10 +17,12 @@ limitations under the License.
package customresource package customresource
import ( import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic"
genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
) )
// rest implements a RESTStorage for API services against etcd // rest implements a RESTStorage for API services against etcd
...@@ -29,24 +31,31 @@ type REST struct { ...@@ -29,24 +31,31 @@ type REST struct {
} }
// NewREST returns a RESTStorage object that will work against API services. // NewREST returns a RESTStorage object that will work against API services.
func NewREST(scheme *runtime.Scheme, optsGetter generic.RESTOptionsGetter) *REST { func NewREST(resource schema.GroupResource, listKind schema.GroupVersionKind, copier runtime.ObjectCopier, strategy CustomResourceDefinitionStorageStrategy, optsGetter generic.RESTOptionsGetter) *REST {
strategy := NewStrategy(scheme)
store := &genericregistry.Store{ store := &genericregistry.Store{
Copier: scheme, Copier: copier,
NewFunc: func() runtime.Object { return &apiextensions.CustomResource{} }, NewFunc: func() runtime.Object { return &unstructured.Unstructured{} },
NewListFunc: func() runtime.Object { return &apiextensions.CustomResourceList{} }, NewListFunc: func() runtime.Object {
// lists are never stored, only manufactured, so stomp in the right kind
ret := &unstructured.UnstructuredList{}
ret.SetGroupVersionKind(listKind)
return ret
},
ObjectNameFunc: func(obj runtime.Object) (string, error) { ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*apiextensions.CustomResource).Name, nil accessor, err := meta.Accessor(obj)
if err != nil {
return "", err
}
return accessor.GetName(), nil
}, },
PredicateFunc: MatchCustomResource, PredicateFunc: strategy.MatchCustomResourceDefinitionStorage,
QualifiedResource: apiextensions.Resource("customresources"), QualifiedResource: resource,
CreateStrategy: strategy, CreateStrategy: strategy,
UpdateStrategy: strategy, UpdateStrategy: strategy,
DeleteStrategy: strategy, DeleteStrategy: strategy,
} }
options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: GetAttrs} options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: strategy.GetAttrs}
if err := store.CompleteWithOptions(options); err != nil { if err := store.CompleteWithOptions(options); err != nil {
panic(err) // TODO: Propagate error up panic(err) // TODO: Propagate error up
} }
......
...@@ -17,78 +17,99 @@ limitations under the License. ...@@ -17,78 +17,99 @@ limitations under the License.
package customresource package customresource
import ( import (
"fmt" "k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/validation"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request" genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/generic"
"k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage"
"k8s.io/apiserver/pkg/storage/names" "k8s.io/apiserver/pkg/storage/names"
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/validation"
) )
type apiServerStrategy struct { type CustomResourceDefinitionStorageStrategy struct {
runtime.ObjectTyper runtime.ObjectTyper
names.NameGenerator names.NameGenerator
namespaceScoped bool
} }
func NewStrategy(typer runtime.ObjectTyper) apiServerStrategy { func NewStrategy(typer runtime.ObjectTyper, namespaceScoped bool) CustomResourceDefinitionStorageStrategy {
return apiServerStrategy{typer, names.SimpleNameGenerator} return CustomResourceDefinitionStorageStrategy{typer, names.SimpleNameGenerator, namespaceScoped}
} }
func (apiServerStrategy) NamespaceScoped() bool { func (a CustomResourceDefinitionStorageStrategy) NamespaceScoped() bool {
return false return a.namespaceScoped
} }
func (apiServerStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) { func (CustomResourceDefinitionStorageStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
} }
func (apiServerStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) { func (CustomResourceDefinitionStorageStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {
} }
func (apiServerStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList { func (a CustomResourceDefinitionStorageStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
return validation.ValidateCustomResource(obj.(*apiextensions.CustomResource)) accessor, err := meta.Accessor(obj)
if err != nil {
return field.ErrorList{field.Invalid(field.NewPath("metadata"), nil, err.Error())}
}
return validation.ValidateObjectMetaAccessor(accessor, a.namespaceScoped, validation.NameIsDNSSubdomain, field.NewPath("metadata"))
} }
func (apiServerStrategy) AllowCreateOnUpdate() bool { func (CustomResourceDefinitionStorageStrategy) AllowCreateOnUpdate() bool {
return false return false
} }
func (apiServerStrategy) AllowUnconditionalUpdate() bool { func (CustomResourceDefinitionStorageStrategy) AllowUnconditionalUpdate() bool {
return false return false
} }
func (apiServerStrategy) Canonicalize(obj runtime.Object) { func (CustomResourceDefinitionStorageStrategy) Canonicalize(obj runtime.Object) {
}
func (CustomResourceDefinitionStorageStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
objAccessor, err := meta.Accessor(obj)
if err != nil {
return field.ErrorList{field.Invalid(field.NewPath("metadata"), nil, err.Error())}
}
oldAccessor, err := meta.Accessor(old)
if err != nil {
return field.ErrorList{field.Invalid(field.NewPath("metadata"), nil, err.Error())}
}
return validation.ValidateObjectMetaAccessorUpdate(objAccessor, oldAccessor, field.NewPath("metadata"))
return field.ErrorList{}
} }
func (apiServerStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList { func (a CustomResourceDefinitionStorageStrategy) GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
return validation.ValidateCustomResourceUpdate(obj.(*apiextensions.CustomResource), old.(*apiextensions.CustomResource)) accessor, err := meta.Accessor(obj)
if err != nil {
return nil, nil, err
}
return labels.Set(accessor.GetLabels()), objectMetaFieldsSet(accessor, a.namespaceScoped), nil
} }
func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) { // objectMetaFieldsSet returns a fields that represent the ObjectMeta.
apiserver, ok := obj.(*apiextensions.CustomResource) func objectMetaFieldsSet(objectMeta metav1.Object, namespaceScoped bool) fields.Set {
if !ok { if namespaceScoped {
return nil, nil, fmt.Errorf("given object is not a CustomResource.") return fields.Set{
"metadata.name": objectMeta.GetName(),
"metadata.namespace": objectMeta.GetNamespace(),
}
}
return fields.Set{
"metadata.name": objectMeta.GetName(),
} }
return labels.Set(apiserver.ObjectMeta.Labels), CustomResourceToSelectableFields(apiserver), nil
} }
// MatchCustomResource is the filter used by the generic etcd backend to watch events func (a CustomResourceDefinitionStorageStrategy) MatchCustomResourceDefinitionStorage(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
// from etcd to clients of the apiserver only interested in specific labels/fields.
func MatchCustomResource(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
return storage.SelectionPredicate{ return storage.SelectionPredicate{
Label: label, Label: label,
Field: field, Field: field,
GetAttrs: GetAttrs, GetAttrs: a.GetAttrs,
} }
} }
// CustomResourceToSelectableFields returns a field set that represents the object.
func CustomResourceToSelectableFields(obj *apiextensions.CustomResource) fields.Set {
return generic.ObjectMetaFieldsSet(&obj.ObjectMeta, true)
}
...@@ -15,19 +15,16 @@ go_library( ...@@ -15,19 +15,16 @@ go_library(
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library", "//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library", "//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library",
"//vendor/k8s.io/apiserver/pkg/storage:go_default_library", "//vendor/k8s.io/apiserver/pkg/storage:go_default_library",
"//vendor/k8s.io/apiserver/pkg/storage/names:go_default_library", "//vendor/k8s.io/apiserver/pkg/storage/names:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/apis/apiextensions:go_default_library",
"//vendor/k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/validation:go_default_library",
], ],
) )
...@@ -14,15 +14,13 @@ See the License for the specific language governing permissions and ...@@ -14,15 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package customresourcestorage package customresourcedefinition
import ( import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic"
genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
) )
// rest implements a RESTStorage for API services against etcd // rest implements a RESTStorage for API services against etcd
...@@ -31,31 +29,24 @@ type REST struct { ...@@ -31,31 +29,24 @@ type REST struct {
} }
// NewREST returns a RESTStorage object that will work against API services. // NewREST returns a RESTStorage object that will work against API services.
func NewREST(resource schema.GroupResource, listKind schema.GroupVersionKind, copier runtime.ObjectCopier, strategy CustomResourceStorageStrategy, optsGetter generic.RESTOptionsGetter) *REST { func NewREST(scheme *runtime.Scheme, optsGetter generic.RESTOptionsGetter) *REST {
strategy := NewStrategy(scheme)
store := &genericregistry.Store{ store := &genericregistry.Store{
Copier: copier, Copier: scheme,
NewFunc: func() runtime.Object { return &unstructured.Unstructured{} }, NewFunc: func() runtime.Object { return &apiextensions.CustomResourceDefinition{} },
NewListFunc: func() runtime.Object { NewListFunc: func() runtime.Object { return &apiextensions.CustomResourceDefinitionList{} },
// lists are never stored, only manufactured, so stomp in the right kind
ret := &unstructured.UnstructuredList{}
ret.SetGroupVersionKind(listKind)
return ret
},
ObjectNameFunc: func(obj runtime.Object) (string, error) { ObjectNameFunc: func(obj runtime.Object) (string, error) {
accessor, err := meta.Accessor(obj) return obj.(*apiextensions.CustomResourceDefinition).Name, nil
if err != nil {
return "", err
}
return accessor.GetName(), nil
}, },
PredicateFunc: strategy.MatchCustomResourceStorage, PredicateFunc: MatchCustomResourceDefinition,
QualifiedResource: resource, QualifiedResource: apiextensions.Resource("customresourcedefinitions"),
CreateStrategy: strategy, CreateStrategy: strategy,
UpdateStrategy: strategy, UpdateStrategy: strategy,
DeleteStrategy: strategy, DeleteStrategy: strategy,
} }
options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: strategy.GetAttrs} options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: GetAttrs}
if err := store.CompleteWithOptions(options); err != nil { if err := store.CompleteWithOptions(options); err != nil {
panic(err) // TODO: Propagate error up panic(err) // TODO: Propagate error up
} }
......
/*
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 customresourcedefinition
import (
"fmt"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/generic"
"k8s.io/apiserver/pkg/storage"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions"
"k8s.io/kube-apiextensions-server/pkg/apis/apiextensions/validation"
)
type apiServerStrategy struct {
runtime.ObjectTyper
names.NameGenerator
}
func NewStrategy(typer runtime.ObjectTyper) apiServerStrategy {
return apiServerStrategy{typer, names.SimpleNameGenerator}
}
func (apiServerStrategy) NamespaceScoped() bool {
return false
}
func (apiServerStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
}
func (apiServerStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {
}
func (apiServerStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
return validation.ValidateCustomResourceDefinition(obj.(*apiextensions.CustomResourceDefinition))
}
func (apiServerStrategy) AllowCreateOnUpdate() bool {
return false
}
func (apiServerStrategy) AllowUnconditionalUpdate() bool {
return false
}
func (apiServerStrategy) Canonicalize(obj runtime.Object) {
}
func (apiServerStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
return validation.ValidateCustomResourceDefinitionUpdate(obj.(*apiextensions.CustomResourceDefinition), old.(*apiextensions.CustomResourceDefinition))
}
func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
apiserver, ok := obj.(*apiextensions.CustomResourceDefinition)
if !ok {
return nil, nil, fmt.Errorf("given object is not a CustomResourceDefinition.")
}
return labels.Set(apiserver.ObjectMeta.Labels), CustomResourceDefinitionToSelectableFields(apiserver), nil
}
// MatchCustomResourceDefinition is the filter used by the generic etcd backend to watch events
// from etcd to clients of the apiserver only interested in specific labels/fields.
func MatchCustomResourceDefinition(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
return storage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: GetAttrs,
}
}
// CustomResourceDefinitionToSelectableFields returns a field set that represents the object.
func CustomResourceDefinitionToSelectableFields(obj *apiextensions.CustomResourceDefinition) fields.Set {
return generic.ObjectMetaFieldsSet(&obj.ObjectMeta, true)
}
/*
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 customresourcestorage
import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/validation"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/storage"
"k8s.io/apiserver/pkg/storage/names"
)
type CustomResourceStorageStrategy struct {
runtime.ObjectTyper
names.NameGenerator
namespaceScoped bool
}
func NewStrategy(typer runtime.ObjectTyper, namespaceScoped bool) CustomResourceStorageStrategy {
return CustomResourceStorageStrategy{typer, names.SimpleNameGenerator, namespaceScoped}
}
func (a CustomResourceStorageStrategy) NamespaceScoped() bool {
return a.namespaceScoped
}
func (CustomResourceStorageStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
}
func (CustomResourceStorageStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {
}
func (a CustomResourceStorageStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
accessor, err := meta.Accessor(obj)
if err != nil {
return field.ErrorList{field.Invalid(field.NewPath("metadata"), nil, err.Error())}
}
return validation.ValidateObjectMetaAccessor(accessor, a.namespaceScoped, validation.NameIsDNSSubdomain, field.NewPath("metadata"))
}
func (CustomResourceStorageStrategy) AllowCreateOnUpdate() bool {
return false
}
func (CustomResourceStorageStrategy) AllowUnconditionalUpdate() bool {
return false
}
func (CustomResourceStorageStrategy) Canonicalize(obj runtime.Object) {
}
func (CustomResourceStorageStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
objAccessor, err := meta.Accessor(obj)
if err != nil {
return field.ErrorList{field.Invalid(field.NewPath("metadata"), nil, err.Error())}
}
oldAccessor, err := meta.Accessor(old)
if err != nil {
return field.ErrorList{field.Invalid(field.NewPath("metadata"), nil, err.Error())}
}
return validation.ValidateObjectMetaAccessorUpdate(objAccessor, oldAccessor, field.NewPath("metadata"))
return field.ErrorList{}
}
func (a CustomResourceStorageStrategy) GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
accessor, err := meta.Accessor(obj)
if err != nil {
return nil, nil, err
}
return labels.Set(accessor.GetLabels()), objectMetaFieldsSet(accessor, a.namespaceScoped), nil
}
// objectMetaFieldsSet returns a fields that represent the ObjectMeta.
func objectMetaFieldsSet(objectMeta metav1.Object, namespaceScoped bool) fields.Set {
if namespaceScoped {
return fields.Set{
"metadata.name": objectMeta.GetName(),
"metadata.namespace": objectMeta.GetNamespace(),
}
}
return fields.Set{
"metadata.name": objectMeta.GetName(),
}
}
func (a CustomResourceStorageStrategy) MatchCustomResourceStorage(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
return storage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: a.GetAttrs,
}
}
...@@ -30,7 +30,7 @@ import ( ...@@ -30,7 +30,7 @@ import (
"k8s.io/kube-apiextensions-server/test/integration/testserver" "k8s.io/kube-apiextensions-server/test/integration/testserver"
) )
func instantiateCustomResource(t *testing.T, instanceToCreate *unstructured.Unstructured, client *dynamic.ResourceClient, definition *apiextensionsv1alpha1.CustomResource) (*unstructured.Unstructured, error) { func instantiateCustomResource(t *testing.T, instanceToCreate *unstructured.Unstructured, client *dynamic.ResourceClient, definition *apiextensionsv1alpha1.CustomResourceDefinition) (*unstructured.Unstructured, error) {
createdInstance, err := client.Create(instanceToCreate) createdInstance, err := client.Create(instanceToCreate)
if err != nil { if err != nil {
t.Logf("%#v", createdInstance) t.Logf("%#v", createdInstance)
...@@ -57,7 +57,7 @@ func instantiateCustomResource(t *testing.T, instanceToCreate *unstructured.Unst ...@@ -57,7 +57,7 @@ func instantiateCustomResource(t *testing.T, instanceToCreate *unstructured.Unst
return createdInstance, nil return createdInstance, nil
} }
func NewNamespacedCustomResourceClient(ns string, client *dynamic.Client, definition *apiextensionsv1alpha1.CustomResource) *dynamic.ResourceClient { func NewNamespacedCustomResourceClient(ns string, client *dynamic.Client, definition *apiextensionsv1alpha1.CustomResourceDefinition) *dynamic.ResourceClient {
return client.Resource(&metav1.APIResource{ return client.Resource(&metav1.APIResource{
Name: definition.Spec.Names.Plural, Name: definition.Spec.Names.Plural,
Namespaced: definition.Spec.Scope == apiextensionsv1alpha1.NamespaceScoped, Namespaced: definition.Spec.Scope == apiextensionsv1alpha1.NamespaceScoped,
......
...@@ -28,13 +28,13 @@ import ( ...@@ -28,13 +28,13 @@ import (
"k8s.io/kube-apiextensions-server/pkg/client/clientset/clientset" "k8s.io/kube-apiextensions-server/pkg/client/clientset/clientset"
) )
func NewNoxuCustomResourceDefinition() *apiextensionsv1alpha1.CustomResource { func NewNoxuCustomResourceDefinition() *apiextensionsv1alpha1.CustomResourceDefinition {
return &apiextensionsv1alpha1.CustomResource{ return &apiextensionsv1alpha1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{Name: "noxus.mygroup.example.com"}, ObjectMeta: metav1.ObjectMeta{Name: "noxus.mygroup.example.com"},
Spec: apiextensionsv1alpha1.CustomResourceSpec{ Spec: apiextensionsv1alpha1.CustomResourceDefinitionSpec{
Group: "mygroup.example.com", Group: "mygroup.example.com",
Version: "v1alpha1", Version: "v1alpha1",
Names: apiextensionsv1alpha1.CustomResourceNames{ Names: apiextensionsv1alpha1.CustomResourceDefinitionNames{
Plural: "noxus", Plural: "noxus",
Singular: "nonenglishnoxu", Singular: "nonenglishnoxu",
Kind: "WishIHadChosenNoxu", Kind: "WishIHadChosenNoxu",
...@@ -61,13 +61,13 @@ func NewNoxuInstance(namespace, name string) *unstructured.Unstructured { ...@@ -61,13 +61,13 @@ func NewNoxuInstance(namespace, name string) *unstructured.Unstructured {
} }
} }
func NewCurletCustomResourceDefinition() *apiextensionsv1alpha1.CustomResource { func NewCurletCustomResourceDefinition() *apiextensionsv1alpha1.CustomResourceDefinition {
return &apiextensionsv1alpha1.CustomResource{ return &apiextensionsv1alpha1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{Name: "curlets.mygroup.example.com"}, ObjectMeta: metav1.ObjectMeta{Name: "curlets.mygroup.example.com"},
Spec: apiextensionsv1alpha1.CustomResourceSpec{ Spec: apiextensionsv1alpha1.CustomResourceDefinitionSpec{
Group: "mygroup.example.com", Group: "mygroup.example.com",
Version: "v1alpha1", Version: "v1alpha1",
Names: apiextensionsv1alpha1.CustomResourceNames{ Names: apiextensionsv1alpha1.CustomResourceDefinitionNames{
Plural: "curlets", Plural: "curlets",
Singular: "curlet", Singular: "curlet",
Kind: "Curlet", Kind: "Curlet",
...@@ -94,20 +94,20 @@ func NewCurletInstance(namespace, name string) *unstructured.Unstructured { ...@@ -94,20 +94,20 @@ func NewCurletInstance(namespace, name string) *unstructured.Unstructured {
} }
} }
func CreateNewCustomResourceDefinition(customResource *apiextensionsv1alpha1.CustomResource, apiExtensionsClient clientset.Interface, clientPool dynamic.ClientPool) (*dynamic.Client, error) { func CreateNewCustomResourceDefinition(customResourceDefinition *apiextensionsv1alpha1.CustomResourceDefinition, apiExtensionsClient clientset.Interface, clientPool dynamic.ClientPool) (*dynamic.Client, error) {
_, err := apiExtensionsClient.Apiextensions().CustomResources().Create(customResource) _, err := apiExtensionsClient.Apiextensions().CustomResourceDefinitions().Create(customResourceDefinition)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// wait until the resource appears in discovery // wait until the resource appears in discovery
err = wait.PollImmediate(30*time.Millisecond, 30*time.Second, func() (bool, error) { err = wait.PollImmediate(30*time.Millisecond, 30*time.Second, func() (bool, error) {
resourceList, err := apiExtensionsClient.Discovery().ServerResourcesForGroupVersion(customResource.Spec.Group + "/" + customResource.Spec.Version) resourceList, err := apiExtensionsClient.Discovery().ServerResourcesForGroupVersion(customResourceDefinition.Spec.Group + "/" + customResourceDefinition.Spec.Version)
if err != nil { if err != nil {
return false, nil return false, nil
} }
for _, resource := range resourceList.APIResources { for _, resource := range resourceList.APIResources {
if resource.Name == customResource.Spec.Names.Plural { if resource.Name == customResourceDefinition.Spec.Names.Plural {
return true, nil return true, nil
} }
} }
...@@ -117,7 +117,7 @@ func CreateNewCustomResourceDefinition(customResource *apiextensionsv1alpha1.Cus ...@@ -117,7 +117,7 @@ func CreateNewCustomResourceDefinition(customResource *apiextensionsv1alpha1.Cus
return nil, err return nil, err
} }
dynamicClient, err := clientPool.ClientForGroupVersionResource(schema.GroupVersionResource{Group: customResource.Spec.Group, Version: customResource.Spec.Version, Resource: customResource.Spec.Names.Plural}) dynamicClient, err := clientPool.ClientForGroupVersionResource(schema.GroupVersionResource{Group: customResourceDefinition.Spec.Group, Version: customResourceDefinition.Spec.Version, Resource: customResourceDefinition.Spec.Names.Plural})
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -41,7 +41,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) { ...@@ -41,7 +41,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
return nil, err return nil, err
} }
options := server.NewCustomResourcesServerOptions(os.Stdout, os.Stderr) options := server.NewCustomResourceDefinitionsServerOptions(os.Stdout, os.Stderr)
options.RecommendedOptions.Audit.Path = "-" options.RecommendedOptions.Audit.Path = "-"
options.RecommendedOptions.SecureServing.BindPort = port options.RecommendedOptions.SecureServing.BindPort = port
options.RecommendedOptions.Authentication.SkipInClusterLookup = true options.RecommendedOptions.Authentication.SkipInClusterLookup = true
...@@ -76,7 +76,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) { ...@@ -76,7 +76,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
return nil, err return nil, err
} }
customResourceRESTOptionsGetter := extensionsapiserver.CustomResourceRESTOptionsGetter{ customResourceDefinitionRESTOptionsGetter := extensionsapiserver.CustomResourceDefinitionRESTOptionsGetter{
StorageConfig: options.RecommendedOptions.Etcd.StorageConfig, StorageConfig: options.RecommendedOptions.Etcd.StorageConfig,
StoragePrefix: options.RecommendedOptions.Etcd.StorageConfig.Prefix, StoragePrefix: options.RecommendedOptions.Etcd.StorageConfig.Prefix,
EnableWatchCache: options.RecommendedOptions.Etcd.EnableWatchCache, EnableWatchCache: options.RecommendedOptions.Etcd.EnableWatchCache,
...@@ -84,12 +84,12 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) { ...@@ -84,12 +84,12 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
EnableGarbageCollection: options.RecommendedOptions.Etcd.EnableGarbageCollection, EnableGarbageCollection: options.RecommendedOptions.Etcd.EnableGarbageCollection,
DeleteCollectionWorkers: options.RecommendedOptions.Etcd.DeleteCollectionWorkers, DeleteCollectionWorkers: options.RecommendedOptions.Etcd.DeleteCollectionWorkers,
} }
customResourceRESTOptionsGetter.StorageConfig.Codec = unstructured.UnstructuredJSONScheme customResourceDefinitionRESTOptionsGetter.StorageConfig.Codec = unstructured.UnstructuredJSONScheme
customResourceRESTOptionsGetter.StorageConfig.Copier = extensionsapiserver.UnstructuredCopier{} customResourceDefinitionRESTOptionsGetter.StorageConfig.Copier = extensionsapiserver.UnstructuredCopier{}
config := &extensionsapiserver.Config{ config := &extensionsapiserver.Config{
GenericConfig: genericConfig, GenericConfig: genericConfig,
CustomResourceRESTOptionsGetter: customResourceRESTOptionsGetter, CustomResourceDefinitionRESTOptionsGetter: customResourceDefinitionRESTOptionsGetter,
} }
return config, nil return config, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment