Exporting


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.

CommandsDescription
aclsExport the ACL configuration
alert-channelsExport the alert channels configured
alert-settingsExport the alert setting configured
connectionsExport the connections configured
connectorsExport the connectors configured
processorsExport the processors created
quotasExport the quotas configured in Kafka
schemasExport the schamas configured
topicsExport the topics registered
policiesExport the policies configured
groupsExport the groups created
serviceaccountsExport the service accounts created
topic-settingsExport the topics settings

Exporting Configurations 

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

AS-Code 

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]
--
Last modified: June 18, 2024