@@ -41,12 +41,16 @@ func (uc *unstructuredClient) Create(ctx context.Context, obj runtime.Object) er
41
41
if ! ok {
42
42
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
43
43
}
44
- r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetName ())
44
+ r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetNamespace ())
45
45
if err != nil {
46
46
return err
47
47
}
48
- _ , err = r .Create (u )
49
- return err
48
+ i , err := r .Create (u )
49
+ if err != nil {
50
+ return err
51
+ }
52
+ u .Object = i .Object
53
+ return nil
50
54
}
51
55
52
56
// Update implements client.Client
@@ -55,12 +59,16 @@ func (uc *unstructuredClient) Update(ctx context.Context, obj runtime.Object) er
55
59
if ! ok {
56
60
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
57
61
}
58
- r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetName ())
62
+ r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetNamespace ())
59
63
if err != nil {
60
64
return err
61
65
}
62
- u , err = r .Update (u )
63
- return err
66
+ i , err := r .Update (u )
67
+ if err != nil {
68
+ return err
69
+ }
70
+ u .Object = i .Object
71
+ return nil
64
72
}
65
73
66
74
// Delete implements client.Client
@@ -69,7 +77,7 @@ func (uc *unstructuredClient) Delete(ctx context.Context, obj runtime.Object) er
69
77
if ! ok {
70
78
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
71
79
}
72
- r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetName ())
80
+ r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetNamespace ())
73
81
if err != nil {
74
82
return err
75
83
}
@@ -87,8 +95,12 @@ func (uc *unstructuredClient) Get(ctx context.Context, key ObjectKey, obj runtim
87
95
if err != nil {
88
96
return err
89
97
}
90
- u , err = r .Get (key .Name , metav1.GetOptions {})
91
- return err
98
+ i , err := r .Get (key .Name , metav1.GetOptions {})
99
+ if err != nil {
100
+ return err
101
+ }
102
+ u .Object = i .Object
103
+ return nil
92
104
}
93
105
94
106
// List implements client.Client
@@ -102,8 +114,12 @@ func (uc *unstructuredClient) List(ctx context.Context, opts *ListOptions, obj r
102
114
if err != nil {
103
115
return err
104
116
}
105
- u , err = r .List (* opts .AsListOptions ())
106
- return err
117
+ i , err := r .List (* opts .AsListOptions ())
118
+ if err != nil {
119
+ return err
120
+ }
121
+ u .Object = i .Object
122
+ return nil
107
123
}
108
124
109
125
func (uc * unstructuredClient ) getResourceInterface (gvk schema.GroupVersionKind , ns string ) (dynamic.ResourceInterface , error ) {
0 commit comments