# Apply recommendations

> Apply recommendations using the method that suits your environment

---

Site [llms.txt](/llms.txt)

---

During a workload's [learning period][learning-period], you can apply its preliminary recommendations only manually. After the learning period, you can deploy recommendations using any of the following methods.

## Choose between patches and a webhook {#choose-apply-method}

By default, StormForge applies recommendations as patches to a workload. You can instead configure StormForge to apply recommendations directly to Pods through a mutating admission webhook. Consider a webhook if you use third-party tools that monitor for configuration drift, or if you have many custom resources.

The Applier uses the configured apply method: `PatchImmediateRollout`, `WebhookImmediateRollout`, `WebhookHybridRollout`, or `WebhookDeferredRollout`. For details, see [Apply method][apply-method] in Apply settings.

With `PatchImmediateRollout`, you can also configure the Applier to reconcile workload drift automatically, so CI/CD and deployment activity on the cluster don't overwrite the recommended settings. For details, see [Continuous reconciliation] in Applier configuration.

## Deploy recommendations on demand

Requires the [StormForge Applier].

Apply a single recommendation outside the schedule, for example, while you experiment with recommendations.

1. In the left navigation, click **Workloads**, then click the workload name.
1. On the workload details page, in the **Recommendation** card, click **Apply Now**.

The Applier deploys the recommendation using the configured [apply method][apply-method].

## Deploy recommendations automatically

Requires the [StormForge Applier].

With automatic deployment, StormForge applies each new recommendation without manual review. To enable it, set the `live.stormforge.io/auto-deploy` annotation to `"Enabled"`, as described in [Auto-deploy][Auto-deploy]. The Applier deploys each recommendation using the configured [apply method][apply-method].

By default, StormForge generates and applies a new recommendation once a day. You can change the [recommendation schedule] based on how closely you want to track CPU and memory usage and how much pod churn you can tolerate. To avoid restarting many workloads at once, StormForge staggers recommendations across the schedule period when the schedule is an ISO 8601 duration or an equivalent macro. For details, see [Schedule][schedule].

When automatic deployment is enabled, you can also configure:

- **Deployment thresholds:** Skip low-impact recommendations to reduce pod churn. The Applier applies a recommendation only when the change meets the [deployment thresholds] you set.
- **Continuous reconciliation of workload drift:** Keep recommended requests and limits in place during CI/CD or deployment activity on the cluster, except for changes made by declared field managers. For details, see [Continuous reconciliation].
- **Memory bump-ups after out-of-memory (OOM) events:** For each container, define the bump-up percentage, minimum and maximum bump-up amounts, and when StormForge applies the bump-up. For details, see [Reliability response][reliability].
- **CPU bump-ups in response to CPU pressure:** For each container, define the bump-up percentage, minimum and maximum bump-up amounts, and when StormForge applies the bump-up. For details, see [Reliability response][reliability].

## Apply recommendations without the Applier {#apply-without-applier}

You can apply recommendations as patches without the StormForge Applier, for example, as part of a CI/CD workflow. Because these methods don't use the Applier, any configured [apply method][apply-method] is ignored.

### Apply with the StormForge CLI

Run the `stormforge apply` command with the appropriate flags. For details, see the [CLI reference][stormforge-apply-ref].

### Apply with kubectl

1. On the **Patches** tab of the workload details page, download or copy the patch. If the tab lists more than one patch, for example, a separate patch for the workload's HPA, apply all of them; they're designed to work together.
1. Apply each patch using the `kubectl` command shown below it.

## Next steps

After applying a recommendation, check the workload's updated optimization score on the **Workloads** page or the workload details page. The next recommendation is available at the time shown in **Next scheduled** on the **Recommendation** card. To receive recommendations more or less often, adjust the [recommendation schedule].

To roll back a recommendation, use Git or Kubernetes-native tools.

<div class="section-index related-topics">
    
    <hr class="panel-line">
        <h4>Related topics</h4>
        <div class="entry">
                <h5>
                    
                    Configure<span class="related-topics-divider">/</span>Settings<span class="related-topics-divider">/</span><a href="/docs/configure/settings/apply-settings/">Apply settings</a>
                </h5>
                <p>Enable automatic deployment, configure the learning period, set optional thresholds to skip low-impact recommendations, and choose an apply method</p>
            </div>
        <div class="entry">
                <h5>
                    
                    Installation<span class="related-topics-divider">/</span><a href="/docs/installation/install-adv/">Advanced installation</a>
                </h5>
                <p>Installation behind a proxy server or from a private container registry</p>
            </div>
        <div class="entry">
                <h5>
                    
                    Recommendations<span class="related-topics-divider">/</span><a href="/docs/recommendations/generate/">Generate recommendations</a>
                </h5>
                <p>Recommendations generated on demand, outside the regular schedule</p>
            </div>
        <div class="entry">
                <h5>
                    
                    Configure<span class="related-topics-divider">/</span>Settings<span class="related-topics-divider">/</span><a href="/docs/configure/settings/reliability/">Reliability</a>
                </h5>
                <p>Respond to OOM and CPU pressure events with a temporary resource bump-up</p>
            </div>
        <div class="entry">
                <h5>
                    
                    Recommendations<span class="related-topics-divider">/</span><a href="/docs/recommendations/view/">View recommendations</a>
                </h5>
                <p>Recommendations on the workload details page and from the command line</p>
            </div>
        </div>


[StormForge Applier]: /docs/installation/install/#stormforge-applier
[Auto-deploy]: /docs/configure/settings/apply-settings/#auto-deploy
[deployment thresholds]: /docs/configure/settings/apply-settings/#thresholds
[recommendation schedule]: /docs/configure/settings/schedule/
[Continuous reconciliation]: /docs/installation/applier-config/#continuous-rec
[apply-method]: /docs/configure/settings/apply-settings/#apply-method
[reliability]: /docs/configure/settings/reliability/
[learning-period]: /docs/configure/settings/apply-settings/#learning-period
[stormforge-apply-ref]: /docs/stormforge-cli/reference/#stormforge-apply
[schedule]: /docs/configure/settings/schedule/#schedule
