Skip to content

Commit 0ba6bde

Browse files
committed
Add connection instructions for kafkactl with OAuth and SASL/PLAIN configurations
1 parent 9e1b839 commit 0ba6bde

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

backstage/templates/consume-kafka-topics/template.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,54 @@ spec:
187187
| Password | set to `REPLACE_ME` in the PR — replace before use |
188188
{%- endif %}
189189
| Topics | ${{ parameters.topics | join(", ") }} |
190+
- title: Connect with kafkactl (copy/paste)
191+
content: |
192+
Save as `kafkactl.yml`, then `export KAFKA_CTL_CONFIG=$PWD/kafkactl.yml`.
193+
{%- if parameters.authMode == "oauth" %}
194+
195+
This app uses OAuth — set `sasl.mechanism: oauth` and supply a bearer token
196+
via your token provider (see the kafkactl OAuth docs); the block below shows
197+
the connection/TLS parts.
198+
199+
```yaml
200+
contexts:
201+
${{ parameters.appName }}:
202+
brokers:
203+
- bootstrap.${{ parameters.appName }}.127-0-0-1.sslip.io:9092
204+
tls:
205+
enabled: true
206+
insecure: true # self-signed demo cert; false with a trusted CA
207+
sasl:
208+
enabled: true
209+
mechanism: oauth
210+
# tokenProvider / token: <supply your OIDC bearer token>
211+
current-context: ${{ parameters.appName }}
212+
```
213+
{%- else %}
214+
215+
```yaml
216+
contexts:
217+
${{ parameters.appName }}:
218+
brokers:
219+
- bootstrap.${{ parameters.appName }}.127-0-0-1.sslip.io:9092
220+
tls:
221+
enabled: true
222+
insecure: true # self-signed demo cert; false with a trusted CA
223+
sasl:
224+
enabled: true
225+
mechanism: plaintext # kafkactl's name for SASL/PLAIN
226+
username: ${{ parameters.appName }}
227+
password: REPLACE_ME # use the password set on your virtual cluster
228+
current-context: ${{ parameters.appName }}
229+
```
230+
{%- endif %}
231+
232+
Then test (logical topic names — the broker prefix is hidden):
233+
234+
```bash
235+
kafkactl --context ${{ parameters.appName }} get topics
236+
kafkactl --context ${{ parameters.appName }} consume ${{ parameters.topics[0] }}
237+
```
190238
- title: Heads up on the password
191239
content: |
192240
The password is a placeholder in the generated manifest. Best practice is to

0 commit comments

Comments
 (0)