Skip to content

Commit 018986d

Browse files
Merge pull request #74623 from xenolinux/hcp-oauth
OCPBUGS#30087: Hosted control planes: OAuth configuration
2 parents c2c25e6 + 9b1dbd7 commit 018986d

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,6 +2312,8 @@ Topics:
23122312
File: index
23132313
- Name: Getting started with hosted control planes
23142314
File: hcp-getting-started
2315+
- Name: Authentication and authorization for hosted control planes
2316+
File: hcp-authentication-authorization
23152317
- Name: Managing hosted control planes
23162318
File: hcp-managing
23172319
- Name: Using feature gates in a hosted cluster
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="hcp-authentication-authorization"]
3+
= Authentication and authorization for hosted control planes
4+
include::_attributes/common-attributes.adoc[]
5+
:context: hcp-authentication-authorization
6+
7+
toc::[]
8+
9+
The {product-title} control plane includes a built-in OAuth server. You can obtain OAuth access tokens to authenticate to the {product-title} API. After you create your hosted cluster, you can configure OAuth by specifying an identity provider.
10+
11+
include::modules/hcp-configuring-oauth.adoc[leveloffset=+1]
12+
13+
[role="_additional-resources"]
14+
.Additional resources
15+
16+
* To know more about supported identity providers, see xref:../authentication/understanding-identity-provider.adoc#understanding-identity-provider["Understanding identity provider configuration"] in _Authentication and authorization_.

modules/hcp-configuring-oauth.adoc

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * hosted_control_planes/hcp-authentication-authorization.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="hcp-configuring-oauth_{context}"]
7+
= Configuring the internal OAuth server for a hosted cluster
8+
9+
You can configure the internal OAuth server for your hosted cluster by using an OpenID Connect identity provider. Adding any identity provider in the OAuth configuration removes the default `kubeadmin` user provider.
10+
11+
.Prerequisites
12+
13+
* You created your hosted cluster.
14+
15+
.Procedure
16+
17+
. Edit the `HostedCluster` custom resource (CR) on the hosting cluster by running the following command:
18+
+
19+
[source,terminal]
20+
----
21+
$ oc edit <hosted_cluster_name> -n <hosted_cluster_namespace>
22+
----
23+
24+
. Add the OAuth configuration in the `HostedCluster` CR by using the following example:
25+
+
26+
[source,yaml]
27+
----
28+
apiVersion: hypershift.openshift.io/v1alpha1
29+
kind: HostedCluster
30+
metadata:
31+
name: <hosted_cluster_name> <1>
32+
namespace: <hosted_cluster_namespace> <2>
33+
spec:
34+
configuration:
35+
oauth:
36+
identityProviders:
37+
- openID: <3>
38+
claims:
39+
email: <4>
40+
- <email_address>
41+
name: <5>
42+
- <display_name>
43+
preferredUsername:
44+
- <preferred_username> <6>
45+
clientID: <client_id> <7>
46+
clientSecret:
47+
name: <client_id_secret_name> <8>
48+
issuer: https://example.com/identity <9>
49+
mappingMethod: lookup <10>
50+
name: IAM
51+
type: OpenID
52+
----
53+
<1> Specifies your hosted cluster name.
54+
<2> Specifies your hosted cluster namespace.
55+
<3> This provider name is prefixed to the value of the identity claim to form an identity name. The provider name is also used to build the redirect URL.
56+
<4> Defines a list of attributes to use as the email address.
57+
<5> Defines a list of attributes to use as a display name.
58+
<6> Defines a list of attributes to use as a preferred user name.
59+
<7> Defines the ID of a client registered with the OpenID provider. You must allow the client to redirect to the `\https://oauth-openshift.apps.<cluster_name>.<cluster_domain>/oauth2callback/<idp_provider_name>` URL.
60+
<8> Defines a secret of a client registered with the OpenID provider.
61+
<9> The link:https://openid.net/specs/openid-connect-core-1_0.html#IssuerIdentifier[Issuer Identifier] described in the OpenID spec. You must use `https` without query or fragment component.
62+
<10> Defines a mapping method that controls how mappings are established between identities of this provider and `User` objects.
63+
64+
. Save the file to apply the changes.

0 commit comments

Comments
 (0)