Skip to content

Provides ability to customize the Container Registry HPA

John Skarbek requested to merge jts/custom-hpa into master
  • Enables the ability to finely tune the targetAverageUtilization cpu metric of the Container Registry Pods
  • Includes capability to fully customize the HPA to the end users' desire
    • enabling full customization completely rids of the default HPA behavior
  • Note that full customization is limited to autoscaling/v2beta1 at this moment in time due to Kubernetes 1.11 support.

Full customization

Let's say we have this in our values.yaml:

registry:
  useCustomHPA:
    - type: Pods
      pods:
        metricName: cpu
        targetAverageValue: 90
    - type: Object
      object:
        metricName: requests-per-second
        target:
          apiVersion: networking.k8s.io/v1beta1
          kind: Ingress
          name: main-route
        targetValue: 2k

We'll end up with something like this:

---
# Source: gitlab/charts/registry/templates/hpa.yaml
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
<snip>
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: release-name-registry
  minReplicas: 2
  maxReplicas: 10
  metrics:
    - pods:
        metricName: cpu
        targetAverageValue: 90
      type: Pods
    - object:
        metricName: requests-per-second
        target:
          apiVersion: networking.k8s.io/v1beta1
          kind: Ingress
          name: main-route
        targetValue: 2k
      type: Object
    % 

Addresses: https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7661

Closes: #1619 (closed)

Edited by John Skarbek

Merge request reports