Configuring the OAuth server for a hosted cluster by using the CLI
You can configure the internal OAuth server for your hosted cluster by using the command-line interface (CLI).
You can configure OAuth for the following supported identity providers:
-
oidc -
htpasswd -
keystone -
ldap -
basic-authentication -
request-header -
github -
gitlab -
google
Adding any identity provider in the OAuth configuration removes the default kubeadmin user provider.
|
|
When you configure identity providers, you must configure at least one |
-
You created your hosted cluster.
-
Edit the
HostedClustercustom resource (CR) on the management cluster by running the following command:$ oc edit hostedcluster <hosted_cluster_name> -n <hosted_cluster_namespace> -
Add the OAuth configuration in the
HostedClusterCR by using the following example:apiVersion: hypershift.openshift.io/v1alpha1 kind: HostedCluster metadata: name: <hosted_cluster_name> namespace: <hosted_cluster_namespace> spec: configuration: oauth: identityProviders: - openID: claims: email: - <email_address> name: - <display_name> preferredUsername: - <preferred_username> clientID: <client_id> clientSecret: name: <client_id_secret_name> issuer: https://example.com/identity mappingMethod: lookup name: IAM type: OpenID-
metadata.namespecifies your hosted cluster name. -
metadata.namespacespecifies your hosted cluster namespace. -
spec.configuration.oauth.identityProviders.openIDis a provider name that 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. -
spec.configuration.oauth.identityProviders.openID.claims.emaildefines a list of attributes to use as the email address. -
spec.configuration.oauth.identityProviders.openID.claims.namedefines a list of attributes to use as a display name. -
spec.configuration.oauth.identityProviders.openID.claims.preferredUsernamedefines a list of attributes to use as a preferred user name. -
spec.configuration.oauth.identityProviders.openID.clientIDdefines the ID of a client registered with the OpenID provider. You must allow the client to redirect to thehttps://oauth-openshift.apps.<cluster_name>.<cluster_domain>/oauth2callback/<idp_provider_name>URL. -
spec.configuration.oauth.identityProviders.openID.clientSecret.namedefines a secret of a client registered with the OpenID provider. -
spec.configuration.oauth.identityProviders.openID.issuerspecifies the Issuer Identifier described in the OpenID spec. You must usehttpswithout query or fragment component. For more information about Issuer Identifiers, see "Issuer Identifier". -
spec.configuration.oauth.identityProviders.mappingMethoddefines a mapping method that controls how mappings are established between identities of this provider andUserobjects.
-
-
Save the file to apply the changes.