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

Additional documentation for OAuth 0.15.0 features and how to use Service Accounts #10317

Merged
merged 19 commits into from
Jul 26, 2024

Conversation

mstruk
Copy link
Contributor

@mstruk mstruk commented Jul 8, 2024

Type of change

  • Documentation

Description

This PR adds documentation for features introduced in #9970

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 requested a review from PaulRMellor July 8, 2024 15:57
@mstruk mstruk added this to the 0.43.0 milestone Jul 8, 2024
Copy link
Contributor

@PaulRMellor PaulRMellor left a comment

Choose a reason for hiding this comment

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

Thanks Marko. I left a few suggestions, including removing repeating callout descriptions that we already describe earlier in particular sections to be a bit more streamline.

documentation/modules/oauth/proc-oauth-kafka-config.adoc Outdated Show resolved Hide resolved
- secretName: oauth-server-cert
pattern: "*.crt"
----
<1> Authentication type set to `oauth`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can drop 1, 2 and 4 callouts as we described the properties in the previous example.

documentation/modules/oauth/proc-oauth-kafka-config.adoc Outdated Show resolved Hide resolved
documentation/modules/oauth/proc-oauth-kafka-config.adoc Outdated Show resolved Hide resolved
type: oauth # <1>
accessTokenLocation: /var/run/secrets/kubernetes.io/serviceaccount/token # <2>
----
<1> Authentication type set to `oauth`.
Copy link
Contributor

Choose a reason for hiding this comment

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

we can remove callout 1.

Copy link
Contributor Author

@mstruk mstruk left a comment

Choose a reason for hiding this comment

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

Made additional changes suggested in the review

maxSecondsWithoutReauthentication: 3600 # <8>
customClaimCheck: "@.['kubernetes.io'] && @.['kubernetes.io'].['namespace'] in ['example']" # <9>
----
<1> Listener type set to `oauth`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 192 to 193
<7> Certificates stored in X.509 format within the specified secrets for TLS connection to the authorization server.
<8> Activates the Kafka re-authentication mechanism that enforces session expiry to the same length of time as the access token. If the specified value is less than the time left for the access token to expire, then the client will have to re-authenticate before the actual token expiry. By default, the session does not expire when the access token expires, and the client does not attempt re-authentication.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

mstruk and others added 14 commits July 17, 2024 10:30
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>
Co-authored-by: PaulRMellor <47596553+PaulRMellor@users.noreply.github.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Co-authored-by: PaulRMellor <47596553+PaulRMellor@users.noreply.github.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>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
@mstruk mstruk marked this pull request as ready for review July 17, 2024 11:15
@mstruk mstruk requested a review from PaulRMellor July 17, 2024 11:15
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Copy link
Contributor

@PaulRMellor PaulRMellor left a comment

Choose a reason for hiding this comment

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

Thanks Marko. Just a couple of suggestions

Co-authored-by: PaulRMellor <47596553+PaulRMellor@users.noreply.github.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Comment on lines 181 to 183
tlsTrustedCertificates:
- secretName: oauth-server-cert
pattern: "*.crt"
Copy link
Member

Choose a reason for hiding this comment

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

Where do I get this Secret? I guess it should be using /var/run/secrets/kubernetes.io/serviceaccount/ca.crt? But it is not present in any Secret by default :-/. It might be in the ConfigMap, but not sure if it applies to all environments .

Comment on lines 196 to 202
Note that the `tlsTrustedCertificates` is configured to point to a manually created Secret that contains the Kubernetes API server public certificate, which is mounted to the running pods under `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`.
The Secret can be created using the following command:
[source,shell,subs=attributes+]
----
kubectl get cm kube-root-ca.crt -o jsonpath="{['data']['ca\.crt']}" > /tmp/ca.crt
kubectl create secret generic oauth-server-cert --from-file=ca.crt=/tmp/ca.crt
----
Copy link
Member

Choose a reason for hiding this comment

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

Ok, you describe it here -> that should be in a callout of the example above.

We also might need to address it in some better way. Can't we configure the path to the CA directly? If not, we might need add support for loading the public keys from a CM as requested in #10308. (not necessarily blocker for this PR)

I opened #10354 to track this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Within current CRD functionality I didn't find a way to specify this as a path to the file on the disk - basically a passthrough String rather than a Secret, with the expectation that the file is provided to the container by the infrastructure or another operator.

Copy link
Contributor Author

@mstruk mstruk Jul 25, 2024

Choose a reason for hiding this comment

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

@scholzj I don't think you can add a code block to the content of the callout. Best I can do is refer to the further section that explains it in more detail.

Copy link
Member

Choose a reason for hiding this comment

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

Have you tried something like this? That should work:

<6> Trusted certificates to connect to authorization server. This should point to a manually created Secret that contains the Kubernetes API server public certificate, which is mounted to the running pods under `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`. You can use the following commend to create the Secret:
+
[source,shell,subs=attributes+]
----
kubectl get cm kube-root-ca.crt -o jsonpath="{['data']['ca\.crt']}" > /tmp/ca.crt
kubectl create secret generic oauth-server-cert --from-file=ca.crt=/tmp/ca.crt
----

Copy link
Member

Choose a reason for hiding this comment

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

Screenshot 2024-07-25 at 15 01 30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I modified it as you suggested. Looks like the plus does the trick.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks.

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 26, 2024

Thanks @mstruk

@scholzj scholzj merged commit fd0ad18 into strimzi:main Jul 26, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 0.43.0
Development

Successfully merging this pull request may close these issues.

3 participants