Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename to CustomResourceDefinition #45822

Merged
merged 1 commit into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion staging/src/k8s.io/kube-apiextensions-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
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)
if err := cmd.Execute(); err != nil {
panic(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: apiextensions.GroupName,
RootScopedKinds: sets.NewString("CustomResource"),
RootScopedKinds: sets.NewString("CustomResourceDefinition"),
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
ImportPrefix: "k8s.io/kube-apiextensions-server/pkg/apis/apiextension",
AddInternalObjectsToScheme: apiextensions.AddToScheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestRoundTripTypes(t *testing.T) {

func fuzzerFuncs() []interface{} {
return []interface{}{
func(obj *apiextensions.CustomResourceSpec, c fuzz.Continue) {
func(obj *apiextensions.CustomResourceDefinitionSpec, c fuzz.Continue) {
c.FuzzNoCustom(obj)

// match our defaulter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ var (
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResource{},
&CustomResourceList{},
&CustomResourceDefinition{},
&CustomResourceDefinitionList{},
)
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ package apiextensions

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// CustomResourceSpec describes how a user wants their resource to appear
type CustomResourceSpec struct {
// CustomResourceDefinitionSpec describes how a user wants their resource to appear
type CustomResourceDefinitionSpec struct {
// Group is the group this resource belongs in
Group string
// Version is the version this resource belongs in
Version string
// 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 ResourceScope
}

// CustomResourceNames indicates the names to serve this CustomResource
type CustomResourceNames struct {
// Plural is the plural name of the resource to serve. It must match the name of the CustomResource-registration
// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition
type CustomResourceDefinitionNames struct {
// 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.
Plural string
// Singular is the singular name of the resource. It must be all lowercase Defaults to lowercased <kind>
Expand Down Expand Up @@ -66,20 +66,20 @@ const (
ConditionUnknown ConditionStatus = "Unknown"
)

// CustomResourceConditionType is a valid value for CustomResourceCondition.Type
type CustomResourceConditionType string
// CustomResourceDefinitionConditionType is a valid value for CustomResourceDefinitionCondition.Type
type CustomResourceDefinitionConditionType string

const (
// NameConflict means the names chosen for this CustomResource conflict with others in the group.
NameConflict CustomResourceConditionType = "NameConflict"
// Terminating means that the CustomResource has been deleted and is cleaning up.
Terminating CustomResourceConditionType = "Terminating"
// NameConflict means the names chosen for this CustomResourceDefinition conflict with others in the group.
NameConflict CustomResourceDefinitionConditionType = "NameConflict"
// Terminating means that the CustomResourceDefinition has been deleted and is cleaning up.
Terminating CustomResourceDefinitionConditionType = "Terminating"
)

// CustomResourceCondition contains details for the current condition of this pod.
type CustomResourceCondition struct {
// CustomResourceDefinitionCondition contains details for the current condition of this pod.
type CustomResourceDefinitionCondition struct {
// Type is the type of the condition.
Type CustomResourceConditionType
Type CustomResourceDefinitionConditionType
// Status is the status of the condition.
// Can be True, False, Unknown.
Status ConditionStatus
Expand All @@ -94,36 +94,36 @@ type CustomResourceCondition struct {
Message string
}

// CustomResourceStatus indicates the state of the CustomResource
type CustomResourceStatus struct {
// Conditions indicate state for particular aspects of a CustomResource
Conditions []CustomResourceCondition
// CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition
type CustomResourceDefinitionStatus struct {
// Conditions indicate state for particular aspects of a CustomResourceDefinition
Conditions []CustomResourceDefinitionCondition

// AcceptedNames are the names that are actually being used to serve discovery
// They may be different than the names in spec.
AcceptedNames CustomResourceNames
AcceptedNames CustomResourceDefinitionNames
}

// +genclient=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>.
type CustomResource struct {
type CustomResourceDefinition struct {
metav1.TypeMeta
metav1.ObjectMeta

// Spec describes how the user wants the resources to appear
Spec CustomResourceSpec
// Status indicates the actual state of the CustomResource
Status CustomResourceStatus
Spec CustomResourceDefinitionSpec
// Status indicates the actual state of the CustomResourceDefinition
Status CustomResourceDefinitionStatus
}

// CustomResourceList is a list of CustomResource objects.
type CustomResourceList struct {
// CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
type CustomResourceDefinitionList struct {
metav1.TypeMeta
metav1.ListMeta

// Items individual CustomResources
Items []CustomResource
// Items individual CustomResourceDefinitions
Items []CustomResourceDefinition
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import (
)

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
// return RegisterDefaults(scheme)
return nil
}

func SetDefaults_CustomResource(obj *CustomResource) {
SetDefaults_CustomResourceSpec(&obj.Spec)
func SetDefaults_CustomResourceDefinition(obj *CustomResourceDefinition) {
SetDefaults_CustomResourceDefinitionSpec(&obj.Spec)
}

func SetDefaults_CustomResourceSpec(obj *CustomResourceSpec) {
func SetDefaults_CustomResourceDefinitionSpec(obj *CustomResourceDefinitionSpec) {
if len(obj.Scope) == 0 {
obj.Scope = NamespaceScoped
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ var (
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CustomResource{},
&CustomResourceList{},
&CustomResourceDefinition{},
&CustomResourceDefinitionList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ package v1alpha1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// CustomResourceSpec describes how a user wants their resource to appear
type CustomResourceSpec struct {
// CustomResourceDefinitionSpec describes how a user wants their resource to appear
type CustomResourceDefinitionSpec struct {
// Group is the group this resource belongs in
Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
// Version is the version this resource belongs in
Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
// 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 ResourceScope `json:"scope" protobuf:"bytes,4,opt,name=scope,casttype=ResourceScope"`
}

// CustomResourceNames indicates the names to serve this CustomResource
type CustomResourceNames struct {
// Plural is the plural name of the resource to serve. It must match the name of the CustomResource-registration
// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition
type CustomResourceDefinitionNames struct {
// 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.
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>
Expand Down Expand Up @@ -66,20 +66,20 @@ const (
ConditionUnknown ConditionStatus = "Unknown"
)

// CustomResourceConditionType is a valid value for CustomResourceCondition.Type
type CustomResourceConditionType string
// CustomResourceDefinitionConditionType is a valid value for CustomResourceDefinitionCondition.Type
type CustomResourceDefinitionConditionType string

const (
// NameConflict means the names chosen for this CustomResource conflict with others in the group.
NameConflict CustomResourceConditionType = "NameConflict"
// Terminating means that the CustomResource has been deleted and is cleaning up.
Terminating CustomResourceConditionType = "Terminating"
// NameConflict means the names chosen for this CustomResourceDefinition conflict with others in the group.
NameConflict CustomResourceDefinitionConditionType = "NameConflict"
// Terminating means that the CustomResourceDefinition has been deleted and is cleaning up.
Terminating CustomResourceDefinitionConditionType = "Terminating"
)

// CustomResourceCondition contains details for the current condition of this pod.
type CustomResourceCondition struct {
// CustomResourceDefinitionCondition contains details for the current condition of this pod.
type CustomResourceDefinitionCondition struct {
// 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.
// Can be True, False, Unknown.
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
Expand All @@ -94,36 +94,36 @@ type CustomResourceCondition struct {
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}

// CustomResourceStatus indicates the state of the CustomResource
type CustomResourceStatus struct {
// Conditions indicate state for particular aspects of a CustomResource
Conditions []CustomResourceCondition `json:"conditions" protobuf:"bytes,1,opt,name=conditions"`
// CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition
type CustomResourceDefinitionStatus struct {
// Conditions indicate state for particular aspects of a CustomResourceDefinition
Conditions []CustomResourceDefinitionCondition `json:"conditions" protobuf:"bytes,1,opt,name=conditions"`

// AcceptedNames are the names that are actually being used to serve discovery
// 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
// +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>.
type CustomResource struct {
type CustomResourceDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Spec describes how the user wants the resources to appear
Spec CustomResourceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Status indicates the actual state of the CustomResource
Status CustomResourceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
Spec CustomResourceDefinitionSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Status indicates the actual state of the CustomResourceDefinition
Status CustomResourceDefinitionStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}

// CustomResourceList is a list of CustomResource objects.
type CustomResourceList struct {
// CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
type CustomResourceDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Items individual CustomResources
Items []CustomResource `json:"items" protobuf:"bytes,2,rep,name=items"`
// Items individual CustomResourceDefinitions
Items []CustomResourceDefinition `json:"items" protobuf:"bytes,2,rep,name=items"`
}