// HPA checks whether the HPA version is v2beta1 or v2beta2
HPA checks whether the HPA version is v2beta1 or v2beta2
// HPA checks whether the HPA version is v2beta1 or v2beta2
func HPA(client *client.Client, api *wso2v1alpha1.API, dep *appsv1.Deployment, owner *[]metav1.OwnerReference) (*v2beta1.HorizontalPodAutoscaler,
	*v2beta2.HorizontalPodAutoscaler) {
	hpaConfMap := k8s.NewConfMap()
	err := k8s.Get(client, types.NamespacedName{Namespace: config.SystemNamespace, Name: hpaConfigMapName}, hpaConfMap)
	if err != nil {
		logHpa.Error(err, "HPA configs not defined")
		return nil, nil
	}
	if hpaConfMap.Data[hpaVersionConst] == "v2beta1" {
		hpaV2beta1 := HPAv2beta1(api, dep, owner)
		return hpaV2beta1, nil
	}
	if hpaConfMap.Data[hpaVersionConst] == "v2beta2" {
		hpaV2beta2 := HPAv2beta2(api, dep, owner)
		return nil, hpaV2beta2
	}
	return nil, nil
}
func HPA ( client * client . Client , api * wso2v1alpha1 . API , dep * appsv1 . Deployment , owner * [ ] metav1 . OwnerReference ) ( * v2beta1 . HorizontalPodAutoscaler , * v2beta2 . HorizontalPodAutoscaler ) { hpaConfMap := k8s . NewConfMap ( ) err := k8s . Get ( client , types . NamespacedName { Namespace : config . SystemNamespace , Name : hpaConfigMapName } , hpaConfMap ) if err != nil { logHpa . Error ( err , " " ) return nil , nil } if hpaConfMap . Data [ hpaVersionConst ] == " " { hpaV2beta1 := HPAv2beta1 ( api , dep , owner ) return hpaV2beta1 , nil } if hpaConfMap . Data [ hpaVersionConst ] == " " { hpaV2beta2 := HPAv2beta2 ( api , dep , owner ) return nil , hpaV2beta2 } return nil , nil }
HPA checks whether the HPA version is v2beta1 or v2beta2
HPA checks whether the HPA version is v2beta1 or v2beta2
// get global hpa configs, return error if not found (required config map)