Documentation ¶
Index ¶
- Variables
- func KindsFor(mapper meta.RESTMapper, kindsOrResources []string) ([]unversioned.GroupVersionKind, error)
- type ExportController
- func (c *ExportController) GetByKey(key string) (interface{}, bool, error)
- func (c *ExportController) List(options kapi.ListOptions) (runtime.Object, error)
- func (c *ExportController) ListKeys() []string
- func (c *ExportController) RunUntil(stopChan <-chan struct{})
- func (c *ExportController) Watch(options kapi.ListOptions) (watch.Interface, error)
- type ExportLister
- type Resource
Constants ¶
This section is empty.
Variables ¶
var ( Flags = pflag.NewFlagSet("openshift-git", pflag.ContinueOnError) Factory = clientcmd.New(Flags) )
init the factory early, to bind the flags
var ( // AllKinds is the list of all kinds that are likely candidates for exporting everything AllKinds = []string{ "ns", "pv", "scc", "clusterPolicies", "clusterPolicyBindings", "users", "groups", "bc", "dc", "rc", "pods", "is", "svc", "routes", "templates", "secrets", "limits", "quota", "pvc", "policies", "policyBindings", "sa", } )
Functions ¶
func KindsFor ¶
func KindsFor(mapper meta.RESTMapper, kindsOrResources []string) ([]unversioned.GroupVersionKind, error)
KindsFor parse the given list of kinds of resources (as string), and return a list of valid kinds (or an error). It supports the standard aliases, and our custom "everything" alias (see AllKinds).
Types ¶
type ExportController ¶
type ExportController struct { // Kind is an instance of the object that should be watched for Kind runtime.Object // ResourcesChan is the channel over which resources will be send ResourcesChan chan<- Resource // ResyncPeriod is the interval of time at which the controller // will perform of full resync (list) for the provided kind ResyncPeriod time.Duration // ListFunc is the function used to list the resources for the provided kind ListFunc func(options kapi.ListOptions) (runtime.Object, error) // WatchFunc is the function used to watch the resources for the provided kind WatchFunc func(options kapi.ListOptions) (watch.Interface, error) // KeyListFunc is a function that returns the list of keys ("namespace/name" format) // that we "know about" (to get a 2-way sync) KeyListFunc func() []string // KeyGetFunc is a function that returns the object that we "know about" // for the given key ("namespace/name" format) - and a boolean if it exists KeyGetFunc func(key string) (interface{}, bool, error) // Requirements is a slice of functions that can create requirements // for customizing the labelSelector for the provided kind Requirements []func() (*labels.Requirement, error) // LabelSelector is a user-provided labelSelector as a string // used to restrict the resources for the provided kind LabelSelector string }
ExportController represents a controller that will react to changes for the given Kind, and push the "exported" resources to a channel.
func (*ExportController) GetByKey ¶
func (c *ExportController) GetByKey(key string) (interface{}, bool, error)
GetByKey implements the cache.KeyGetter interface It is a function that returns the object that we "know about" for the given key ("namespace/name" format) - and a boolean if it exists
func (*ExportController) List ¶
func (c *ExportController) List(options kapi.ListOptions) (runtime.Object, error)
List is for the cache.ListerWatcher implementation List should return a list type object; the Items field will be extracted, and the ResourceVersion field will be used to start the watch in the right place.
func (*ExportController) ListKeys ¶
func (c *ExportController) ListKeys() []string
ListKeys implements the cache.KeyLister interface It is a function that returns the list of keys ("namespace/name" format) that we "know about" (to get a 2-way sync)
func (*ExportController) RunUntil ¶
func (c *ExportController) RunUntil(stopChan <-chan struct{})
RunUntil runs the controller in a goroutine until stopChan is closed
func (*ExportController) Watch ¶
func (c *ExportController) Watch(options kapi.ListOptions) (watch.Interface, error)
Watch is for the cache.ListerWatcher implementation Watch should begin a watch at the specified version.
type ExportLister ¶
type ExportLister struct { // ResourcesChan is the channel over which resources will be send ResourcesChan chan<- Resource // ListFunc is the function used to list the resources for the provided kind ListFunc func(options kapi.ListOptions) (runtime.Object, error) // Requirements is a slice of functions that can create requirements // for customizing the labelSelector for the provided kind Requirements []func() (*labels.Requirement, error) // LabelSelector is a user-provided labelSelector as a string // used to restrict the resources for the provided kind LabelSelector string }
ExportLister represents a lister that can list some resources, and push an "exported" view of these resources to a channel.
func (*ExportLister) List ¶
func (l *ExportLister) List() error
List lists the resources and push them to the channel
type Resource ¶
type Resource struct { // ObjectReference is the reference of the resource (kind, namespace, name, ...) *kapi.ObjectReference // Object is the resource itself Object runtime.Object // Exists indicates if the resource exists or not // (it may have been deleted) Exists bool // Status is a string representation of the current status of the resource // (like "added", "modified", "sync", or "deleted" for example) Status string }
Resource represents an OpenShift resource
func NewResource ¶
NewResource instantiates a new Resource with its reference set to the given kind and namespacedName. The namespacedName is in the format "namespace/name" if it has a namespace or just "name" otherwise.
func (*Resource) IsNamespaced ¶
IsNamespaced returns true if the resource has a namespace
func (*Resource) NamespacedName ¶
NamespacedName returns the namespacedName of the resource with the format "namespace/name" if it has a namespace or just "name" if it has no namespace