Configure optimization defaults for the cluster

Configure default optimization settings for the cluster

The purpose of this topic is to describe how to use the cluster-defaults ConfigMap to configure default optimization settings for a cluster.

Topics:

Configure default optimization settings for all workloads in the cluster

Cluster-level defaults:

  • Define the default optimization settings for all workloads in a cluster
  • Are specified in a ConfigMap named cluster-defaults in the stormforge-system namespace
  • Have the lowest configuration precedence and can be overridden by namespace annotations or by annotations on individual workload resources

Setting cluster default values using kubectl apply

  1. Create a YAML file that defines a ConfigMap called cluster-defaults, with a cluster-defaults.yaml data key, and the settings you want to set in annotation syntax.

    For a complete list of annotations for Optimize Live settings, see the the Optimization settings and descriptions topic.

    Your file will look something like this:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cluster-defaults
      namespace: stormforge-system
    data:
      cluster-defaults.yaml: |
        live.stormforge.io/schedule: "P1D"
        live.stormforge.io/auto-deploy: "false"
        live.stormforge.io/containers.cpu.requests.min: "20m"
        live.stormforge.io/containers.cpu.requests.max: "16000m"    
    ...
    
  2. Apply the file:

    kubectl apply -f FILENAME -n stormforge-system
    
  3. Restart the StormForge Agent:

    kubectl rollout restart deployment stormforge-agent-workload-controller -n stormforge-system 
    

    To check the status of the restart, run:

    kubectl rollout status deployment stormforge-agent-workload-controller -n stormforge-system -w
    

    Any previous cluster-level default values are now removed, and your new defaults are in effect unless they are overridden at the namespace or workload level.

  4. Optional: Confirm your changes by running the following command and then reviewing the cluster-defaults.yaml item in the Data section of the output:

    kubectl describe configmap cluster-defaults -n stormforge-system 
    

Setting cluster default values using kubectl edit

If the cluster-defaults ConfigMap has already been created, you can edit the ConfigMap directly.

  1. Run the folllowing command:

    kubectl edit configmap cluster-defaults -n stormforge-system
    

    If you see a Error from server (NotFound): configmaps "cluster-defaults" not found message, no cluster-level defaults are set. You must first create and apply a cluster defaults YAML file as described above.

    If you don’t see an error message, continue to the next step.

  2. In the .data.cluster-defaults.yaml section, add, edit, or remove annotation strings as needed.

    As an example, your annotations in the cluster-defaults ConfigMap might look something like this excerpt when you’re done:

    # Please edit the object below. Lines beginning with a '#' will be ignored,
    # and an empty file will abort the edit. If an error occurs while saving this file will be
    # reopened with the relevant failures.
    #
    apiVersion: v1
    kind: ConfigMap
    data:
      cluster-defaults.yaml: |
        live.stormforge.io/auto-deploy: "true"
        live.stormforge.io/cpu.optimization-goal: "Reliability"
        live.stormforge.io/memory.optimization-goal: "Reliability"    
    ...
    
  3. Save your changes.

  4. Restart the StormForge Agent:

    kubectl rollout restart deployment stormforge-agent-workload-controller -n stormforge-system
    

    To check the status of the restart, run:

    kubectl rollout status deployment stormforge-agent-workload-controller -n stormforge-system -w
    

    Any previous cluster-level default values are now removed, and your new defaults are in effect unless they are overridden at the namespace or workload level.

  5. Optional: Confirm your changes by running the following command and then reviewing the annotations in the Data section of the output:

    kubectl describe configmap cluster-defaults -n stormforge-system 
    
Last modified July 3, 2024