mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #68795 from damemi/custom-metrics-conversion-fix
Update custom metrics conversion functions
This commit is contained in:
commit
cdadc117e1
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/conversion"
|
"k8s.io/apimachinery/pkg/conversion"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/metrics/pkg/apis/custom_metrics"
|
"k8s.io/metrics/pkg/apis/custom_metrics"
|
||||||
@ -36,12 +37,38 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custom_metrics.MetricValue, s conversion.Scope) error {
|
func Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custom_metrics.MetricValue, s conversion.Scope) error {
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
out.DescribedObject = custom_metrics.ObjectReference{
|
||||||
|
Kind: in.DescribedObject.Kind,
|
||||||
|
Namespace: in.DescribedObject.Namespace,
|
||||||
|
Name: in.DescribedObject.Name,
|
||||||
|
UID: in.DescribedObject.UID,
|
||||||
|
APIVersion: in.DescribedObject.APIVersion,
|
||||||
|
ResourceVersion: in.DescribedObject.ResourceVersion,
|
||||||
|
FieldPath: in.DescribedObject.FieldPath,
|
||||||
|
}
|
||||||
|
out.Timestamp = in.Timestamp
|
||||||
|
out.WindowSeconds = in.WindowSeconds
|
||||||
|
out.Value = in.Value
|
||||||
out.Metric.Name = in.MetricName
|
out.Metric.Name = in.MetricName
|
||||||
out.Metric.Selector = in.Selector
|
out.Metric.Selector = in.Selector
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in *custom_metrics.MetricValue, out *MetricValue, s conversion.Scope) error {
|
func Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in *custom_metrics.MetricValue, out *MetricValue, s conversion.Scope) error {
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
out.DescribedObject = v1.ObjectReference{
|
||||||
|
Kind: in.DescribedObject.Kind,
|
||||||
|
Namespace: in.DescribedObject.Namespace,
|
||||||
|
Name: in.DescribedObject.Name,
|
||||||
|
UID: in.DescribedObject.UID,
|
||||||
|
APIVersion: in.DescribedObject.APIVersion,
|
||||||
|
ResourceVersion: in.DescribedObject.ResourceVersion,
|
||||||
|
FieldPath: in.DescribedObject.FieldPath,
|
||||||
|
}
|
||||||
|
out.Timestamp = in.Timestamp
|
||||||
|
out.WindowSeconds = in.WindowSeconds
|
||||||
|
out.Value = in.Value
|
||||||
out.MetricName = in.Metric.Name
|
out.MetricName = in.Metric.Name
|
||||||
out.Selector = in.Metric.Selector
|
out.Selector = in.Metric.Selector
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user