router_user_snippets_disable

Description

The router_user_snippets_disable parameter refuses a deploy when a Service's ingressAnnotations include an nginx snippet annotation. A snippet annotation adds raw nginx configuration to the router, and every App on the Rack shares that router.

A snippet annotation is a key that starts with nginx.ingress.kubernetes.io/ and ends in -snippet, such as configuration-snippet or auth-snippet. Keys match in any case and with surrounding spaces.

The check runs when a Release is promoted. The Build still runs, the promote fails, and the running Release keeps serving. The error names each refused annotation on its own line:

ERROR: service web: ingress annotation nginx.ingress.kubernetes.io/configuration-snippet is not allowed while router_user_snippets_disable=true
Command Checked
convox deploy, convox releases promote, convox releases rollback, convox env set --promote, convox apps import yes, with or without --force
convox apps params set, convox apps lock, convox apps unlock no
Annotation Refused
a snippet key on a Service with a public route or internalRouter: true yes
the exact key nginx.ingress.kubernetes.io/server-snippet no: it is a reserved key, and Convox replaces any value you set with its own
any annotation on a Service with internal: true and no internalRouter: true no: those Services have no route on the router
keys under another prefix, such as example.com/x-snippet no: the router ignores them

The parameter has no effect on nginx_additional_config or on the router settings Convox manages.

Default Value

The default value is false. Snippet annotations deploy as before.

Use Cases

  • Shared Racks: keep App deploys from adding raw configuration to a router that serves every App on the Rack.
  • Router stability: a snippet the router cannot load can stop router configuration updates for every App. Refusing snippets at promote keeps such configuration off the router.

Setting the Parameter

Remove snippet annotations from your Apps first. An App that already runs with snippet annotations keeps them until its next deploy, and that deploy is then refused.

$ convox rack params set router_user_snippets_disable=true -r rackName
Updating parameters... OK

Also set app_rack_url_disable: Apps that call the Rack API are not restricted by this parameter.

$ convox rack params set router_user_snippets_disable=true app_rack_url_disable=true -r rackName
Updating parameters... OK

Setting the parameter to true prints these warnings:

When Warning
always WARNING: apps already using -snippet ingress annotations keep them until their next deploy, which is then refused. Remove the annotations first.
app_rack_url_disable is not true, already or in the same command WARNING: router_user_snippets_disable does not stop apps that call the rack API through RACK_URL. Set app_rack_url_disable=true as well.

To allow snippet annotations again:

$ convox rack params set router_user_snippets_disable=false -r rackName
Updating parameters... OK

Viewing Current Configuration

$ convox rack params -r rackName

Additional Information

  • Validation: the CLI stores true or false and rejects any other value with param 'router_user_snippets_disable' must be 'true' or 'false' (got "<value>").
  • subs_filter: whatever this parameter is set to, a promote is refused when a snippet uses subs_filter on a Rack running the default router image. See ingressAnnotations.
  • Version: requires Rack version 3.26.1 or later and CLI version 3.26.1 or later. An older CLI rejects the parameter with unknown parameter 'router_user_snippets_disable' for azure provider.
  • Downgrade: downgrading below 3.26.1 stops the check and removes the parameter with NOTICE: removing parameters not supported by version <version>: router_user_snippets_disable on stderr. A Rack managed through the Console keeps the stored value and applies it again on the next update to 3.26.1 or later. A self-managed Rack drops the value, so set it again after upgrading.
  • Providers: AWS, GCP, Azure, DigitalOcean and metal. See AWS, GCP and DigitalOcean. On metal Racks, set it through the CLI. Local Racks do not support it.

See Also