Skip to content

Commit

Permalink
add code comments for the new types and fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Jonas Werner committed Jul 9, 2021
1 parent 5b7b824 commit c2ea35c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kstatus/polling/polling.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type Options struct {
// then each resource will be fetched when needed with GET calls.
UseCache bool

// CustomStatusReadersFactoryFunc, when called, provides the StatusPoller with a map of custom
// StatusReaders for the given GroupKinds. These will be used along with the StatusReaders shipped with this
// library. However, it can also be used to override these with custom StatusReaders if the returned map
// has a key for the given GroupKinds, e.g. apps/deployments.
CustomStatusReadersFactoryFunc func(engine.ClusterReader, meta.RESTMapper) map[schema.GroupKind]engine.StatusReader
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/kstatus/polling/statusreaders/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
"sigs.k8s.io/cli-utils/pkg/object"
)

// StatusFunc returns the status of the given object. This func is passed into
// NewGenericStatusReader so that the returned StatusReader can be used for custom types.
// An example of a StatusFunc is status.Compute.
type StatusFunc func(u *unstructured.Unstructured) (*status.Result, error)

func NewGenericStatusReader(reader engine.ClusterReader, mapper meta.RESTMapper, statusFunc StatusFunc) engine.StatusReader {
Expand Down

0 comments on commit c2ea35c

Please sign in to comment.