Webhook configuration
This topic covers the configuration parameters available for the StormForge webhook.
The webhook runs as its own Deployment and serves these functions:
- Pod mutation: sets recommended container resources on Pods when they’re created, for workloads that use a webhook-based apply method.
- Validation: checks ClusterOptimizationConfiguration and OptimizationConfiguration resources when you create or update them.
- CRD conversion: converts ClusterOptimizationConfiguration and OptimizationConfiguration resources between
optimize.stormforge.io/v1andv2.
Applying these settings
These are Helm values for the stormforge chart. Add them to a YAML values file (for example, values.yaml) and pass it to your Helm command.
At install time:
helm install stormforge oci://registry.stormforge.io/library/stormforge \
--namespace stormforge-system \
-f values.yaml
To apply changes after installation:
helm upgrade stormforge oci://registry.stormforge.io/library/stormforge \
--namespace stormforge-system \
--reset-then-reuse-values \
-f values.yaml
Webhook parameters:
- Enable or disable the webhook
- Pod mutation
- Namespace allow and deny lists
- Failure policy
- TLS configuration
- Use your own TLS certificate
- CRD conversion
- Deprecated parameter names
Enable or disable the webhook
Controls whether StormForge runs the webhook Deployment.
| Parameter | Default value |
|---|---|
webhook.enabled |
true |
Description
When the chart installs the StormForge CRDs (crds.enabled=true, the default), the webhook is required: installing or upgrading fails if webhook.enabled is false. The ClusterOptimizationConfiguration and OptimizationConfiguration CRDs rely on the webhook to convert resources between v1 and v2. To stop the webhook from changing Pods while keeping it running, disable pod mutation instead.
Valid values
true(default)false: only when you setcrds.enabled=falseand don’t use ClusterOptimizationConfiguration or OptimizationConfiguration resources
Pod mutation
Controls whether the webhook sets recommended container resources on Pods when they’re created.
| Parameter | Default value |
|---|---|
webhook.handlers.podContainerResources.enabled |
true |
Description
Pod mutation applies recommendations for workloads that use a webhook-based apply method (WebhookImmediateRollout, WebhookHybridRollout, WebhookDeferredRollout). It requires webhook.enabled=true and the Applier (applier.enabled=true).
When pod mutation is disabled, or a namespace list excludes a namespace, recommendations are still generated but aren’t applied to workloads that use a webhook-based method. The recommended values in the UI and CLI can then differ from the values on the Pods. Patch-based methods aren’t affected.
You can set live.stormforge.io/apply.method on individual namespaces or workloads to use a webhook-based method. For annotation syntax details, see Apply method in the Apply Settings topic.
Continuous reconciliation, if enabled, doesn’t run for workloads using a webhook-based apply method. Webhook methods set resources when Pods are created, instead of patching workloads continuously.
Valid values
true(default)false
Namespace allow and deny lists
Limit which namespaces pod mutation applies to.
| Parameter | Default value |
|---|---|
webhook.handlers.podContainerResources.allowNamespaces |
[] |
webhook.handlers.podContainerResources.denyNamespaces |
[] |
Description
- To limit pod mutation to specific namespaces, list them in
allowNamespaces. - To exclude specific namespaces from mutation, list them in
denyNamespaces.
Don’t set both lists. If you do, installing or upgrading fails.
For workloads in an excluded namespace, see Pod mutation.
Valid values
An array of exact namespace names.
Examples
webhook:
handlers:
podContainerResources:
denyNamespaces:
- kube-system
or
webhook:
handlers:
podContainerResources:
allowNamespaces:
- monitoring
- frontend
Failure policy
Controls what happens to Pod admission if the webhook is unavailable or returns an error.
| Parameter | Default value |
|---|---|
webhook.handlers.podContainerResources.failurePolicy |
Ignore |
Description
Ignore (default): If the webhook fails, the admission request proceeds. Pods are created normally, but recommendations aren’t applied to them.
Fail: If the webhook fails, the admission request is rejected. Use with caution: a webhook outage blocks Pod creation in namespaces covered by pod mutation.
Valid values
Ignore(default)Fail
TLS configuration
The API server calls the webhook over TLS, so it needs the CA that signed the webhook’s serving certificate. StormForge supports two ways to provide that certificate:
- Integrated certificates (default, recommended): StormForge issues and rotates the certificate. Nothing to configure.
- Your own certificate: you manage the certificate, through cert-manager or your own CA. See Use your own TLS certificate.
With integrated certificates, the webhook Deployment runs a built-in cert-controller. It issues a self-signed CA and serving certificate, rotates them, and updates the CA in the webhook configurations and the CRD conversion settings.
If you install the CRDs outside the chart (crds.enabled=false), use your own certificate. The integrated cert-controller only keeps the CA current in CRDs the chart installs. See CRD conversion.
Use your own TLS certificate
This section applies only if you manage the webhook certificate yourself. With integrated certificates, skip to CRD conversion.
Choose one option:
- cert-manager: cert-manager issues the certificate and keeps the CA current.
- Certificate from your own CA: you supply the certificate and its CA, for example, from a corporate CA or Vault.
| Parameter | Default value |
|---|---|
webhook.tlsSecretName |
"" |
webhook.caBundle |
"" |
crds.annotations |
{} |
Certificate requirements
Both options set webhook.tlsSecretName. This disables the integrated cert-controller and serves that Secret’s certificate instead.
The certificate must be issued for the webhook Service’s DNS name. For a release named stormforge in the stormforge-system namespace, that’s stormforge-webhook.stormforge-system.svc. The name changes with the release name, nameOverride, or fullnameOverride. Installing or upgrading with webhook.tlsSecretName set prints the full list of names the certificate must cover.
If the certificate doesn’t match, the API server rejects the connection. With the default failure policy of Ignore, Pods are then created without recommended resources, and no error is shown.
The API server also needs the CA that signed the certificate. With cert-manager, its cert-manager.io/inject-ca-from annotation supplies it. With your own CA, webhook.caBundle supplies it. If the chart finds neither for the pod mutation webhook, the validation webhook, or the CRDs it installs, installing or upgrading fails.
cert-manager
Use this option when cert-manager already runs in your cluster. cert-manager issues the certificate, and its CA injector writes the CA into every webhook configuration and CRD that needs it.
-
Create a cert-manager Certificate in the StormForge namespace. Replace
ISSUER_NAMEwith the name of your ClusterIssuer. For a namespaced Issuer, also setkind: Issuer.apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: stormforge-webhook namespace: stormforge-system spec: secretName: stormforge-webhook-tls dnsNames: - stormforge-webhook.stormforge-system.svc issuerRef: name: ISSUER_NAME kind: ClusterIssuer -
Set
webhook.tlsSecretNameto the Certificate’ssecretName, and add thecert-manager.io/inject-ca-fromannotation, set toNAMESPACE/CERTIFICATE_NAME, to the pod mutation and validation webhooks and the CRDs. Leavewebhook.caBundleempty.webhook: tlsSecretName: stormforge-webhook-tls handlers: podContainerResources: webhookAnnotations: cert-manager.io/inject-ca-from: stormforge-system/stormforge-webhook optimizationConfiguration: webhookAnnotations: cert-manager.io/inject-ca-from: stormforge-system/stormforge-webhook crds: annotations: cert-manager.io/inject-ca-from: stormforge-system/stormforge-webhook
cert-manager renews the certificate and updates the CA without further action.
Certificate from your own CA
Use this option when your organization’s CA, Vault, or security team issues the certificate, and cert-manager isn’t available.
-
Create a
kubernetes.io/tlsSecret containingtls.crtandtls.keyin the StormForge namespace. -
Set
webhook.tlsSecretNameto the Secret’s name, andwebhook.caBundleto the base64-encoded PEM of the CA that signedtls.crt. To encode it, runbase64 < ca.crt | tr -d '\n'.webhook: tlsSecretName: stormforge-webhook-tls caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t...
To renew the serving certificate, update the Secret. The webhook loads the new certificate without a restart. If the CA changes, set the new webhook.caBundle and run helm upgrade.
webhook.caBundle only takes effect when webhook.tlsSecretName is also set. Otherwise, the integrated cert-controller replaces it with its own CA.
CRD conversion
The ClusterOptimizationConfiguration and OptimizationConfiguration CRDs serve optimize.stormforge.io/v1 (deprecated) and v2, and store resources as v2. When a client uses v1, for example, by applying existing v1 manifests, the API server calls the webhook to convert it. The webhook must stay enabled regardless of how you install the CRDs. To move your manifests to v2, see Migrate from the v1 API.
| Parameter | Default value |
|---|---|
crds.enabled |
true |
Description
By default, the chart installs the CRDs and configures their conversion settings, including the CA the API server uses to trust the webhook.
If you install the CRDs outside the chart, for example, through GitOps, set crds.enabled=false. You then maintain each CRD’s conversion settings. The integrated cert-controller only updates CRDs the chart installs, so use cert-manager or a certificate from your own CA, and put those TLS values in a values file.
-
Render the CRDs from the chart with the same release name, namespace, and values you install with, including any
nameOverrideorfullnameOverride. The conversion settings reference the webhook Service by name, so these must match.- Replace
CREDENTIAL_FILEwith the name of the file that contains your access credential. - Replace
CLUSTER_NAMEwith the name of the cluster (lowercase, no underscore) you’re installing on. - Replace
TLS_VALUES_FILEwith the name of the file that contains your TLS values.
helm template stormforge oci://registry.stormforge.io/library/stormforge \ --namespace stormforge-system \ --values CREDENTIAL_FILE \ --values TLS_VALUES_FILE \ --set clusterName=CLUSTER_NAME \ --set crds.enabled=true \ --show-only templates/crds/optimize.stormforge.io_clusteroptimizationconfigurations.yaml \ --show-only templates/crds/optimize.stormforge.io_optimizationconfigurations.yamlWith cert-manager, the rendered CRDs carry the
cert-manager.io/inject-ca-fromannotation and cert-manager fills in the CA. With your own CA, they already contain it. - Replace
-
Apply the rendered CRDs with your usual tooling.
-
Install the chart with
crds.enabled=falseand the same TLS values file.
If your own CA changes, render and apply the CRDs again with the new webhook.caBundle.
Valid values
true(default)false
Deprecated parameter names
These parameters moved under webhook.handlers.podContainerResources and are deprecated. The old names still work and take precedence if both are set.
| Deprecated | Replacement |
|---|---|
webhook.failurePolicy |
webhook.handlers.podContainerResources.failurePolicy |
webhook.allowNamespaces |
webhook.handlers.podContainerResources.allowNamespaces |
webhook.denyNamespaces |
webhook.handlers.podContainerResources.denyNamespaces |
webhook.webhookAnnotations |
webhook.handlers.podContainerResources.webhookAnnotations |