Skip to content

Migration from v0.10.0 to v0.11.0

The change from v0.10.0 to v0.11.0 is a large one, primarily because of the change from being a CustomPodAutoscaler to becoming a fully fledged PredictiveHorizontalPodAutoscaler custom resource and operator.

Some key differences for this is that you no longer need the custom-pod-autoscaler-operator to run PHPAs, and if you have no other Custom Pod Autoscalers on your cluster you can safely uninstall this operator.

Now to deploy PHPAs you need to install the Predictive Horizontal Pod Autoscaler operator instead, you see how to do that by following the installation guide.

Example migration

Let's take migrating one of the examples as a basis for how the migration looks, we'll look at the simple-linear example.

In v0.10.0 the simple-linear YAML to deploy the PHPA was this:

apiVersion: custompodautoscaler.com/v1
kind: CustomPodAutoscaler
metadata:
  name: simple-linear
spec:
  template:
    spec:
      containers:
      - name: simple-linear
        image: jthomperoo/predictive-horizontal-pod-autoscaler:v0.10.0
        imagePullPolicy: IfNotPresent
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: php-apache
  roleRequiresMetricsServer: true
  config:
    - name: minReplicas
      value: "1"
    - name: maxReplicas
      value: "10"
    - name: predictiveConfig
      value: |
        models:
        - type: Linear
          name: LinearPrediction
          perInterval: 1
          linear:
            lookAhead: 10000
            storedValues: 6
        decisionType: "maximum"
        metrics:
        - type: Resource
          resource:
            name: cpu
            target:
              averageUtilization: 50
              type: Utilization
    - name: interval
      value: "10000"
    - name: downscaleStabilization
      value: "0"

In v0.11.0 the simple-linear YAML now looks like this:

apiVersion: jamiethompson.me/v1alpha1
kind: PredictiveHorizontalPodAutoscaler
metadata:
  name: simple-linear
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: php-apache
  minReplicas: 1
  maxReplicas: 10
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          averageUtilization: 50
          type: Utilization
  models:
    - type: Linear
      name: simple-linear
      perSyncPeriod: 1
      linear:
        lookAhead: 10000
        historySize: 6
  decisionType: "maximum"
  syncPeriod: 10000
  downscaleStabilization: 0

These are still similar, but there are some key differences, first the resource kind has changed from a CustomPodAutoscaler to being a PredictiveHorizontalPodAutoscaler:

In v0.10.0:

apiVersion: custompodautoscaler.com/v1
kind: CustomPodAutoscaler
metadata:
  name: simple-linear
spec:
  template:
    spec:
      containers:
      - name: simple-linear
        image: jthomperoo/predictive-horizontal-pod-autoscaler:v0.10.0
        imagePullPolicy: IfNotPresent

In v0.11.0 the same information is captured here:

apiVersion: jamiethompson.me/v1alpha1
kind: PredictiveHorizontalPodAutoscaler
metadata:
  name: simple-linear
spec:

We no longer need to provide containers/an image for the PHPA to use, the operator handles all of the processing internally so a separate image is no longer needed.

We still provide a scaleTargetRef in the spec as before:

scaleTargetRef:
  apiVersion: apps/v1
  kind: Deployment
  name: php-apache

We no longer need this line:

roleRequiresMetricsServer: true

The operator will handle all needed permissions automatically.

This configuration expressed in v0.10.0:

  config:
    - name: minReplicas
      value: "1"
    - name: maxReplicas
      value: "10"
    - name: predictiveConfig
      value: |
        models:
        - type: Linear
          name: LinearPrediction
          perInterval: 1
          linear:
            lookAhead: 10000
            storedValues: 6
        decisionType: "maximum"
        metrics:
        - type: Resource
          resource:
            name: cpu
            target:
              averageUtilization: 50
              type: Utilization
    - name: interval
      value: "10000"
    - name: downscaleStabilization
      value: "0"

Is now expressed like this:

  minReplicas: 1
  maxReplicas: 10
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          averageUtilization: 50
          type: Utilization
  models:
    - type: Linear
      name: simple-linear
      perSyncPeriod: 1
      linear:
        lookAhead: 10000
        historySize: 6
  decisionType: "maximum"
  syncPeriod: 10000
  downscaleStabilization: 0

You can see how instead of providing key value pairs we can now provide normal YAML directly.

Some key differences highlighted here:

  • interval has been renamed to syncPeriod.
  • perInterval has been renamed to perSyncPeriod.
  • storedValues has been renamed to historySize.
  • predictiveConfig has been removed and replaced with metrics, models, and decisionType directly.

What has changed in full

See the changelog for what has changed in the v0.11.0 release in full.