Skip to content

Commit 7f46e72

Browse files
committed
Smaller fixes
1 parent cc90df3 commit 7f46e72

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

pkg/client/client_rest_resources.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (c *clientRestResources) getResource(obj any) (*resourceMeta, error) {
115115
}
116116

117117
_, isUnstructured := obj.(runtime.Unstructured)
118-
disableProtoBuf := isUnstructured || isApplyConfiguration
118+
forceDisableProtoBuf := isUnstructured || isApplyConfiguration
119119

120120
// It's better to do creation work twice than to not let multiple
121121
// people make requests at once
@@ -139,7 +139,7 @@ func (c *clientRestResources) getResource(obj any) (*resourceMeta, error) {
139139
// Initialize a new Client
140140
c.mu.Lock()
141141
defer c.mu.Unlock()
142-
r, err = c.newResource(gvk, isList, disableProtoBuf, isUnstructured)
142+
r, err = c.newResource(gvk, isList, forceDisableProtoBuf, isUnstructured)
143143
if err != nil {
144144
return nil, err
145145
}

pkg/client/client_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,9 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
894894
Expect(actualData).To(BeComparableTo(data))
895895
Expect(actualData).To(BeComparableTo(obj.Object["data"]))
896896

897-
data["a-new-key"] = "a-new-value"
897+
data = map[string]any{
898+
"a-new-key": "a-new-value",
899+
}
898900
obj.Object["data"] = data
899901
unstructured.RemoveNestedField(obj.Object, "metadata", "managedFields")
900902

@@ -936,7 +938,9 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
936938
Expect(cm.Data).To(BeComparableTo(data))
937939
Expect(cm.Data).To(BeComparableTo(obj.Data))
938940

939-
data["a-new-key"] = "a-new-value"
941+
data = map[string]string{
942+
"a-new-key": "a-new-value",
943+
}
940944
obj.Data = data
941945

942946
err = cl.Apply(context.Background(), obj, &client.ApplyOptions{FieldManager: "test-manager"})

pkg/client/options.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ type PatchOption interface {
6262
ApplyToPatch(*PatchOptions)
6363
}
6464

65-
// ApplyOption is some configuration that modifies options for a apply request.
65+
// ApplyOption is some configuration that modifies options for an apply request.
6666
type ApplyOption interface {
67-
// A ApplyToApply applies this configuration to the given apply options.
67+
// ApplyToApply applies this configuration to the given apply options.
6868
ApplyToApply(*ApplyOptions)
6969
}
7070

@@ -122,11 +122,12 @@ func (dryRunAll) ApplyToPatch(opts *PatchOptions) {
122122
opts.DryRun = []string{metav1.DryRunAll}
123123
}
124124

125-
func (drun dryRunAll) ApplyToApply(opts *ApplyOptions) {
125+
// ApplyToApply applies this configuration to the given apply options.
126+
func (dryRunAll) ApplyToApply(opts *ApplyOptions) {
126127
opts.DryRun = []string{metav1.DryRunAll}
127128
}
128129

129-
// ApplyToPatch applies this configuration to the given delete options.
130+
// ApplyToDelete applies this configuration to the given delete options.
130131
func (dryRunAll) ApplyToDelete(opts *DeleteOptions) {
131132
opts.DryRun = []string{metav1.DryRunAll}
132133
}
@@ -981,20 +982,20 @@ type ApplyOptions struct {
981982
// result in an error response and no further processing of the
982983
// request. Valid values are:
983984
// - All: all dry run stages will be processed
984-
// +optional
985-
// +listType=atomic
986-
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
985+
DryRun []string
987986

988987
// Force is going to "force" Apply requests. It means user will
989988
// re-acquire conflicting fields owned by other people.
990-
Force *bool `json:"force" protobuf:"varint,2,opt,name=force"`
989+
Force *bool
991990

992991
// fieldManager is a name associated with the actor or entity
993992
// that is making these changes. The value must be less than or
994993
// 128 characters long, and only contain printable characters,
995994
// as defined by https://golang.org/pkg/unicode/#IsPrint. This
996995
// field is required.
997-
FieldManager string `json:"fieldManager" protobuf:"bytes,3,name=fieldManager"`
996+
//
997+
// +required
998+
FieldManager string
998999
}
9991000

10001001
// ApplyOptions applies the given opts onto the ApplyOptions

0 commit comments

Comments
 (0)