@Override
    public List<V1HorizontalPodAutoscaler> getBySelector(ApiClient apiClient, String selector, boolean label, String namespace) throws HyscaleException {
        AutoscalingV1Api autoscalingV1Api = new AutoscalingV1Api(apiClient);
        List<V1HorizontalPodAutoscaler> v1HorizontalPodAutoscalers = null;
        try {
            String labelSelector = label ? selector : null;
            String fieldSelector = label ? null : selector;

            V1HorizontalPodAutoscalerList v1HorizontalPodAutoscalerList = autoscalingV1Api.listNamespacedHorizontalPodAutoscaler(namespace, DeployerConstants.TRUE,
                    null, null, fieldSelector, labelSelector, null, null, null, null);

            v1HorizontalPodAutoscalers = v1HorizontalPodAutoscalerList != null ? v1HorizontalPodAutoscalerList.getItems() : null;
        } catch (ApiException e) {
            HyscaleException ex = ExceptionHelper.buildGetException(getKind(), e, ResourceOperation.GET_BY_SELECTOR);
            logger.error("Error while listing HorizontalPodAutoScaler in namespace {}, with selectors {}, error {} ", namespace,
                    selector, ex.toString());
            throw ex;
        }
        return v1HorizontalPodAutoscalers;
    }
This class is responsible for the lifecycle operations of resource
HorizontalPodAutoScaler in kubernetes cluster. It creates resource of
apiVersion: autoscaling/v1
kind: HorizontalPodAutoScaler
deployer/deployer-services/src/main/java/io/hyscale/deployer/services/handler/impl/V1HorizontalPodAutoScalerHandler.java