Skip to content

Commit 20f3f4b

Browse files
authored
Merge pull request #2766 from DataDog/fricounet/fix-subresourcecreateoptions
🐛 Fix SubResourceCreateOptions signature in subresource client
2 parents 290ce58 + 55c4331 commit 20f3f4b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

pkg/client/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ func (co *SubResourceCreateOptions) ApplyOptions(opts []SubResourceCreateOption)
523523
return co
524524
}
525525

526-
// ApplyToSubresourceCreate applies the the configuration on the given create options.
527-
func (co *SubResourceCreateOptions) ApplyToSubresourceCreate(o *SubResourceCreateOptions) {
526+
// ApplyToSubResourceCreate applies the the configuration on the given create options.
527+
func (co *SubResourceCreateOptions) ApplyToSubResourceCreate(o *SubResourceCreateOptions) {
528528
co.CreateOptions.ApplyToCreate(&co.CreateOptions)
529529
}
530530

pkg/client/client_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
809809

810810
By("reading the scale subresource")
811811
scale := &autoscalingv1.Scale{}
812-
err = cl.SubResource("scale").Get(ctx, dep, scale)
812+
err = cl.SubResource("scale").Get(ctx, dep, scale, &client.SubResourceGetOptions{})
813813
Expect(err).NotTo(HaveOccurred())
814814
Expect(scale.Spec.Replicas).To(Equal(*dep.Spec.Replicas))
815815
})
@@ -823,7 +823,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
823823
Expect((err)).NotTo(HaveOccurred())
824824

825825
token := &authenticationv1.TokenRequest{}
826-
err = cl.SubResource("token").Create(ctx, serviceAccount, token)
826+
err = cl.SubResource("token").Create(ctx, serviceAccount, token, &client.SubResourceCreateOptions{})
827827
Expect(err).NotTo(HaveOccurred())
828828

829829
Expect(token.Status.Token).NotTo(Equal(""))
@@ -845,7 +845,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
845845
eviction := &policyv1.Eviction{
846846
DeleteOptions: &metav1.DeleteOptions{GracePeriodSeconds: ptr.To(int64(0))},
847847
}
848-
err = cl.SubResource("eviction").Create(ctx, pod, eviction)
848+
err = cl.SubResource("eviction").Create(ctx, pod, eviction, &client.SubResourceCreateOptions{})
849849
Expect((err)).NotTo(HaveOccurred())
850850

851851
By("Asserting the pod is gone")
@@ -869,7 +869,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
869869
binding := &corev1.Binding{
870870
Target: corev1.ObjectReference{Name: node.Name},
871871
}
872-
err = cl.SubResource("binding").Create(ctx, pod, binding)
872+
err = cl.SubResource("binding").Create(ctx, pod, binding, &client.SubResourceCreateOptions{})
873873
Expect((err)).NotTo(HaveOccurred())
874874

875875
By("Asserting the pod is bound")
@@ -892,7 +892,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
892892
Type: certificatesv1.CertificateApproved,
893893
Status: corev1.ConditionTrue,
894894
})
895-
err = cl.SubResource("approval").Update(ctx, csr)
895+
err = cl.SubResource("approval").Update(ctx, csr, &client.SubResourceUpdateOptions{})
896896
Expect(err).NotTo(HaveOccurred())
897897

898898
By("Asserting the CSR is approved")
@@ -917,7 +917,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
917917
Type: certificatesv1.CertificateApproved,
918918
Status: corev1.ConditionTrue,
919919
})
920-
err = cl.SubResource("approval").Patch(ctx, csr, patch)
920+
err = cl.SubResource("approval").Patch(ctx, csr, patch, &client.SubResourcePatchOptions{})
921921
Expect(err).NotTo(HaveOccurred())
922922

923923
By("Asserting the CSR is approved")
@@ -936,10 +936,10 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
936936
dep, err := clientset.AppsV1().Deployments(dep.Namespace).Create(ctx, dep, metav1.CreateOptions{})
937937
Expect(err).NotTo(HaveOccurred())
938938

939-
By("Updating the scale subresurce")
939+
By("Updating the scale subresource")
940940
replicaCount := *dep.Spec.Replicas
941941
scale := &autoscalingv1.Scale{Spec: autoscalingv1.ScaleSpec{Replicas: replicaCount}}
942-
err = cl.SubResource("scale").Update(ctx, dep, client.WithSubResourceBody(scale))
942+
err = cl.SubResource("scale").Update(ctx, dep, client.WithSubResourceBody(scale), &client.SubResourceUpdateOptions{})
943943
Expect(err).NotTo(HaveOccurred())
944944

945945
By("Asserting replicas got updated")
@@ -961,7 +961,7 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
961961
replicaCount := *dep.Spec.Replicas
962962
patch := client.MergeFrom(&autoscalingv1.Scale{})
963963
scale := &autoscalingv1.Scale{Spec: autoscalingv1.ScaleSpec{Replicas: replicaCount}}
964-
err = cl.SubResource("scale").Patch(ctx, dep, patch, client.WithSubResourceBody(scale))
964+
err = cl.SubResource("scale").Patch(ctx, dep, patch, client.WithSubResourceBody(scale), &client.SubResourcePatchOptions{})
965965
Expect(err).NotTo(HaveOccurred())
966966

967967
By("Asserting replicas got updated")

0 commit comments

Comments
 (0)