Looks like there is no support to delete HorizontalPodAutoscaler using fabric8's K8S Java client ver:6.0.0.
Although It is straightforward to create HorizontalPodAutoscaler using fabric8's K8S Java client ver:6.0.0.
E.g.
HorizontalPodAutoscalerStatus hpaStatus = k8sClient.resource(createHPA())
.inNamespace(namespace)
.createOrReplace().getStatus();
public HorizontalPodAutoscaler createHPA(){
return new HorizontalPodAutoscalerBuilder()
.withNewMetadata()
.withName(applicationName)
.addToLabels("name", applicationName)
.endMetadata()
.withNewSpec()
.withNewScaleTargetRef()
.withApiVersion(hpaApiVersion)
.withKind("Deployment")
.withName(applicationName)
.endScaleTargetRef()
.withMinReplicas(minReplica)
.withMaxReplicas(maxReplica)
.addNewMetric()
.withType("Resource")
.withNewResource()
.withName("cpu")
.withNewTarget()
.withType("Utilization")
.withAverageUtilization(cpuAverageUtilization)
.endTarget()
.endResource()
.endMetric()
.addNewMetric()
.withType("Resource")
.withNewResource()
.withName("memory")
.withNewTarget()
.withType("AverageValue")
.withAverageValue(new Quantity(memoryAverageValue))
.endTarget()
.endResource()
.endMetric()
.withNewBehavior()
.withNewScaleDown()
.addNewPolicy()
.withType("Pods")
.withValue(podScaleDownValue)
.withPeriodSeconds(podScaleDownPeriod)
.endPolicy()
.withStabilizationWindowSeconds(podScaledStabaliztionWindow)
.endScaleDown()
.endBehavior()
.endSpec().build();
}
Any solution to delete HorizontalPodAutoscaler using fabric8's K8S Java client ver:6.0.0 will be appriciated.