From 6b91e8e65756b561525314771a913145d161aa14 Mon Sep 17 00:00:00 2001
From: Rajath Agasthya <rajathagasthya@gmail.com>
Date: Tue, 17 Sep 2019 17:26:11 -0700
Subject: [PATCH] Set limit and continue in ApplyToList method

Limit and continue support for ListOptions were recently added, but it
was missing in ApplyToList method.
---
 pkg/client/options.go      |  6 ++++++
 pkg/client/options_test.go | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/pkg/client/options.go b/pkg/client/options.go
index 61bb59fe95..62b5a86242 100644
--- a/pkg/client/options.go
+++ b/pkg/client/options.go
@@ -336,6 +336,12 @@ func (o *ListOptions) ApplyToList(lo *ListOptions) {
 	if o.Raw != nil {
 		lo.Raw = o.Raw
 	}
+	if o.Limit > 0 {
+		lo.Limit = o.Limit
+	}
+	if o.Continue != "" {
+		lo.Continue = o.Continue
+	}
 }
 
 // AsListOptions returns these options as a flattened metav1.ListOptions.
diff --git a/pkg/client/options_test.go b/pkg/client/options_test.go
index 83b818cc5a..1d4402e385 100644
--- a/pkg/client/options_test.go
+++ b/pkg/client/options_test.go
@@ -54,6 +54,18 @@ var _ = Describe("ListOptions", func() {
 		o.ApplyToList(newListOpts)
 		Expect(newListOpts).To(Equal(o))
 	})
+	It("Should set Limit", func() {
+		o := &client.ListOptions{Limit: int64(1)}
+		newListOpts := &client.ListOptions{}
+		o.ApplyToList(newListOpts)
+		Expect(newListOpts).To(Equal(o))
+	})
+	It("Should set Continue", func() {
+		o := &client.ListOptions{Continue: "foo"}
+		newListOpts := &client.ListOptions{}
+		o.ApplyToList(newListOpts)
+		Expect(newListOpts).To(Equal(o))
+	})
 	It("Should not set anything", func() {
 		o := &client.ListOptions{}
 		newListOpts := &client.ListOptions{}