mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Remove Selflink from convertors
This commit is contained in:
parent
8c1e8355f8
commit
2169997dfe
@ -110,13 +110,11 @@ func (h *HumanReadableGenerator) GenerateTable(obj runtime.Object, options Gener
|
|||||||
}
|
}
|
||||||
if m, err := meta.ListAccessor(obj); err == nil {
|
if m, err := meta.ListAccessor(obj); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
table.Continue = m.GetContinue()
|
table.Continue = m.GetContinue()
|
||||||
table.RemainingItemCount = m.GetRemainingItemCount()
|
table.RemainingItemCount = m.GetRemainingItemCount()
|
||||||
} else {
|
} else {
|
||||||
if m, err := meta.CommonAccessor(obj); err == nil {
|
if m, err := meta.CommonAccessor(obj); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return table, nil
|
return table, nil
|
||||||
|
@ -90,13 +90,11 @@ func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tabl
|
|||||||
|
|
||||||
if m, err := meta.ListAccessor(obj); err == nil {
|
if m, err := meta.ListAccessor(obj); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
table.Continue = m.GetContinue()
|
table.Continue = m.GetContinue()
|
||||||
table.RemainingItemCount = m.GetRemainingItemCount()
|
table.RemainingItemCount = m.GetRemainingItemCount()
|
||||||
} else {
|
} else {
|
||||||
if m, err := meta.CommonAccessor(obj); err == nil {
|
if m, err := meta.CommonAccessor(obj); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,6 @@ func asPartialObjectMetadataList(result runtime.Object, groupVersion schema.Grou
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
list.SelfLink = li.GetSelfLink()
|
|
||||||
list.ResourceVersion = li.GetResourceVersion()
|
list.ResourceVersion = li.GetResourceVersion()
|
||||||
list.Continue = li.GetContinue()
|
list.Continue = li.GetContinue()
|
||||||
list.RemainingItemCount = li.GetRemainingItemCount()
|
list.RemainingItemCount = li.GetRemainingItemCount()
|
||||||
@ -265,7 +264,6 @@ func asPartialObjectMetadataList(result runtime.Object, groupVersion schema.Grou
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
list.SelfLink = li.GetSelfLink()
|
|
||||||
list.ResourceVersion = li.GetResourceVersion()
|
list.ResourceVersion = li.GetResourceVersion()
|
||||||
list.Continue = li.GetContinue()
|
list.Continue = li.GetContinue()
|
||||||
list.RemainingItemCount = li.GetRemainingItemCount()
|
list.RemainingItemCount = li.GetRemainingItemCount()
|
||||||
|
@ -171,7 +171,6 @@ func TestAsPartialObjectMetadataList(t *testing.T) {
|
|||||||
var remainingItemCount int64 = 10
|
var remainingItemCount int64 = 10
|
||||||
pods := &examplev1.PodList{
|
pods := &examplev1.PodList{
|
||||||
ListMeta: metav1.ListMeta{
|
ListMeta: metav1.ListMeta{
|
||||||
SelfLink: "/test/link",
|
|
||||||
ResourceVersion: "10",
|
ResourceVersion: "10",
|
||||||
Continue: "continuetoken",
|
Continue: "continuetoken",
|
||||||
RemainingItemCount: &remainingItemCount,
|
RemainingItemCount: &remainingItemCount,
|
||||||
|
@ -1453,13 +1453,12 @@ func (t *Tester) testListTableConversion(obj runtime.Object, assignFn AssignFunc
|
|||||||
}
|
}
|
||||||
m.SetContinue("continuetoken")
|
m.SetContinue("continuetoken")
|
||||||
m.SetResourceVersion("11")
|
m.SetResourceVersion("11")
|
||||||
m.SetSelfLink("/list/link")
|
|
||||||
|
|
||||||
table, err := t.storage.(rest.TableConvertor).ConvertToTable(ctx, listObj, nil)
|
table, err := t.storage.(rest.TableConvertor).ConvertToTable(ctx, listObj, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if table.ResourceVersion != "11" || table.SelfLink != "/list/link" || table.Continue != "continuetoken" {
|
if table.ResourceVersion != "11" || table.Continue != "continuetoken" {
|
||||||
t.Errorf("printer lost list meta: %#v", table.ListMeta)
|
t.Errorf("printer lost list meta: %#v", table.ListMeta)
|
||||||
}
|
}
|
||||||
if len(table.Rows) != len(items) {
|
if len(table.Rows) != len(items) {
|
||||||
|
@ -70,13 +70,11 @@ func (c defaultTableConvertor) ConvertToTable(ctx context.Context, object runtim
|
|||||||
}
|
}
|
||||||
if m, err := meta.ListAccessor(object); err == nil {
|
if m, err := meta.ListAccessor(object); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
table.Continue = m.GetContinue()
|
table.Continue = m.GetContinue()
|
||||||
table.RemainingItemCount = m.GetRemainingItemCount()
|
table.RemainingItemCount = m.GetRemainingItemCount()
|
||||||
} else {
|
} else {
|
||||||
if m, err := meta.CommonAccessor(object); err == nil {
|
if m, err := meta.CommonAccessor(object); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if opt, ok := tableOptions.(*metav1.TableOptions); !ok || !opt.NoHeaders {
|
if opt, ok := tableOptions.(*metav1.TableOptions); !ok || !opt.NoHeaders {
|
||||||
|
@ -83,13 +83,11 @@ func (c *REST) ConvertToTable(ctx context.Context, obj runtime.Object, tableOpti
|
|||||||
}
|
}
|
||||||
if m, err := meta.ListAccessor(obj); err == nil {
|
if m, err := meta.ListAccessor(obj); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
table.Continue = m.GetContinue()
|
table.Continue = m.GetContinue()
|
||||||
table.RemainingItemCount = m.GetRemainingItemCount()
|
table.RemainingItemCount = m.GetRemainingItemCount()
|
||||||
} else {
|
} else {
|
||||||
if m, err := meta.CommonAccessor(obj); err == nil {
|
if m, err := meta.CommonAccessor(obj); err == nil {
|
||||||
table.ResourceVersion = m.GetResourceVersion()
|
table.ResourceVersion = m.GetResourceVersion()
|
||||||
table.SelfLink = m.GetSelfLink()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user