Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI-3355] Fix some confluent kafka topic consume errors #2970

Merged
merged 8 commits into from
Dec 16, 2024
Merged

Conversation

sgagniere
Copy link
Member

@sgagniere sgagniere commented Dec 11, 2024

Release Notes

Breaking Changes

  • PLACEHOLDER

New Features

  • PLACEHOLDER

Bug Fixes

  • Fix a bug preventing users from consuming audit logs with confluent kafka topic consume
  • Fix bugs preventing users from producing or consuming from a Cloud cluster while logged out using confluent kafka topic [produce | consume] --bootstrap

Checklist

  • Leave this box unchecked if features are not yet available in production

What

  • The assumption that a SR cluster always exists is false in the audit log environment, so this PR changes the call to get SR ID and endpoint to only happen if the key or value type is avro, protobuf, or jsonschema (for consume)
  • For produce, only make a call to get the endpoint and ID if the user has not already provided the endpoint while logged out, to avoid a panic
  • The GetDataplaneToken call will fail for users consuming from a cloud cluster using --bootstrap while logged out, so this PR adds a check that the user is logged in before attempting to get the token

References

Test & Review

Tested with the following.

  • while logged in: confluent kafka topic consume -b confluent-audit-log-events
  • while logged out:
    • Produce:
      • confluent kafka topic produce string-topic --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET
      • confluent kafka topic produce avro-topic --value-format avro --schema 100004 --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET --schema-registry-endpoint $SR_ENDPOINT --schema-registry-api-key $SR_KEY --schema-registry-api-secret $SR_SECRET
      • confluent kafka topic produce json-topic --value-format jsonschema --schema 100005 --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET --schema-registry-endpoint $SR_ENDPOINT --schema-registry-api-key $SR_KEY --schema-registry-api-secret $SR_SECRET
      • confluent kafka topic produce protobuf-topic --value-format protobuf --schema 100007 --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET --schema-registry-endpoint $SR_ENDPOINT --schema-registry-api-key $SR_KEY --schema-registry-api-secret $SR_SECRET
    • Consume:
      • confluent kafka topic consume confluent-audit-log-events -b --bootstrap $AUDIT_CLUSTER_ENDPOINT --api-key $AUDIT_KEY --api-secret $AUDIT_SECRET
      • confluent kafka topic consume string-topic -b --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET
      • confluent kafka topic consume avro-topic -b --value-format avro --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET --schema-registry-endpoint $SR_ENDPOINT --schema-registry-api-key $SR_KEY --schema-registry-api-secret $SR_SECRET
      • confluent kafka topic consume json-topic -b --value-format jsonschema --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET --schema-registry-endpoint $SR_ENDPOINT --schema-registry-api-key $SR_KEY --schema-registry-api-secret $SR_SECRET
      • confluent kafka topic consume protobuf-topic -b --value-format protobuf --bootstrap $ENDPOINT --api-key $CLUSTER_KEY --api-secret $CLUSTER_SECRET --schema-registry-endpoint $SR_ENDPOINT --schema-registry-api-key $SR_KEY --schema-registry-api-secret $SR_SECRET

@sgagniere sgagniere requested a review from a team as a code owner December 11, 2024 00:55
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@sgagniere sgagniere marked this pull request as draft December 11, 2024 02:11
@sgagniere sgagniere marked this pull request as ready for review December 12, 2024 01:11
Copy link
Contributor

@channingdong channingdong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also handle the auth.GetDataplaneToken(c.Context) in consumeOnPrem() and produceOnPrem()?

@channingdong
Copy link
Contributor

Discussed with Steven, we'll track the CP specific issue in CLI-3360.

Copy link
Contributor

@channingdong channingdong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@sgagniere sgagniere merged commit abe2c13 into main Dec 16, 2024
2 checks passed
@sgagniere sgagniere deleted the cli-3355 branch December 16, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants