Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions _includes/provider-ocp-mgt-token.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
Run the following to obtain the token needed to add a Red Hat OpenShift provider:

1. Obtain the `management` service account token name:
1. Create the service account token
```bash
oc apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: $service_account_name-secret
namespace: $project_name
annotations:
kubernetes.io/service-account.name: $service_account_name
type: kubernetes.io/service-account-token
EOF
```
2. Describe the secret to retrieve the full token value:

# oc describe sa -n $project_name $service_account_name
Copy link
Member Author

@agrare agrare Sep 9, 2025

Choose a reason for hiding this comment

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

NOTE I dropped the leading # from here because the examples that this is included into do not have that (e.g. oc policy add-role-to-user -n $project_name admin -z $service_account_name) and it also made bash markdown think this was a comment

...
Tokens: management-admin-token-0f3fh
management-admin-token-q7a87

2. Select and describe one of the tokens to retrieve the full token
output, replacing `management-admin-token-0f3fh` with the name of
your token:

# oc describe secret -n $project_name management-admin-token-0f3fh
...
Data
====
token: eyJhbGciOiJSUzI1NiI...
```bash
oc get secret -o template --template {{.data.token}} -n $project_name $service_account_name-secret
eyJhbGciOiJSUzI1N...
```