jina-ai/jcloud

add jc create secret [secret-name] -f --from-file=[] --from-literal=[]

tarrantro opened this issue · 5 comments

Is your feature request related to a problem? Please describe.
https://github.com/jina-ai/jina-operator/issues/561

Describe the solution you'd like
Have jc create/update secret [secret-name] -f <flow-id> --from-file=[] --from-literal=[] in cli to call secret api endpoints

Describe alternatives you've considered
N/A

Additional context

this cli will call secret cli to create secret first, and then update the flow spec with https://github.com/jina-ai/jina-operator/issues/564

we should support --from-literal=[] only for now. The logic will be:

jc create secret [secret-name] -f <flow-id> --executor <executor-name> --from-literal=[]. This will call the /secrets API to create secrets. After get 201, the cli will call /:id to update the flow with below template:

-f only (global):

spec:
  jtype: Flow
  with:
    env_from_secret:
      TEST:
        name: test-secret
        key: test

--executor (executor specified, include gateway):

spec:
  jtype: Flow
  ...
  executors:
  - name: sentencizer
    uses: jinahub+docker://Sentencizer
    env_from_secret:
      TEST:
        name: test-secret
        key: test

jc update secret [secret-name] -f <flow-id> --from-literal=[]

call /secrets/:id/:name to update the secret with required data. This cli doesn't have executor args. After update finish, restart flow.

jc get secret [secret-name] -f <flow-id>

get secret from /secrets/:id/:name

jc list secret -f <flow-id>

list secret from /secrets/:id