func InspectHPA(hpa *autoscalingv2.HorizontalPodAutoscaler) (emList []custommetrics.ExternalMetricValue) {
	for _, metricSpec := range hpa.Spec.Metrics {
		switch metricSpec.Type {
		case autoscalingv2.ExternalMetricSourceType:
			if metricSpec.External == nil {
				log.Errorf("Missing required \"external\" section in the %s/%s Ref, skipping processing", hpa.Namespace, hpa.Name)
				continue
			}

			if !IsValidMetricName(metricSpec.External.MetricName) {
				log.Errorf("Metric name \"%s\" in %s/%s is invalid, skipping processing", metricSpec.External.MetricName, hpa.Namespace, hpa.Name)
				continue
			}

			em := custommetrics.ExternalMetricValue{
				MetricName: metricSpec.External.MetricName,
				Ref: custommetrics.ObjectReference{
					Type:      "horizontal",
					Name:      hpa.Name,
					Namespace: hpa.Namespace,
					UID:       string(hpa.UID),
				},
			}
			if metricSpec.External.MetricSelector != nil {
				em.Labels = metricSpec.External.MetricSelector.MatchLabels
			}
			emList = append(emList, em)
		default:
			log.Debugf("Unsupported metric type %s", metricSpec.Type)
		}
	}
	return
}
// InspectHPA returns the list of external metrics from the hpa to use for autoscaling.
InspectHPA returns the list of external metrics from the hpa to use for autoscaling.
// InspectHPA returns the list of external metrics from the hpa to use for autoscaling .
func InspectHPA(hpa *autoscalingv2.HorizontalPodAutoscaler) (emList []custommetrics.ExternalMetricValue) {
	for _, metricSpec := range hpa.Spec.Metrics {
		switch metricSpec.Type {
		case autoscalingv2.ExternalMetricSourceType:
			if metricSpec.External == nil {
				log.Errorf("Missing required \"external\" section in the %s/%s Ref, skipping processing", hpa.Namespace, hpa.Name)
				continue
			}
			if !IsValidMetricName(metricSpec.External.MetricName) {
				log.Errorf("Metric name \"%s\" in %s/%s is invalid, skipping processing", metricSpec.External.MetricName, hpa.Namespace, hpa.Name)
				continue
			}
			em := custommetrics.ExternalMetricValue{
				MetricName: metricSpec.External.MetricName,
				Ref: custommetrics.ObjectReference{
					Type:      "horizontal",
					Name:      hpa.Name,
					Namespace: hpa.Namespace,
					UID:       string(hpa.UID),
				},
			}
			if metricSpec.External.MetricSelector != nil {
				em.Labels = metricSpec.External.MetricSelector.MatchLabels
			}
			emList = append(emList, em)
		default:
			log.Debugf("Unsupported metric type %s", metricSpec.Type)
		}
	}
	return
}
func InspectHPA ( hpa * autoscalingv2 . HorizontalPodAutoscaler ) ( emList [ ] custommetrics . ExternalMetricValue ) { for _ , metricSpec := range hpa . Spec . Metrics { switch metricSpec . Type { case autoscalingv2 . ExternalMetricSourceType : if metricSpec . External == nil { log . Errorf ( " \" \" " , hpa . Namespace , hpa . Name ) continue } if ! IsValidMetricName ( metricSpec . External . MetricName ) { log . Errorf ( " \" \" " , metricSpec . External . MetricName , hpa . Namespace , hpa . Name ) continue } em := custommetrics . ExternalMetricValue { MetricName : metricSpec . External . MetricName , Ref : custommetrics . ObjectReference { Type : " " , Name : hpa . Name , Namespace : hpa . Namespace , UID : string ( hpa . UID ) , } , } if metricSpec . External . MetricSelector != nil { em . Labels = metricSpec . External . MetricSelector . MatchLabels } emList = append ( emList , em ) default : log . Debugf ( " " , metricSpec . Type ) } } return }
InspectHPA returns the list of external metrics from the hpa to use for autoscaling.
InspectHPA returns the list of external metrics from the hpa to use for autoscaling .