5.0
Is CLI provision suitable for GitOps?
Currently, Lenses CLI command
lenses-cli provision
is a method used to provision only initial configuration when Lenses is deployed from scratch. Consecutive runs of the provision command are not supported for the time being, and may have unintended consequences.
Based on the above fact, Lenses CLI provision
, does not allow for a true “GitOps” workflow. Specifically the following deployment methods, by default skip provisioning from the CLI, using --setup-mode
flag as in the
next section
Waiting for the Wizard to complete
In order to help with configuration race conditions, between the Lenses UI
wizard and Lenses CLI
provision
, we can opt for CLI provision
command to wait until wizard setup, has been completed.
When --setup-mode
is used as a flag for CLI provision
command: lenses-cli provision
the behaviour depends on the phase of Lenses deployment:
- If Lenses is deployed from scratch, and
Lenses CLI
runsprovision
with no existing configuration,--setup-mode
puts provisioning into a wait mode untilLenses CLI
Wizard configuration is complete. - If Lenses CLI
provision
is re-run,--setup-mode
skips CLIprovision
altogether.
To help showcase this behaviour let’s consider the following Scenarios:
Scenario: Initial provision using CLI, updates using UI
- Use only
provision
command for initial provision run. Never use UI wizard.lenses-cli provision
will create all configuration based on values in provision.yaml . Similarly use - Helm with fieldlenses.provision.enabled
set totrue
. Helm provision uses the CLI command in an automated way, during first install. - To update configuration values, such as e.g. Kafka connection urls, assume we use the
Lenses UI
. Configuration is applied correctly. - Even if
provision.yaml has updates on a later stage, re-runs of
lenses-cli provision
with--setup-mode
flag, will be skipped, rendering all changes in provision.yaml ineffective. Correct course of action is to use theLenses UI
for all updates, from now on.
Scenario: Initial provision using UI Wizard, updates using CLI
- Use
Lenses UI
Wizard for initial provision run.lenses-cli provision
with--setup-mode
flag, will wait for the Wizard mode to be completed. When wizard has finished,lenses-cli provision
with--setup-mode
flag, will be skipped, ignoring all initial values in provision.yaml - To update configuration values, such as e.g. Kafka connection urls, assume we update provision.yaml values. Configuration updates will never be applied.
- Even if
provision.yaml has updates on a later stage, re-runs of
lenses-cli provision
with--setup-mode
flag, will be skipped, rendering all changes in provision.yaml ineffective. Correct course of action is to use theLenses UI
for all updates, from now on.
Scenario: Initial provision using CLI, updates using CLI
- Use only
provision
command for initial provision run. Never use UI wizard.lenses-cli provision
will create all configuration based on values in provision.yaml . Similarly use - Helm with fieldlenses.provision.enabled
set totrue
. Helm provision uses the CLI command in an automated way, during first install. - To update configuration values, such as e.g. Kafka connection urls, assume we update provision.yaml values. Configuration updates will never be applied.
- Even if
provision.yaml has updates on a later stage, re-runs of
lenses-cli provision
with--setup-mode
flag, will be skipped, rendering all changes in provision.yaml ineffective. Correct course of action is to use theLenses UI
for all updates, from now on.