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.
pull/6/head
Nikhita Raghunath 2017-11-02 21:35:46 +05:30
parent 12752f3139
commit 3b0b95ecbf
9 changed files with 2 additions and 192 deletions

View File

@ -56,9 +56,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
"PodProxyOptions",
"NodeProxyOptions",
"ServiceProxyOptions",
"ThirdPartyResource",
"ThirdPartyResourceData",
"ThirdPartyResourceList",
),
},
announced.VersionToSchemeFunc{

View File

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

View File

@ -52,12 +52,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&DeploymentRollback{},
&ReplicationControllerDummy{},
&Scale{},
&ThirdPartyResource{},
&ThirdPartyResourceList{},
&DaemonSetList{},
&DaemonSet{},
&ThirdPartyResourceData{},
&ThirdPartyResourceDataList{},
&Ingress{},
&IngressList{},
&ReplicaSet{},

View File

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

View File

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

View File

@ -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] + "..."

View File

@ -49,12 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&DeploymentRollback{},
&ReplicationControllerDummy{},
&Scale{},
&ThirdPartyResource{},
&ThirdPartyResourceList{},
&DaemonSetList{},
&DaemonSet{},
&ThirdPartyResourceData{},
&ThirdPartyResourceDataList{},
&Ingress{},
&IngressList{},
&ReplicaSet{},

View File

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

View File

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