Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Expand the REST API #1412

Open
mssola opened this issue Sep 7, 2017 · 11 comments
Open

Expand the REST API #1412

mssola opened this issue Sep 7, 2017 · 11 comments

Comments

@mssola
Copy link
Collaborator

mssola commented Sep 7, 2017

  • Documentation and implementation of a final v1 of the API.
  • Should we have different scopes for the API ? (e.g. so not only admin users could access the API).
@mssola
Copy link
Collaborator Author

mssola commented Sep 7, 2017

Related issues: #1112, #763.
Related PRs: #1403.

mssola added a commit to mssola/Portus that referenced this issue Feb 14, 2018
This new endpoint lives inside of the user namespace and its main goal is to
allow people to create the first admin user from the API. This endpoint is only
allowed if the `first_user_admin` option has not been disabled. Another
restriction is that there shouldn't be a user already created. Last but not
least, this method can be called without being authenticated.

In the ideal case, you would call this method when you just started your Portus
instance. Then, you will get the first user created
(same arguments as `POST /api/v1/users`) and it will also get an application
token assigned to it. The reponse will be the `plain_token` from the application
token. Thus, the whole point of this method is to follow this workflow:

1. Portus instance deployed.
2. Admin uses this bootstrap endpoint to create the admin user and get an
   application token.
3. With this application token the admin starts to administrate the
   instance (e.g. register the registry on Portus) entirely from the API.
4. Admin makes the Portus instance available inside of the organization and
   starts structuring it inside of Portus.

Finally, this commit also started to make error responses more uniform. This was
firstly done to DRY some of the code created by this feature. It probably needs
more work (see SUSE#1437).

See SUSE#1412

Signed-off-by: Miquel Sabaté Solà <[email protected]>
mssola added a commit to mssola/Portus that referenced this issue Feb 14, 2018
This new endpoint lives inside of the user namespace and its main goal is to
allow people to create the first admin user from the API. This endpoint is only
allowed if the `first_user_admin` option has not been disabled. Another
restriction is that there shouldn't be a user already created. Last but not
least, this method can be called without being authenticated.

In the ideal case, you would call this method when you just started your Portus
instance. Then, you will get the first user created
(same arguments as `POST /api/v1/users`) and it will also get an application
token assigned to it. The reponse will be the `plain_token` from the application
token. Thus, the whole point of this method is to follow this workflow:

1. Portus instance deployed.
2. Admin uses this bootstrap endpoint to create the admin user and get an
   application token.
3. With this application token the admin starts to administrate the
   instance (e.g. register the registry on Portus) entirely from the API.
4. Admin makes the Portus instance available inside of the organization and
   starts structuring it inside of Portus.

Finally, this commit also started to make error responses more uniform. This was
firstly done to DRY some of the code created by this feature. It probably needs
more work (see SUSE#1437).

See SUSE#1412

Signed-off-by: Miquel Sabaté Solà <[email protected]>
@mogul
Copy link

mogul commented Mar 10, 2018

I know Portus syncs with the registry, but is there any way to sync another with portus? Say we wanted to know when an image got scanned and if vulns were found, mail someone... How can we do that without polling the whole catalog?

@mssola
Copy link
Collaborator Author

mssola commented Mar 12, 2018

I know Portus syncs with the registry, but is there any way to sync another with portus? Say we wanted to know when an image got scanned and if vulns were found, mail someone... How can we do that without polling the whole catalog?

I'm not sure I understood your question 😅 Please, correct me if I'm wrong.

Right now Portus supports only one registry (see #821). So, if you are asking whether portus supports some kind of coordination between registries, then I'd say that it's not supported. If you are asking for some sort of coordination between multiple Portus registries, then I'd say we don't support that either.

So I guess my question would be: what's your use case exactly ? What kind of workflow would work for you ? I'd say you can give these details into a new issue, because these questions are a bit out of the scope of this issue 😉

@Vad1mo
Copy link
Contributor

Vad1mo commented Mar 12, 2018

I know Portus syncs with the registry, but is there any way to sync another with portus? Say we wanted to know when an image got scanned and if vulns were found, mail someone... How can we do that without polling the whole catalog?

As understand it more correctly @mogul is referring to the webhooks functionality. Specifically triggering events on found vulns.

@mogul
Copy link

mogul commented Mar 13, 2018

As understand it more correctly @mogul is referring to the webhooks functionality. Specifically triggering events on found vulns.

Yes, that's exactly what I'm thinking of. Still out of scope and needing another issue?

@mssola
Copy link
Collaborator Author

mssola commented Mar 13, 2018

@mogul just opened #1726 for that. Thanks @Vad1mo for clarifying !

mssola added a commit to mssola/Portus that referenced this issue Mar 14, 2018
This new endpoint lives inside of the user namespace and its main goal is to
allow people to create the first admin user from the API. This endpoint is only
allowed if the `first_user_admin` option has not been disabled. Another
restriction is that there shouldn't be a user already created. Last but not
least, this method can be called without being authenticated.

In the ideal case, you would call this method when you just started your Portus
instance. Then, you will get the first user created
(same arguments as `POST /api/v1/users`) and it will also get an application
token assigned to it. The reponse will be the `plain_token` from the application
token. Thus, the whole point of this method is to follow this workflow:

1. Portus instance deployed.
2. Admin uses this bootstrap endpoint to create the admin user and get an
   application token.
3. With this application token the admin starts to administrate the
   instance (e.g. register the registry on Portus) entirely from the API.
4. Admin makes the Portus instance available inside of the organization and
   starts structuring it inside of Portus.

Finally, this commit also started to make error responses more uniform. This was
firstly done to DRY some of the code created by this feature. It probably needs
more work (see SUSE#1437).

See SUSE#1412

Signed-off-by: Miquel Sabaté Solà <[email protected]>
mssola added a commit to mssola/Portus that referenced this issue Mar 15, 2018
This new endpoint lives inside of the user namespace and its main goal is to
allow people to create the first admin user from the API. This endpoint is only
allowed if the `first_user_admin` option has not been disabled. Another
restriction is that there shouldn't be a user already created. Last but not
least, this method can be called without being authenticated.

In the ideal case, you would call this method when you just started your Portus
instance. Then, you will get the first user created
(same arguments as `POST /api/v1/users`) and it will also get an application
token assigned to it. The reponse will be the `plain_token` from the application
token. Thus, the whole point of this method is to follow this workflow:

1. Portus instance deployed.
2. Admin uses this bootstrap endpoint to create the admin user and get an
   application token.
3. With this application token the admin starts to administrate the
   instance (e.g. register the registry on Portus) entirely from the API.
4. Admin makes the Portus instance available inside of the organization and
   starts structuring it inside of Portus.

Finally, this commit also started to make error responses more uniform. This was
firstly done to DRY some of the code created by this feature. It probably needs
more work (see SUSE#1437).

See SUSE#1412

Signed-off-by: Miquel Sabaté Solà <[email protected]>
@adnoh
Copy link

adnoh commented Mar 15, 2018

Why not using the Webhooks from Clair? (if you are using it as a scanner). https://coreos.com/clair/docs/latest/notifications.html - with the clair api you could scan the image BEFORE pushing it to the registry which works quite well

@mssola
Copy link
Collaborator Author

mssola commented Mar 15, 2018

@adnoh thanks for the heads up! I'll paste this comment into the other issue to keep everything on the same place.

@adnoh
Copy link

adnoh commented Mar 15, 2018

@mssola You're welcome. I've just went through the whole portus, postgres, clair, registry, kubernetes journey the last week - so I'm looking around if I can help anyone with current issues :) it was quite hard to get all the pieces working.
Everything works fine now except of "Failed to create bus connection: No such file or directory" after every api/v1/health check call - I'll create an issue for that.

@mssola
Copy link
Collaborator Author

mssola commented Mar 16, 2018

@adnoh what do you mean by hard? What was hard for you ? Just asking in case we can improve the documentation or our examples 👍

@mssola mssola modified the milestones: Release 2.4, Release 2.5 Jun 5, 2018
@mssola
Copy link
Collaborator Author

mssola commented Jun 5, 2018

This is an on-going effort. Scheduling for the 2.5 release...

@mssola mssola added the 2.4 label Jun 5, 2018
@mssola mssola removed this from the Release 2.5 milestone Oct 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants