jupyter-naas / naas

Low-code Python library to safely use notebooks in production: schedule workflows, generate assets, trigger webhooks, send notifications, build pipelines, manage secrets (Cloud-only)
https://app.naas.ai/
GNU Affero General Public License v3.0
282 stars 25 forks source link

Update naas.secret with new method #437

Closed FlorentLvr closed 5 months ago

Dr0p42 commented 6 months ago

We need to make use of the new naas-python.secret SDK. The way we handle secrets should be as follow now:

As a user when I want to get a secret value:

- if the secret exists on api.naas.ai AND exists locally, then I remove the local version.
- If the secret exists on api.naas.ai I use that value.
- If the secret does not exists on api.naas.ai
 - If the secret exists locally
  - I take the local secret and create it on api.naas.ai.
  - I delete the local version of the secret.

As a user when I list secrets:

- First I sync local with api.naas.ai.
 - If the secret exists locally AND in api.naas.ai, I remove the local version of the secret.
 - If the secret exists locally and does not exists in api.naas.ai, I create it in api.naas.ai and I delete the local version.
- Then, I list the secrets existing in api.naas.ai only.

As a user when I want to create a secret:

- I create it on api.naas.ai.
- If the same secret name exists locally, I remove it.

As a user when I want to delete a secret:

- I remove it from api.naas.ai
- I remove it locally

Doing so, secrets should move from local to api smoothly.

This should allow us to do a drop in replacement of the way we store secret.

FlorentLvr commented 6 months ago

@Dr0p42, sounds great!

Dr0p42 commented 6 months ago

This issue needs https://github.com/jupyter-naas/naas-python/issues/33 to be completed first

Dr0p42 commented 6 months ago

This issue is also blocked by this one: https://github.com/jupyter-naas/naas-python/issues/32

Dr0p42 commented 5 months ago

Addition @l-loic , can you add some logic to:

This will ensure that we have a backup just in case.