From 3b0b95ecbfc2621ccd43a0744faf6405569c7d5d Mon Sep 17 00:00:00 2001 From: Nikhita Raghunath Date: Thu, 2 Nov 2017 21:35:46 +0530 Subject: [PATCH] Remove TPR remnants There are still TPR types and generated client in the extensions group. It is better to clean that up, now that it has been removed from master. --- pkg/api/install/install.go | 3 - pkg/apis/extensions/install/install.go | 2 +- pkg/apis/extensions/register.go | 4 -- pkg/apis/extensions/types.go | 67 ----------------- pkg/kubectl/scheme/install.go | 5 +- pkg/printers/internalversion/printers.go | 36 ---------- .../k8s.io/api/extensions/v1beta1/register.go | 4 -- .../k8s.io/api/extensions/v1beta1/types.go | 71 ------------------- .../etcd/etcd_storage_path_test.go | 2 - 9 files changed, 2 insertions(+), 192 deletions(-) diff --git a/pkg/api/install/install.go b/pkg/api/install/install.go index 5fbffe23d60..5822eb82005 100644 --- a/pkg/api/install/install.go +++ b/pkg/api/install/install.go @@ -56,9 +56,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r "PodProxyOptions", "NodeProxyOptions", "ServiceProxyOptions", - "ThirdPartyResource", - "ThirdPartyResourceData", - "ThirdPartyResourceList", ), }, announced.VersionToSchemeFunc{ diff --git a/pkg/apis/extensions/install/install.go b/pkg/apis/extensions/install/install.go index 237f8ec05de..dfa89910120 100644 --- a/pkg/apis/extensions/install/install.go +++ b/pkg/apis/extensions/install/install.go @@ -38,7 +38,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r &announced.GroupMetaFactoryArgs{ GroupName: extensions.GroupName, VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version}, - RootScopedKinds: sets.NewString("PodSecurityPolicy", "ThirdPartyResource"), + RootScopedKinds: sets.NewString("PodSecurityPolicy"), AddInternalObjectsToScheme: extensions.AddToScheme, }, announced.VersionToSchemeFunc{ diff --git a/pkg/apis/extensions/register.go b/pkg/apis/extensions/register.go index 7db398c6c69..717662f48e4 100644 --- a/pkg/apis/extensions/register.go +++ b/pkg/apis/extensions/register.go @@ -52,12 +52,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &DeploymentRollback{}, &ReplicationControllerDummy{}, &Scale{}, - &ThirdPartyResource{}, - &ThirdPartyResourceList{}, &DaemonSetList{}, &DaemonSet{}, - &ThirdPartyResourceData{}, - &ThirdPartyResourceDataList{}, &Ingress{}, &IngressList{}, &ReplicaSet{}, diff --git a/pkg/apis/extensions/types.go b/pkg/apis/extensions/types.go index de4bbe37c90..a7edf148bae 100644 --- a/pkg/apis/extensions/types.go +++ b/pkg/apis/extensions/types.go @@ -110,61 +110,6 @@ type CustomMetricCurrentStatusList struct { Items []CustomMetricCurrentStatus } -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource -// types to the API. It consists of one or more Versions of the api. -type ThirdPartyResource struct { - metav1.TypeMeta - - // Standard object metadata - // +optional - metav1.ObjectMeta - - // Description is the description of this object. - // +optional - Description string - - // Versions are versions for this third party object - Versions []APIVersion -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type ThirdPartyResourceList struct { - metav1.TypeMeta - - // Standard list metadata. - // +optional - metav1.ListMeta - - // Items is the list of horizontal pod autoscalers. - Items []ThirdPartyResource -} - -// An APIVersion represents a single concrete version of an object model. -// TODO: we should consider merge this struct with GroupVersion in metav1.go -type APIVersion struct { - // Name of this version (e.g. 'v1'). - Name string -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// An internal object, used for versioned storage in etcd. Not exposed to the end user. -type ThirdPartyResourceData struct { - metav1.TypeMeta - // Standard object metadata. - // +optional - metav1.ObjectMeta - - // Data is the raw JSON data for this data. - // +optional - Data []byte -} - // +genclient // +genclient:method=GetScale,verb=get,subresource=scale,result=Scale // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale @@ -573,18 +518,6 @@ type DaemonSetList struct { Items []DaemonSet } -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type ThirdPartyResourceDataList struct { - metav1.TypeMeta - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta - // Items is a list of third party objects - Items []ThirdPartyResourceData -} - // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/kubectl/scheme/install.go b/pkg/kubectl/scheme/install.go index dc08cdb9487..01f1354ced5 100644 --- a/pkg/kubectl/scheme/install.go +++ b/pkg/kubectl/scheme/install.go @@ -81,9 +81,6 @@ func init() { "PodProxyOptions", "NodeProxyOptions", "ServiceProxyOptions", - "ThirdPartyResource", - "ThirdPartyResourceData", - "ThirdPartyResourceList", ), }, announced.VersionToSchemeFunc{ @@ -205,7 +202,7 @@ func init() { &announced.GroupMetaFactoryArgs{ GroupName: extensionsv1beta1.GroupName, VersionPreferenceOrder: []string{extensionsv1beta1.SchemeGroupVersion.Version}, - RootScopedKinds: sets.NewString("PodSecurityPolicy", "ThirdPartyResource"), + RootScopedKinds: sets.NewString("PodSecurityPolicy"), }, announced.VersionToSchemeFunc{ extensionsv1beta1.SchemeGroupVersion.Version: extensionsv1beta1.AddToScheme, diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 5b564ed7282..aa15ad8d775 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -303,15 +303,6 @@ func AddHandlers(h printers.PrintHandler) { h.TableHandler(componentStatusColumnDefinitions, printComponentStatus) h.TableHandler(componentStatusColumnDefinitions, printComponentStatusList) - thirdPartyResourceColumnDefinitions := []metav1alpha1.TableColumnDefinition{ - {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, - {Name: "Description", Type: "string", Description: extensionsv1beta1.ThirdPartyResource{}.SwaggerDoc()["description"]}, - {Name: "Version(s)", Type: "string", Description: extensionsv1beta1.ThirdPartyResource{}.SwaggerDoc()["versions"]}, - } - - h.TableHandler(thirdPartyResourceColumnDefinitions, printThirdPartyResource) - h.TableHandler(thirdPartyResourceColumnDefinitions, printThirdPartyResourceList) - deploymentColumnDefinitions := []metav1alpha1.TableColumnDefinition{ {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, {Name: "Desired", Type: "string", Description: extensionsv1beta1.DeploymentSpec{}.SwaggerDoc()["replicas"]}, @@ -1435,33 +1426,6 @@ func printComponentStatusList(list *api.ComponentStatusList, options printers.Pr return rows, nil } -func printThirdPartyResource(obj *extensions.ThirdPartyResource, options printers.PrintOptions) ([]metav1alpha1.TableRow, error) { - row := metav1alpha1.TableRow{ - Object: runtime.RawExtension{Object: obj}, - } - - versions := make([]string, len(obj.Versions)) - for ix := range obj.Versions { - version := &obj.Versions[ix] - versions[ix] = fmt.Sprintf("%s", version.Name) - } - versionsString := strings.Join(versions, ",") - row.Cells = append(row.Cells, obj.Name, obj.Description, versionsString) - return []metav1alpha1.TableRow{row}, nil -} - -func printThirdPartyResourceList(list *extensions.ThirdPartyResourceList, options printers.PrintOptions) ([]metav1alpha1.TableRow, error) { - rows := make([]metav1alpha1.TableRow, 0, len(list.Items)) - for i := range list.Items { - r, err := printThirdPartyResource(&list.Items[i], options) - if err != nil { - return nil, err - } - rows = append(rows, r...) - } - return rows, nil -} - func truncate(str string, maxLen int) string { if len(str) > maxLen { return str[0:maxLen] + "..." diff --git a/staging/src/k8s.io/api/extensions/v1beta1/register.go b/staging/src/k8s.io/api/extensions/v1beta1/register.go index 17232e92b1a..7625f678137 100644 --- a/staging/src/k8s.io/api/extensions/v1beta1/register.go +++ b/staging/src/k8s.io/api/extensions/v1beta1/register.go @@ -49,12 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &DeploymentRollback{}, &ReplicationControllerDummy{}, &Scale{}, - &ThirdPartyResource{}, - &ThirdPartyResourceList{}, &DaemonSetList{}, &DaemonSet{}, - &ThirdPartyResourceData{}, - &ThirdPartyResourceDataList{}, &Ingress{}, &IngressList{}, &ReplicaSet{}, diff --git a/staging/src/k8s.io/api/extensions/v1beta1/types.go b/staging/src/k8s.io/api/extensions/v1beta1/types.go index d3cff2aba23..314897e1765 100644 --- a/staging/src/k8s.io/api/extensions/v1beta1/types.go +++ b/staging/src/k8s.io/api/extensions/v1beta1/types.go @@ -100,63 +100,6 @@ type CustomMetricCurrentStatusList struct { Items []CustomMetricCurrentStatus `json:"items" protobuf:"bytes,1,rep,name=items"` } -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource -// types to the API. It consists of one or more Versions of the api. -type ThirdPartyResource struct { - metav1.TypeMeta `json:",inline"` - - // Standard object metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Description is the description of this object. - // +optional - Description string `json:"description,omitempty" protobuf:"bytes,2,opt,name=description"` - - // Versions are versions for this third party object - // +optional - Versions []APIVersion `json:"versions,omitempty" protobuf:"bytes,3,rep,name=versions"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ThirdPartyResourceList is a list of ThirdPartyResources. -type ThirdPartyResourceList struct { - metav1.TypeMeta `json:",inline"` - - // Standard list metadata. - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of ThirdPartyResources. - Items []ThirdPartyResource `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// An APIVersion represents a single concrete version of an object model. -type APIVersion struct { - // Name of this version (e.g. 'v1'). - // +optional - Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// An internal object, used for versioned storage in etcd. Not exposed to the end user. -type ThirdPartyResourceData struct { - metav1.TypeMeta `json:",inline"` - // Standard object metadata. - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Data is the raw JSON data for this data. - // +optional - Data []byte `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"` -} - // +genclient // +genclient:method=GetScale,verb=get,subresource=scale,result=Scale // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale @@ -588,20 +531,6 @@ type DaemonSetList struct { Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"` } -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ThirdPartyResrouceDataList is a list of ThirdPartyResourceData. -type ThirdPartyResourceDataList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of ThirdpartyResourceData. - Items []ThirdPartyResourceData `json:"items" protobuf:"bytes,2,rep,name=items"` -} - // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/test/integration/etcd/etcd_storage_path_test.go b/test/integration/etcd/etcd_storage_path_test.go index 2f0235f09b4..5a4b6575a1e 100644 --- a/test/integration/etcd/etcd_storage_path_test.go +++ b/test/integration/etcd/etcd_storage_path_test.go @@ -446,8 +446,6 @@ var ephemeralWhiteList = createEphemeralWhiteList( gvr("extensions", "v1beta1", "deploymentrollbacks"), // used to rollback deployment, not stored in etcd gvr("extensions", "v1beta1", "replicationcontrollerdummies"), // not stored in etcd gvr("extensions", "v1beta1", "scales"), // not stored in etcd, part of kapiv1.ReplicationController - gvr("extensions", "v1beta1", "thirdpartyresourcedatas"), // we cannot create this - gvr("extensions", "v1beta1", "thirdpartyresources"), // these have been removed from the API server, but kept for the client // -- // k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1