forked from kubernetes-sigs/cli-utils
-
Notifications
You must be signed in to change notification settings - Fork 3
/
doc.go
40 lines (39 loc) · 1.27 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2020 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// Package polling is a library for computing the status of kubernetes resources
// based on polling of resource state from a cluster. It can keep polling until
// either some condition is met, or until it is cancelled through the provided
// context. Updates on the status of resources are streamed back to the caller
// through a channel.
//
// This package provides a simple interface based on the built-in
// features. But the actual code is in the subpackages and there
// are several interfaces that can be implemented to support custom
// behavior.
//
// # Polling Resources
//
// In order to poll a set of resources, create a StatusPoller
// and pass in the list of ResourceIdentifiers to the Poll function.
//
// import (
// "github.com/fluxcd/cli-utils/pkg/kstatus/polling"
// )
//
// identifiers := []prune.ObjMetadata{
// {
// GroupKind: schema.GroupKind{
// Group: "apps",
// Kind: "Deployment",
// },
// Name: "dep",
// Namespace: "default",
// }
// }
//
// poller := polling.NewStatusPoller(reader, mapper, true)
// eventsChan := poller.Poll(context.Background(), identifiers, polling.PollOptions{})
// for e := range eventsChan {
// // Handle event
// }
package polling