Documentation
¶
Overview ¶
Package discovery exposes helpers for detecting cluster shape (provider, multi-tenancy, served APIs) at operator startup.
Index ¶
- func AutoDiscoverProvider(ctx context.Context, clientset kubernetes.Interface) (operatorv1.Provider, error)
- func ElasticIsMigrating(config *corev1.ConfigMap) bool
- func EnterpriseAPIsExist(clientset *kubernetes.Clientset) (bool, error)
- func MultiTenant(ctx context.Context, c kubernetes.Interface) (bool, error)
- func UseExternalElastic(config *corev1.ConfigMap) bool
- type APIDiscovery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoDiscoverProvider ¶
func AutoDiscoverProvider(ctx context.Context, clientset kubernetes.Interface) (operatorv1.Provider, error)
func ElasticIsMigrating ¶
func EnterpriseAPIsExist ¶
func EnterpriseAPIsExist(clientset *kubernetes.Clientset) (bool, error)
EnterpriseAPIsExist reports whether the cluster serves the Calico Enterprise APIs.
func MultiTenant ¶
func UseExternalElastic ¶
UseExternalElastic returns true if this cluster is configured to use an external elasticsearch cluster, and false otherwise.
Types ¶
type APIDiscovery ¶
type APIDiscovery struct {
// contains filtered or unexported fields
}
APIDiscovery is a snapshot of which API versions a cluster serves for the set of GroupKinds the operator cares about. Lookups are pure map reads; no API calls are made after construction.
func DiscoverAPIs ¶
func DiscoverAPIs(mapper meta.RESTMapper) *APIDiscovery
DiscoverAPIs consults the supplied RESTMapper for each tracked GroupKind and records the preferred served version. GroupKinds not served by the cluster (or unknown to the RESTMapper) map to the empty string. Only GroupKinds listed in trackedGroupKinds are queried.
func NewStaticAPIDiscovery ¶
func NewStaticAPIDiscovery(versions map[schema.GroupKind]string) *APIDiscovery
NewStaticAPIDiscovery constructs an APIDiscovery from an explicit version map. Intended for tests.
func (*APIDiscovery) ServedVersion ¶
func (d *APIDiscovery) ServedVersion(group, kind string) string
ServedVersion returns the preferred served version for the given GroupKind, or "" if the kind is not served by the cluster (or is not in the tracked set).