Skip to content

Fleet autoscaler with "List" policy throws an error if configured with a fleet with no replicas #3943

@geopaul-nm

Description

@geopaul-nm

What happened:

If we setup a fleet without defining "replicas" and setup an autoscaler with "List" policy, the autoscaler throws the following error.

Error calculating desired fleet size on FleetAutoscaler simple-game-server-autoscaler. Error: cannot apply ListPolicy as List key MyCustomList does not exist in the Fleet Status

What you expected to happen:

The fleet autoscaler should be able to determine the desired number of replicas even if there is no replicas present.

How to reproduce it (as minimally and precisely as possible):

Setup a fleet with no replicas defined, and a list based autoscaler for the fleet.
Ex.

---
apiVersion: agones.dev/v1
kind: Fleet
metadata:
  name: simple-game-server
spec:
  template:
    spec:
      lists:
        MyCustomList:
          capacity: 50
      ports:
        - name: default
          containerPort: 7654
      template:
        spec:
          containers:
            - name: simple-game-server
              image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.34
              resources:
                requests:
                  memory: 64Mi
                  cpu: 20m
                limits:
                  memory: 64Mi
                  cpu: 20m
---
apiVersion: autoscaling.agones.dev/v1
kind: FleetAutoscaler
metadata:
  name: simple-game-server-autoscaler
spec:
  fleetName: simple-game-server
  policy:
    type: List  # List based autoscaling.
    list:
      key: MyCustomList
      bufferSize: 10%
      minCapacity: 50
      maxCapacity: 800

Below is the describe output of the fleet autoscaler

Name:         simple-game-server-autoscaler
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  autoscaling.agones.dev/v1
Kind:         FleetAutoscaler
Metadata:
  Creation Timestamp:  2024-08-12T14:35:58Z
  Generation:          1
  Resource Version:    28009
  UID:                 91ff6589-e3c4-4456-b5b4-e31767a8ac03
Spec:
  Fleet Name:  simple-game-server
  Policy:
    List:
      Buffer Size:   10%
      Key:           MyCustomList
      Max Capacity:  800
      Min Capacity:  50
    Type:            List
  Sync:
    Fixed Interval:
      Seconds:  30
    Type:       FixedInterval
Events:
  Type     Reason           Age                 From                        Message
  ----     ------           ----                ----                        -------
  Warning  FleetAutoscaler  12s (x25 over 76s)  fleetautoscaler-controller  Error calculating desired fleet size on FleetAutoscaler simple-game-server-autoscaler. Error: cannot apply ListPolicy as List key MyCustomList does not exist in the Fleet Status

Anything else we need to know?:
This is crucial for agones to be used with "Flux CD" (https://fluxcd.io/) and probably other gitops based tools.

Environment:

  • Agones version: 1.42
  • Kubernetes version (use kubectl version): 1.27.1
  • Cloud provider or hardware configuration: Minikube
  • Install method (yaml/helm): helm
  • Troubleshooting guide log(s):
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions