...

Source file src/sigs.k8s.io/cli-utils/pkg/kstatus/polling/doc.go

Documentation: sigs.k8s.io/cli-utils/pkg/kstatus/polling

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

View as plain text