var MetricVersions … type MetricConverter … // NewMetricConverter creates a MetricConverter which knows how to convert objects // between different versions of the custom metrics api. func NewMetricConverter() *MetricConverter { … } // Scheme returns the scheme used by this metric converter. func (c *MetricConverter) Scheme() *runtime.Scheme { … } // Codecs returns the codecs used by this metric converter func (c *MetricConverter) Codecs() serializer.CodecFactory { … } // ConvertListOptionsToVersion converts converts a set of MetricListOptions // to the provided GroupVersion. func (c *MetricConverter) ConvertListOptionsToVersion(opts *cmint.MetricListOptions, version schema.GroupVersion) (runtime.Object, error) { … } // ConvertResultToVersion converts a Result to the provided GroupVersion func (c *MetricConverter) ConvertResultToVersion(res rest.Result, gv schema.GroupVersion) (runtime.Object, error) { … } // UnsafeConvertToVersionVia is like Scheme.UnsafeConvertToVersion, but it does so via an internal version first. // We use it here to work with the v1beta2 client internally, while preserving backwards compatibility for existing custom metrics adapters func (c *MetricConverter) UnsafeConvertToVersionVia(obj runtime.Object, externalVersion schema.GroupVersion) (runtime.Object, error) { … }