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

Simplify setup and pull secret flow with Red Hat SSO extension #200

Closed
2 tasks done
slemeur opened this issue Feb 21, 2024 · 3 comments
Closed
2 tasks done

Simplify setup and pull secret flow with Red Hat SSO extension #200

slemeur opened this issue Feb 21, 2024 · 3 comments
Assignees
Milestone

Comments

@slemeur
Copy link

slemeur commented Feb 21, 2024

Goals

Thanks to the work done on the Red Hat SSO extension, we now would like to automate the process of getting the pull secret to start openshift local.

Sub-tasks

@gbraad
Copy link
Contributor

gbraad commented Feb 26, 2024

@dgolovin @jeffmaury

@dgolovin
Copy link
Contributor

dgolovin commented Feb 27, 2024

@jeffmaury I published @redhat-developer/rhaccm-client simplify it. The implementation for this feature should:

  1. Add dependency Red Hat SSO extension
  2. Ask for Red Hat SSO session through authentication API when configuring OpenShift Local Instance
const authSession: extensionApi.AuthenticationSession | undefined> = await extensionApi.authentication.getSession(
    'redhat.authentication-provider',
    ['api.iam.registry_service_accounts', //scope that gives access to hydra service accounts API
    'api.console', // scope that gives access to console.redhat.com APIs
    'id.username'], // adds claim to accessToken that used to render account label
    {createIfNone: true} // will request to login in browser if session does not exists
  );
  1. get access_token from the session when created
  2. call @redhat-developer/rhaccm-client to get pull_secret json string
import { AccountManagementClient } from '@redhat-developer/rhaccm-client';
const client = new AccountManagementClient({
  BASE: 'https://api.openshift.com/api/accounts_mgmt/v1',
  TOKEN: authSession.access_token,
});
const accessTokenCfg = await client.default.postApiAccountsMgmtV1AccessToken();
const pull_secret:string = JSON.stringify(accessTokenCfg);

@slemeur slemeur added this to the 1.4.0 milestone Mar 12, 2024
@dgolovin
Copy link
Contributor

Implemented and merged to main.

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

No branches or pull requests

4 participants