Add conditional statusInformers to kots application

Currently we have some status informers set up that let users know when their installation is complete and our application is live. We’d like to add some status informers that are used in some installations and not in others, depending on (1) the value of certain license fields that we set, and (2) the value of certain ConfigOptions that users specify during installation.

Example:

apiVersion: kots.io/v1beta1
kind: Application
metadata:
  name: our-app
spec:
  statusInformers:
    - deployment/deployment-a
    - deployment/deployment-b
    - deployment/deployment-c # make this only happen if a certain license field value or ConfigOption is set

How would we add the deployment-c case conditionally as described above?

Hi Luke,

Conditional status informers are supported via template functions. If a template function evaluates to an empty string, the status informer is excluded. For example:

statusInformers:
  - deployment/deployment-a
  - deployment/deployment-b
  - '{{repl if ConfigOptionEquals "option" "value"}}deployment/deployment-c{{repl else}}{{repl end}}'

In the example above, the deployment/deployment-c status informer is excluded unless the statement in the ConfigOptionEquals template function evaluates to true.

Reference: https://docs.replicated.com/vendor/admin-console-display-app-status#examples

Hope that helps.

Salah Al Saleh
Senior Software Engineer @ Replicated

2 Likes