MCPcopy
hub / github.com/kubernetes/client-go / Watch

Method Watch

dynamic/simple.go:284–310  ·  view source on GitHub ↗
(opts metav1.ListOptions)

Source from the content-addressed store, hash-verified

282}
283
284func (c *dynamicResourceClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
285 internalGV := schema.GroupVersions{
286 {Group: c.resource.Group, Version: runtime.APIVersionInternal},
287 // always include the legacy group as a decoding target to handle non-error `Status` return types
288 {Group: "", Version: runtime.APIVersionInternal},
289 }
290 s := &rest.Serializers{
291 Encoder: watchNegotiatedSerializerInstance.EncoderForVersion(watchJsonSerializerInfo.Serializer, c.resource.GroupVersion()),
292 Decoder: watchNegotiatedSerializerInstance.DecoderToVersion(watchJsonSerializerInfo.Serializer, internalGV),
293
294 RenegotiatedDecoder: func(contentType string, params map[string]string) (runtime.Decoder, error) {
295 return watchNegotiatedSerializerInstance.DecoderToVersion(watchJsonSerializerInfo.Serializer, internalGV), nil
296 },
297 StreamingSerializer: watchJsonSerializerInfo.StreamSerializer.Serializer,
298 Framer: watchJsonSerializerInfo.StreamSerializer.Framer,
299 }
300
301 wrappedDecoderFn := func(body io.ReadCloser) streaming.Decoder {
302 framer := s.Framer.NewFrameReader(body)
303 return streaming.NewDecoder(framer, s.StreamingSerializer)
304 }
305
306 opts.Watch = true
307 return c.client.client.Get().AbsPath(c.makeURLSegments("")...).
308 SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
309 WatchWithSpecificDecoders(wrappedDecoderFn, unstructured.UnstructuredJSONScheme)
310}
311
312func (c *dynamicResourceClient) Patch(name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error) {
313 if len(name) == 0 {

Callers

nothing calls this directly

Calls 7

makeURLSegmentsMethod · 0.95
AbsPathMethod · 0.80
GetMethod · 0.65
EncoderForVersionMethod · 0.45
DecoderToVersionMethod · 0.45

Tested by

no test coverage detected