Configure optimization defaults for namespaces

Configure optimization settings for namespaces and workloads using annotations

The purpose of this topic is to describe how to use annotations to configure optimization settings.

Topics:

Configure default optimization settings for all workloads in a namespace

To configure settings for all workloads in a namespace, edit the Namespace definition or run kubectl annotate.

Namespace-level defaults:

  • Define the default optimization settings for all workloads in a namespace
  • Override any equivalent cluster-level defaults
  • Are specified using annotations on the namespace
  • Fill in any settings not provided by annotations on the workloads themselves

Using YAML manifests

  1. Open the namespace definition in your favorite editor. This is commonly done using commands like these (remember to replace NAMESPACE and FILENAME with your own values):

    kubectl get namespace NAMESPACE -o yaml > FILENAME && $EDITOR FILENAME
    

    or:

    kubectl edit namespace NAMESPACE
    
  2. Edit the metadata.annotations section to include the annotations you need. For a complete list of annotations for Optimize Live settings, see the Optimization settings and descriptions topic.

    Your file will look something like this:

    apiVersion: v1
    kind: Namespace
    metadata:
      name: example-namespace-name
      annotations:
        live.stormforge.io/schedule: "@daily"
        live.stormforge.io/auto-deploy: "Enabled"
    ...
    

To save time, you can copy the complete list of annotations from the sample Namespace YAML excerpt on the Namespace tab in the Copy a template section of the configuration topic.

  1. Save your changes.

  2. If you chose to run the kubectl get namespace NAMESPACE -o yaml > FILENAME ... command in step 1, apply your changes.

    kubectl apply -f FILENAME
    
  3. Optional: Confirm your changes by running the following command and then reviewing the annotations in the metadata.annotations section of the output:

    kubectl get namespace NAMESPACE -o yaml
    

Using the kubectl annotate command

  1. Run the kubectl annotate command and include the annotation:value pairs you want to set.

    As an example, a kubectl annotate might look something like this (remember to replace NAMESPACE with your appropriate value):

    kubectl annotate namespace NAMESPACE \
      live.stormforge.io/schedule="P1D" \
      live.stormforge.io/auto-deploy="Disabled" \
      live.stormforge.io/containers.cpu.requests.min="20m" \
      live.stormforge.io/containers.cpu.requests.max="16000m"
    

To save time, you can copy the complete list of annotations from the sample Namespace YAML excerpt on the Namespace tab in the Copy a template section of the configuration topic. Be sure to replace the : separator from the template with = as shown in the sample command above.