The CLI allows you to export all resources in Lenses as requests so that they can be version controlled and imported into another environment.
Export operations are performed on a per resource basis, the directory structure is defined by the CLI whereas a base directory can be provided using the –dir flag.
Processors, connectors, topics and schemas have an additional prefix flag to restrict resources to export. The commands to export the configurations are shown in the table below.
acls
alert-channels
alert-settings
connections
connectors
processors
quotas
schemas
topics
policies
groups
serviceaccounts
topic-settings
Commands showing how to export the configurations:
lenses-cli export acls --dir my-dir lenses-cli export alert-channels --dir my-dir lenses-cli export alert-settings --dir my-dir lenses-cli export connections --dir my-dir lenses-cli export connectors --dir my-dir lenses-cli export processors --dir my-dir lenses-cli export quotas --dir my-dir lenses-cli export schemas --dir my-dir lenses-cli export topics --dir my-dir lenses-cli export policies --dir my-dir lenses-cli export groups --dir my-dir lenses-cli export serviceaccounts --dir my-dir lenses-cli export topic-settings --dir my-dir
The directory structure is:
my-dir ├── alert-settings │ └── alert-setting.yaml ├── apps │ ├── connectors │ │ ├── connector-1.yaml │ │ └── connector-2.yaml ├── groups │ └── groups.yaml ├── kafka │ ├── quotas │ │ └── quotas.yaml │ └── topics │ ├── topic-1.yaml │ └── topic-2.yaml ├── policies │ └── policies-city.yaml ├── service-accounts │ └── service-accounts.yaml └── schemas ├── schema-1.yaml └── schema-2.yaml
Lenses is on the journey to GitOps. The initial phase is to standardise the import and export of resources and to provide a way to manage resources in a declarative way. This is where AS-Code comes in. Since Lenses 5.5 the As-code feature is available for Kafka Connectors, the other resource will follow in the upcoming releases.
To export the connectors such that the import as-code can be used, use the following command:
lenses-cli export connectors --version 2 [--resource-name my-connector --cluster-name cluster1]
On this page