var metricVersionsToGV … func init() { … } // NewAvailableAPIsGetter creates an AvailableAPIsGetter that checks discovery // to find the available versions of the custom metrics api. func NewAvailableAPIsGetter(client discovery.DiscoveryInterface) AvailableAPIsGetter { … } type apiVersionsFromDiscovery … // fetchVersions fetches the versions, but doesn't try to invalidate on cache misses. func (d *apiVersionsFromDiscovery) fetchVersions() (*metav1.APIGroup, error) { … } // chooseVersion sets a preferred version of the custom metrics api based on available versions. func (d *apiVersionsFromDiscovery) chooseVersion(apiGroup *metav1.APIGroup) (schema.GroupVersion, error) { … } // PreferredVersion returns the current preferred version of the custom metrics api. // If none is specified, it will use the first known one. func (d *apiVersionsFromDiscovery) PreferredVersion() (schema.GroupVersion, error) { … } // Invalidate refreshes the preferred version information. func (d *apiVersionsFromDiscovery) Invalidate() { … }