Skip to content

Commit 038d2c8

Browse files
committed
Bump Kubernetes version to 0.1.14
implement and test patch options implement new metrics provider API
1 parent 856708d commit 038d2c8

File tree

339 files changed

+19174
-8449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

339 files changed

+19174
-8449
lines changed

Gopkg.lock

Lines changed: 47 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ required = ["sigs.k8s.io/testing_frameworks/integration",
3030

3131
[[constraint]]
3232
name = "k8s.io/api"
33-
version = "kubernetes-1.13.4"
33+
version = "kubernetes-1.14.1"
3434

3535
[[constraint]]
3636
name = "k8s.io/apiextensions-apiserver"
37-
version = "kubernetes-1.13.4"
37+
version = "kubernetes-1.14.1"
3838

3939
[[constraint]]
4040
name = "k8s.io/apimachinery"
41-
version = "kubernetes-1.13.4"
41+
version = "kubernetes-1.14.1"
4242

4343
[[constraint]]
4444
name = "k8s.io/client-go"
45-
version = "kubernetes-1.13.4"
45+
version = "kubernetes-1.14.1"
4646

4747
[[constraint]]
4848
name = "sigs.k8s.io/testing_frameworks"

pkg/client/client_test.go

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ var _ = Describe("Client", func() {
10631063

10641064
})
10651065

1066-
It("should respect passed in update options", func() {
1066+
PIt("should respect passed in update options", func() {
10671067
By("creating a new client")
10681068
cl, err := client.New(cfg, client.Options{})
10691069
Expect(err).NotTo(HaveOccurred())
@@ -1074,7 +1074,7 @@ var _ = Describe("Client", func() {
10741074
Expect(err).NotTo(HaveOccurred())
10751075

10761076
By("patching the Deployment with dry-run")
1077-
err = cl.Patch(context.TODO(), dep, client.ConstantPatch(types.MergePatchType, mergePatch), client.UpdatePatchWith(client.UpdateDryRunAll()))
1077+
err = cl.Patch(context.TODO(), dep, client.ConstantPatch(types.MergePatchType, mergePatch), client.PatchDryRunAll())
10781078
Expect(err).NotTo(HaveOccurred())
10791079

10801080
By("validating patched Deployment doesn't have the new annotation")
@@ -1183,7 +1183,7 @@ var _ = Describe("Client", func() {
11831183
Kind: "Deployment",
11841184
Version: "v1",
11851185
})
1186-
err = cl.Patch(context.TODO(), u, client.ConstantPatch(types.MergePatchType, mergePatch), client.UpdatePatchWith(client.UpdateDryRunAll()))
1186+
err = cl.Patch(context.TODO(), u, client.ConstantPatch(types.MergePatchType, mergePatch), client.PatchDryRunAll())
11871187
Expect(err).NotTo(HaveOccurred())
11881188

11891189
By("validating patched Deployment does not have the new annotation")
@@ -2153,6 +2153,30 @@ var _ = Describe("Client", func() {
21532153
Expect(co.AsUpdateOptions()).To(Equal(&metav1.UpdateOptions{}))
21542154
})
21552155
})
2156+
2157+
Describe("PatchOptions", func() {
2158+
It("should allow setting DryRun to 'all'", func() {
2159+
po := &client.PatchOptions{}
2160+
client.PatchDryRunAll()(po)
2161+
all := []string{metav1.DryRunAll}
2162+
Expect(po.AsPatchOptions().DryRun).To(Equal(all))
2163+
})
2164+
2165+
It("should allow setting Force to 'true'", func() {
2166+
po := &client.PatchOptions{}
2167+
client.PatchWithForce()(po)
2168+
mpo := po.AsPatchOptions()
2169+
Expect(mpo.Force).NotTo(BeNil())
2170+
Expect(*mpo.Force).To(BeTrue())
2171+
})
2172+
2173+
It("should produce empty metav1.PatchOptions if nil", func() {
2174+
var po *client.PatchOptions
2175+
Expect(po.AsPatchOptions()).To(Equal(&metav1.PatchOptions{}))
2176+
po = &client.PatchOptions{}
2177+
Expect(po.AsPatchOptions()).To(Equal(&metav1.PatchOptions{}))
2178+
})
2179+
})
21562180
})
21572181

21582182
var _ = Describe("DelegatingReader", func() {

pkg/client/fake/client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ func (c *fakeClient) Update(ctx context.Context, obj runtime.Object, opts ...cli
187187
}
188188

189189
func (c *fakeClient) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOptionFunc) error {
190+
patchOptions := &client.PatchOptions{}
191+
patchOptions.ApplyOptions(opts)
192+
193+
for _, dryRunOpt := range patchOptions.DryRun {
194+
if dryRunOpt == metav1.DryRunAll {
195+
return nil
196+
}
197+
}
198+
190199
gvr, err := getGVRFromObject(obj, c.scheme)
191200
if err != nil {
192201
return err

0 commit comments

Comments
 (0)