|
| 1 | +# Confluent Cloud Example |
| 2 | + |
| 3 | +This is a basic example of using `kafka-gitops` with Confluent Cloud. |
| 4 | + |
| 5 | +## Files |
| 6 | +- `services.yaml` defines service accounts + generates ACLs |
| 7 | +- `topics.yaml` defines topics and their configs |
| 8 | +- `users.yaml` defines "user" service accounts and roles (prefixed with `user-{name}`) |
| 9 | + |
| 10 | +## Configuration |
| 11 | + |
| 12 | +The following environment variables need to be set locally or in the build job: |
| 13 | + |
| 14 | +```bash |
| 15 | +# For service account creation / listing |
| 16 | +export XX_CCLOUD_EMAIL="Your Confluent Cloud email address" |
| 17 | +export XX_CCLOUD_PASSWORD="Your Confluent Cloud password" |
| 18 | + |
| 19 | +# For executing against the cluster |
| 20 | +export KAFKA_BOOTSTRAP_SERVERS="Your Confluent Cloud cluster URL" |
| 21 | +export KAFKA_SASL_JAAS_USERNAME"Your Confluent Cloud API key" |
| 22 | +export KAFKA_SASL_JAAS_PASSWORD="Your Confluent Cloud API secret" |
| 23 | +export KAFKA_SECURITY_PROTOCOL="SASL_SSL" |
| 24 | +export KAFKA_SASL_MECHANISM="PLAIN" |
| 25 | +export KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM="HTTPS" |
| 26 | + |
| 27 | +# For colored output |
| 28 | +export CLICOLOR_FORCE="true" |
| 29 | +``` |
| 30 | + |
| 31 | +## Service Accounts |
| 32 | + |
| 33 | +Once defining services and users, you can generate service accounts. |
| 34 | + |
| 35 | +**NOTE**: Before running `accounts` or `plan`, ensure you are logged in to Confluent Cloud. Use `ccloud login`. |
| 36 | + |
| 37 | +Create accounts: |
| 38 | + |
| 39 | +```bash |
| 40 | +kafka-gitops -f state.yaml accounts |
| 41 | +``` |
| 42 | + |
| 43 | +## Plan |
| 44 | + |
| 45 | +Generate an execution plan against your Confluent Cloud cluster as so: |
| 46 | + |
| 47 | +```bash |
| 48 | +kafka-gitops -f state.yaml plan -o plan.json |
| 49 | +``` |
| 50 | + |
| 51 | +To disable deletes, you can use: |
| 52 | + |
| 53 | +```bash |
| 54 | +kafka-gitops -f state.yaml --no-delete plan -o plan.json |
| 55 | +``` |
| 56 | + |
| 57 | +This will output a plan file as well as pretty print the plan to standard out. |
| 58 | + |
| 59 | +## Apply |
| 60 | + |
| 61 | +Apply the plan against your Confluent Cloud cluster as so: |
| 62 | + |
| 63 | +```bash |
| 64 | +kafka-gitops -f state.yaml apply -p plan.json |
| 65 | +``` |
| 66 | + |
| 67 | + |
| 68 | +To disable deletes, you can use: |
| 69 | + |
| 70 | +```bash |
| 71 | +kafka-gitops -f state.yaml --no-delete apply -p plan.json |
| 72 | +``` |
0 commit comments