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

[exporter/kafkaexporter] Skip Username and Password config validation for IAM #37417

Merged
merged 25 commits into from
Mar 5, 2025

Conversation

xavirg
Copy link
Contributor

@xavirg xavirg commented Jan 22, 2025

Description

In kafka.SASLConfig, Username and Password fields are always required:

func validateSASLConfig(c *kafka.SASLConfig) error {
	if c == nil {
		return nil
	}

	if c.Username == "" {
		return fmt.Errorf("auth.sasl.username is required")
	}

	if c.Password == "" {
		return fmt.Errorf("auth.sasl.password is required")
	}

However, when the authentication mechanism is set to either AWS_MSK_IAM or AWS_MSK_IAM_OAUTHBEARER, those properties are never used:

exporters:
  kafka/example:
    auth:
      sasl:
        username: "foo" # Not used
        password: "bar" # Not used
        mechanism: "AWS_MSK_IAM_OAUTHBEARER"
        aws_msk:
            region: us-east-1

Implemented logic to bypass User and Password validation when the mechanism is set to AWS IAM.

Testing

Added a test to make sure kafka.SASLConfig.Username and kafka.SASLConfig.Password are not required

Copy link

linux-foundation-easycla bot commented Jan 22, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@xavirg xavirg marked this pull request as ready for review January 22, 2025 15:13
@xavirg xavirg requested a review from a team as a code owner January 22, 2025 15:13
@atoulme
Copy link
Contributor

atoulme commented Jan 23, 2025

Thank you for your contribution ; please add a changelog entry by typing make chlog-new in your checkout and following instructions.

@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label Mar 4, 2025
@atoulme atoulme merged commit e979e41 into open-telemetry:main Mar 5, 2025
156 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/kafka ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants