@@ -37,16 +37,18 @@ type unstructuredClient struct {
37
37
}
38
38
39
39
// Create implements client.Client
40
- func (uc * unstructuredClient ) Create (_ context.Context , obj runtime.Object ) error {
40
+ func (uc * unstructuredClient ) Create (_ context.Context , obj runtime.Object , opts ... CreateOptionFunc ) error {
41
41
u , ok := obj .(* unstructured.Unstructured )
42
42
if ! ok {
43
43
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
44
44
}
45
+ createOpts := CreateOptions {}
46
+ createOpts .ApplyOptions (opts )
45
47
r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetNamespace ())
46
48
if err != nil {
47
49
return err
48
50
}
49
- i , err := r .Create (u , metav1. CreateOptions {} )
51
+ i , err := r .Create (u , * createOpts . AsCreateOptions () )
50
52
if err != nil {
51
53
return err
52
54
}
@@ -55,16 +57,18 @@ func (uc *unstructuredClient) Create(_ context.Context, obj runtime.Object) erro
55
57
}
56
58
57
59
// Update implements client.Client
58
- func (uc * unstructuredClient ) Update (_ context.Context , obj runtime.Object ) error {
60
+ func (uc * unstructuredClient ) Update (_ context.Context , obj runtime.Object , opts ... UpdateOptionFunc ) error {
59
61
u , ok := obj .(* unstructured.Unstructured )
60
62
if ! ok {
61
63
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
62
64
}
65
+ updateOpts := UpdateOptions {}
66
+ updateOpts .ApplyOptions (opts )
63
67
r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetNamespace ())
64
68
if err != nil {
65
69
return err
66
70
}
67
- i , err := r .Update (u , metav1. UpdateOptions {} )
71
+ i , err := r .Update (u , * updateOpts . AsUpdateOptions () )
68
72
if err != nil {
69
73
return err
70
74
}
0 commit comments