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
- func UseSingleIndex(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 ¶ added in v1.44.0
func EnterpriseAPIsExist ¶ added in v1.44.0
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.
func UseSingleIndex ¶ added in v1.44.0
UseSingleIndex returns true if this single tenant management cluster is in the last phase of a migration to single-index storage, during which the operator must reconfigure Linseed to use the single-index names.
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).