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

Don't prompt before switching over to service account on Sandbox #3908

Merged
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
11 changes: 6 additions & 5 deletions src/openshift/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,7 @@ export class Cluster extends OpenShiftItem {
try {
await Oc.Instance.loginWithToken(clusterURL, ocToken);
if (Cluster.isOpenShiftSandbox(clusterURL)) {
const YES = 'Yes';
const result = await window.showInformationMessage('OpenShift Sandbox logs you out after 15 minutes. Would you like to switch to a service account to prevent this?', YES, 'No');
if (result === YES) {
await Cluster.installPipelineUserContext();
}
await Cluster.installPipelineUserContext();
}
return Cluster.loginMessage(clusterURL);
} catch (error) {
Expand Down Expand Up @@ -913,6 +909,11 @@ export class Cluster extends OpenShiftItem {
const sandboxUser = currentCtxObj.context.user;
const sandboxUserObj = kcActual.users.find(user => user.name === sandboxUser);

const serviceAccounts = await Oc.Instance.getKubernetesObjects('ServiceAccount');
const pipelineServiceAccount = serviceAccounts.find(serviceAccount => serviceAccount.metadata.name === 'pipeline');
if (!pipelineServiceAccount) {
return;
}
const secrets = await Oc.Instance.getKubernetesObjects('Secret');
const pipelineTokenSecret = secrets.find((secret) => secret.metadata.name.startsWith('pipeline-token')) as any;
const pipelineToken = Buffer.from(pipelineTokenSecret.data.token, 'base64').toString();
Expand Down
Loading