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

Integrate additional OAuth 0.15.0 config options #9970

Merged
merged 11 commits into from
Jul 16, 2024

Conversation

mstruk
Copy link
Contributor

@mstruk mstruk commented Apr 16, 2024

Type of change

  • Enhancement / new feature

Description

The following options have been added to authentication section of type oauth of Kafka CR:

  • serverBearerTokenLocation
  • userNamePrefix

The following options have been added to authentication section of type oauth of KafkaMirrorMaker, KafkaMirrorMaker2, KafkaConnectCluster, and KafkaBridge CRs:

  • accessTokenLocation
  • clientAssertion
  • clientAssertionLocation
  • clientAssertionType
  • saslExtensions

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md
  • Supply screenshots for visual changes, such as Grafana dashboards

@mstruk mstruk added this to the 0.41.0 milestone Apr 16, 2024
@scholzj scholzj modified the milestones: 0.41.0, 0.42.0 May 7, 2024
@scholzj scholzj modified the milestones: 0.42.0, 0.43.0 Jul 1, 2024
@mstruk mstruk force-pushed the oauth-0.15.0 branch 2 times, most recently from 8eef877 to 94337b9 Compare July 2, 2024 11:59
@mstruk mstruk marked this pull request as ready for review July 4, 2024 10:54
@mstruk mstruk requested a review from scholzj July 4, 2024 10:54
Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

I thought we would include docs on how to configure it for the Servic Accoutn configuration. Or will that be a separate Pr?

@@ -99,6 +99,7 @@ public class KafkaBridgeCluster extends AbstractModel implements SupportsLogging
protected static final String ENV_VAR_KAFKA_BRIDGE_OAUTH_ACCESS_TOKEN = "KAFKA_BRIDGE_OAUTH_ACCESS_TOKEN";
protected static final String ENV_VAR_KAFKA_BRIDGE_OAUTH_REFRESH_TOKEN = "KAFKA_BRIDGE_OAUTH_REFRESH_TOKEN";
protected static final String ENV_VAR_KAFKA_BRIDGE_OAUTH_PASSWORD_GRANT_PASSWORD = "KAFKA_BRIDGE_OAUTH_PASSWORD_GRANT_PASSWORD";
protected static final String ENV_VAR_KAFKA_BRIDGE_OAUTH_CLIENT_ASSERTION = "KAFKA_BRIDGE_OAUTH_CLIENT_ASSERTION";
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be used only in tests. So why do we need it? Should we move it to the test class? Or should it be actually set somewhere? The same applies to some of the other classes as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm just following a pattern here. It's the kafka_bridge_config_generator.sh shell script that uses these same env vars to configure the bridge. I assume they are in this class as they are considered part of the contract. What does @ppatierno think?

Copy link
Member

Choose a reason for hiding this comment

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

So, I'm a bit curios how you set the environment variable if you don't use the name anywhere in the production code. Is it assembled somewhere on the fly from some prefix and suffix? But I'm not aware of any contract that we add there a variable not referenced from the Java code itself - I'm certainly not following such contract in any of my PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of these constants are indeed only used in tests and could be moved into some test class. But I'll defer to @ppatierno to give an opinion.

Copy link
Member

Choose a reason for hiding this comment

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

So, the above env vars related constant were used here in the past as well IIRC but then we moved to this approach to build them https://github.com/strimzi/strimzi-kafka-operator/blob/main/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KafkaBridgeCluster.java#L458
At this point, I guess we can removed them from here and move to test classes.

Copy link
Member

Choose a reason for hiding this comment

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

A separate PR is fine with me. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

I think it is fine to move the others in a separate PR. But we should not introduce new variables like this in this PR.

Copy link
Member

Choose a reason for hiding this comment

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

@mstruk I saw you moved the env vars within this PR. Wasn't the plan to do that in a different one as stated above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ppatierno Given that I had to move one constant based on additional feedback, it was actually trivial to move the others as well and avoid the overhead of doing another PR. The idea of another PR was to get this one merged ASAP. But at this point doing another PR is an overhead.

Copy link
Member

Choose a reason for hiding this comment

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

Ok makes sense thanks

@scholzj scholzj requested a review from ppatierno July 4, 2024 18:21
@mstruk
Copy link
Contributor Author

mstruk commented Jul 5, 2024

I thought we would include docs on how to configure it for the Servic Accoutn configuration. Or will that be a separate Pr?

I'm making a separate PR for that. But I can also add it to this one if you prefer.

@scholzj
Copy link
Member

scholzj commented Jul 5, 2024

I thought we would include docs on how to configure it for the Servic Accoutn configuration. Or will that be a separate Pr?

I'm making a separate PR for that. But I can also add it to this one if you prefer.

Doing it in a separate PR is fine. It was just not clear to me. Thanks.

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

@mstruk This looks good to me now. Thanks. Could you please rebase it so that I can run the regression tests?

mstruk added 10 commits July 16, 2024 16:05
The following options have been added to `authentication` section of type `oauth` of Kafka CR:
- `userNamePrefix`
- `serverBearerTokenLocation`

The following options have been added to `authentication` section of type `oauth` of KafkaMirrorMaker, KafkaMirrorMaker2, KafkaConnectCluster, and KafkaBridge CRs:
- `clientAssertion`
- `clientAssertionLocation`
- `clientAssertionType`
- `saslExtensions`

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…checkAccessTokenType`

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
@scholzj
Copy link
Member

scholzj commented Jul 16, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scholzj scholzj merged commit 4aa2d4b into strimzi:main Jul 16, 2024
21 checks passed
@scholzj
Copy link
Member

scholzj commented Jul 16, 2024

Thanks @mstruk

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.

3 participants