Skip to content

Commit 23b10bd

Browse files
authored
Use ListWithContextFunc and WatchFuncWithContext (#651)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent cfc085e commit 23b10bd

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎admissionregistration/v1/mutatingwebhookconfiguration.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ func UpdateMutatingWebhookCABundle(config *rest.Config, webhookConfigName string
121121

122122
kc := kubernetes.NewForConfigOrDie(config)
123123
lw := &cache.ListWatch{
124-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
124+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
125125
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
126126
return kc.AdmissionregistrationV1().MutatingWebhookConfigurations().List(ctx, options)
127127
},
128-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
128+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
129129
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
130130
return kc.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(ctx, options)
131131
},
@@ -177,11 +177,11 @@ func SyncMutatingWebhookCABundle(config *rest.Config, webhookConfigName string)
177177

178178
kc := kubernetes.NewForConfigOrDie(config)
179179
lw := &cache.ListWatch{
180-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
180+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
181181
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
182182
return kc.AdmissionregistrationV1().MutatingWebhookConfigurations().List(ctx, options)
183183
},
184-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
184+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
185185
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
186186
return kc.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(ctx, options)
187187
},

‎admissionregistration/v1/validatingwebhookconfiguration.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ func UpdateValidatingWebhookCABundle(config *rest.Config, webhookConfigName stri
121121

122122
kc := kubernetes.NewForConfigOrDie(config)
123123
lw := &cache.ListWatch{
124-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
124+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
125125
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
126126
return kc.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(ctx, options)
127127
},
128-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
128+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
129129
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
130130
return kc.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(ctx, options)
131131
},
@@ -177,11 +177,11 @@ func SyncValidatingWebhookCABundle(config *rest.Config, webhookConfigName string
177177

178178
kc := kubernetes.NewForConfigOrDie(config)
179179
lw := &cache.ListWatch{
180-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
180+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
181181
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
182182
return kc.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(ctx, options)
183183
},
184-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
184+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
185185
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
186186
return kc.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(ctx, options)
187187
},

‎admissionregistration/v1beta1/mutatingwebhookconfiguration.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ func UpdateMutatingWebhookCABundle(config *rest.Config, webhookConfigName string
121121

122122
kc := kubernetes.NewForConfigOrDie(config)
123123
lw := &cache.ListWatch{
124-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
124+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
125125
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
126126
return kc.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(ctx, options)
127127
},
128-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
128+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
129129
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
130130
return kc.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(ctx, options)
131131
},
@@ -177,11 +177,11 @@ func SyncMutatingWebhookCABundle(config *rest.Config, webhookConfigName string)
177177

178178
kc := kubernetes.NewForConfigOrDie(config)
179179
lw := &cache.ListWatch{
180-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
180+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
181181
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
182182
return kc.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(ctx, options)
183183
},
184-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
184+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
185185
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
186186
return kc.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(ctx, options)
187187
},

‎admissionregistration/v1beta1/validatingwebhookconfiguration.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ func UpdateValidatingWebhookCABundle(config *rest.Config, webhookConfigName stri
121121

122122
kc := kubernetes.NewForConfigOrDie(config)
123123
lw := &cache.ListWatch{
124-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
124+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
125125
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
126126
return kc.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(ctx, options)
127127
},
128-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
128+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
129129
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
130130
return kc.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(ctx, options)
131131
},
@@ -177,11 +177,11 @@ func SyncValidatingWebhookCABundle(config *rest.Config, webhookConfigName string
177177

178178
kc := kubernetes.NewForConfigOrDie(config)
179179
lw := &cache.ListWatch{
180-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
180+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
181181
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
182182
return kc.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(ctx, options)
183183
},
184-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
184+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
185185
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, webhookConfigName).String()
186186
return kc.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(ctx, options)
187187
},

‎dynamic/kubernetes.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ func untilHasKey(
105105
}
106106

107107
lw := &cache.ListWatch{
108-
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
108+
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
109109
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, name).String()
110110
return ri.List(ctx, options)
111111
},
112-
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
112+
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
113113
options.FieldSelector = fields.OneTermEqualSelector(kutil.ObjectNameField, name).String()
114114
return ri.Watch(ctx, options)
115115
},

0 commit comments

Comments
 (0)