Documentation ¶
Overview ¶
Package discovery provides efficient means to query Kubernetes clusters for the state of its api surface and existing objects
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterQuery ¶
type ClusterQuery struct {
// contains filtered or unexported fields
}
ClusterQuery provides a means of executing a queries targets to determine results
func (*ClusterQuery) Execute ¶
func (c *ClusterQuery) Execute() (bool, error)
Execute runs all the query targets and returns true only if *all* of them succeed. For granular results of each query, use the Results() method after calling this method. Normally this function is returned by Prepare() and stored as a constant to re-use
func (*ClusterQuery) Prepare ¶
func (c *ClusterQuery) Prepare() func() (bool, error)
Prepare queries for the discovery API on the resources, GVKs and/or partial schema a cluster has.
func (*ClusterQuery) Results ¶
func (c *ClusterQuery) Results() Results
Results returns all of the queries failures
type ClusterQueryClient ¶
type ClusterQueryClient struct {
// contains filtered or unexported fields
}
ClusterQueryClient allows clients to inspect the cluster objects, GVK and schema state of a cluster
func NewClusterQueryClient ¶
func NewClusterQueryClient(dynamicClient dynamic.Interface, discoveryClient discovery.DiscoveryInterface) (*ClusterQueryClient, error)
NewClusterQueryClient returns a new cluster query builder
func NewClusterQueryClientForConfig ¶
func NewClusterQueryClientForConfig(config *rest.Config) (*ClusterQueryClient, error)
NewClusterQueryClientForConfig returns a new cluster query builder for a REST config.
func (*ClusterQueryClient) PreparedQuery ¶
func (c *ClusterQueryClient) PreparedQuery(targets ...QueryTarget) func() (bool, error)
PreparedQuery provides a prepared object
func (*ClusterQueryClient) Query ¶
func (c *ClusterQueryClient) Query(targets ...QueryTarget) *ClusterQuery
Query provides a new query object to prepare
type QueryGVR ¶
type QueryGVR struct {
// contains filtered or unexported fields
}
QueryGVR provides insight to the clusters GVRs
func (*QueryGVR) WithResource ¶
WithResource checks if an API group with the specified resource exists. This method can be omitted to query any resource.
func (*QueryGVR) WithVersions ¶
WithVersions checks if an API group with all the specified versions exist. This method can be omitted to query any version.
type QueryResult ¶
type QueryResult struct { // Found indicates whether the entity being checked in the query exists. Found bool // NotFoundReason indicates the reason why Found was false. NotFoundReason string }
QueryResult is a result of a single query.
type QueryTarget ¶
type QueryTarget interface { Name() string Run(config *clusterQueryClientConfig) (bool, error) Reason() string }
QueryTarget implementations: Resource, GVK, Schema
type Results ¶
type Results map[string]*QueryResult
Results is a map of query names to their corresponding QueryResult.
func (Results) ForQuery ¶
func (r Results) ForQuery(queryName string) *QueryResult
ForQuery returns the QueryResult for a given query name. Return value is nil if the query target with the given name does not exist.