Skip to content

Commit 9da62c2

Browse files
dgolovinvrothbergbenoitf
authored
Subscription activation and registry service account configuration using available REST APIs (#35)
The initial implementation for Red Hat subscription activation and container image registry access configuration. Signed-off-by: Denis Golovin <[email protected]> Co-authored-by: Valentin Rothberg <[email protected]> Co-authored-by: Florent BENOIT <[email protected]>
1 parent f828ee4 commit 9da62c2

15 files changed

+869
-487
lines changed

Containerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
FROM scratch
1919

2020
LABEL org.opencontainers.image.title="Red Hat Account" \
21-
org.opencontainers.image.description="Allows the ability in Podman Desktop to login to Red Hat SSO" \
22-
org.opencontainers.image.vendor="Red Hat" \
23-
io.podman-desktop.api.version=">= 0.14.1"
21+
org.opencontainers.image.description="Allows the ability in Podman Desktop to login to Red Hat SSO" \
22+
org.opencontainers.image.vendor="Red Hat" \
23+
io.podman-desktop.api.version=">= 1.7.0"
2424

2525
COPY package.json /extension/
2626
COPY LICENSE /extension/

README.md

+35-21
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,53 @@
1+
# Podman Desktop Red Hat SSO Extension
12

2-
# Red Hat Account extension
3+
An extension for Podman Desktop to simplify logging into and creating a Red Hat account. The extension opens sso.redhat.com in the browser to retrieve an SSO token upon successful login. The SSO token is then used to log into the [registry.redhat.io](https://catalog.redhat.com/) Container Registry and to register the Linux virtual machine powering Podman Desktop via subscription-manager to grant the containers access to protected Red Hat content such as RHEL repositories.
34

4-
This extension plugs into Podman Desktop an authentication provider that allows login to Red Hat SSO
5+
# Installation
56

6-
# Run and build
7+
The extension is currently available in an Alpha version but ready to test. Extension for Podman Desktop are shipped as OCI container images. Please refer to the [Podman Desktop documentation](https://podman-desktop.io/docs/extensions/install) for installation instructions and to [Quay.io](https://quay.io/repository/redhat-developer/podman-desktop-redhat-account-ext?tab=tags) for available tags.
78

9+
The first available Alpha image is `quay.io/redhat-developer/podman-desktop-redhat-account-ext:0.0.1-alpha.1`.
810

11+
Starting with Podman 5.0, subscription-manager will be shipped by default. For prior versions, the extension will take care of installing subscription-manager which may take a short while and requires a reboot.
912

10-
To rebuild podman-desktop and OpenShift Local extension run:
13+
# Usage
1114

12-
```shell
13-
yarn build
14-
```
15+
Once installed, you can find the extension in the Settings menu which you can find in the bottom left corner of Podman Desktop:
16+
![image](https://raw.githubusercontent.com/redhat-developer/podman-desktop-redhat-account-ext/v0.0.2-alpha.1/screenshots/settings.png)
1517

16-
To execute this extension into Podman Desktop, uses one of these commands:
18+
To sign into your Red Hat account, open the Authentication menu and click on the drop-down button:
19+
![image](https://raw.githubusercontent.com/redhat-developer/podman-desktop-redhat-account-ext/v0.0.2-alpha.1/screenshots/authentication-menu.png)
1720

18-
```shell
19-
podman-desktop --extension-folder this_folder
20-
```
21-
22-
if using the released bits from Podman Desktop
21+
To sign into your Red Had account, Podman Desktop will open Red Hat SSO in your browser of choice. The SSO form will make sure that each user has accepted the terms and conditions, and has a valid Red Hat [developers subscription](https://developers.redhat.com/about?source=sso). If needed, you may also create a new Red Hat account and further use social login via an existing Google, Microsoft or GitHub account:
22+
![image](https://raw.githubusercontent.com/redhat-developer/podman-desktop-redhat-account-ext/v0.0.2-alpha.1/screenshots/sso.png)
2323

24-
or
24+
Once signed in, there is nothing further to be done. Podman Desktop will automatically use the SSO token to log into the Red Hat container registry and to register the Linux virtual machine (i.e., podman machine) via subscription-manager. The two tasks are listed in the Tasks menu which you can open on the bottom right of Podman Desktop:
25+
![image](https://raw.githubusercontent.com/redhat-developer/podman-desktop-redhat-account-ext/v0.0.2-alpha.1/screenshots/tasks.png)
2526

26-
```shell
27-
yarn watch --extension-folder this_folder
28-
```
27+
To verify that the sign-in process was successful, you may build the following Dockerfile:
28+
```Dockerfile
29+
FROM registry.redhat.io/rhel9/toolbox
30+
RUN dnf install -y kernel
31+
````
2932

30-
from the Podman Desktop source folder if using the develpment version from Podman Desktop
33+
Pulling the container image `registry.redhat.io/rhel9/toolbox` requires having logged into the Red Hat container registry. Installing the `kernel` package requires access to protected content.
3134

32-
# Nightly build installation
35+
# Local Development
3336

34-
use `ghcr.io/redhat-developer/podman-desktop-redhat-account-ext:latest` on Settings/Extension page using 'Install a new extension from OCI Image' form (see screenshot below).
37+
To rebuild Podman Desktop and the extension run:
3538

39+
```shell
40+
yarn build
41+
```
3642

43+
To execute the extension in Podman Desktop, use one of the following to options.
3744

38-
![image](https://user-images.githubusercontent.com/620330/232674528-9d07e38d-618c-4d69-a01a-309033b7b3f0.png)
45+
With a pre-installed version of Podman Desktop:
46+
```shell
47+
podman-desktop --extension-folder this_folder
48+
```
3949

50+
In a local git tree of Podman Desktop:
51+
```shell
52+
yarn watch --extension-folder this_folder
53+
```
Loading

package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "redhat-authentication",
33
"displayName": "Red Hat Authentication",
44
"description": "Login to Red Hat Developers",
5-
"version": "0.0.1",
5+
"version": "0.0.2-next",
66
"icon": "icon.png",
77
"publisher": "redhat",
88
"license": "Apache-2.0",
@@ -13,8 +13,8 @@
1313
"contributes": {
1414
"commands": [
1515
{
16-
"command": "redhat.auth.login",
17-
"title": "Red Hat Authentication: login"
16+
"command": "redhat.authentication.signin",
17+
"title": "Red Hat SSO Provider: Sign In"
1818
}
1919
]
2020
},
@@ -25,7 +25,10 @@
2525
},
2626
"dependencies": {
2727
"@podman-desktop/api": "^1.6.4",
28+
"@redhat-developer/rhcra-client": "^0.0.1",
29+
"@redhat-developer/rhsm-client": "^0.0.4 ",
2830
"@types/node": "^18.15.11",
31+
"axios": "^1.6.5",
2932
"js-yaml": "^4.1.0",
3033
"openid-client": "5.4.0"
3134
},
@@ -41,8 +44,8 @@
4144
"rollup": "^3.20.4",
4245
"tslib": "^2.5.0",
4346
"typescript": "^5.0.4",
44-
"vite": "^5.0.11",
45-
"vitest": "^1.1.1",
47+
"vite": "^5.0.12",
48+
"vitest": "^1.2.0",
4649
"zip-local": "^0.3.5"
4750
}
4851
}

screenshots/authentication-menu.png

129 KB
Loading

screenshots/settings.png

32.7 KB
Loading

screenshots/sso.png

131 KB
Loading

screenshots/tasks.png

145 KB
Loading

src/configuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const REDHAT_AUTH_URL = process.env.REDHAT_SSO_URL
3636
? process.env.REDHAT_SSO_URL
3737
: 'https://sso.redhat.com/auth/realms/redhat-external/';
3838
const KAS_API_URL = process.env.KAS_API_URL ? process.env.KAS_API_URL : 'https://api.openshift.com';
39-
const CLIENT_ID = process.env.CLIENT_ID ? process.env.CLIENT_ID : 'vscode-redhat-account';
39+
const CLIENT_ID = process.env.CLIENT_ID ? process.env.CLIENT_ID : 'podman-desktop';
4040

4141
console.log('REDHAT_AUTH_URL: ' + REDHAT_AUTH_URL);
4242
console.log('KAS_API_URL: ' + KAS_API_URL);

0 commit comments

Comments
 (0)