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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

xavirg
Copy link

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants