metalbear-co / mirrord

Connect your local process and your cloud environment, and run local code in cloud conditions.
https://mirrord.dev
MIT License
3.75k stars 101 forks source link

Extend operator headers #2550

Closed Razz4780 closed 2 months ago

Razz4780 commented 3 months ago

Closes #2466

CLI version and user name/hostname headers are sent with all operator requests. Client certificate header:

  1. mirrord operator status: we don't know operator license fingerprint before getting the resource, so header is not sent.
  2. mirrord exec: as soon as we get the operator resource, we prepare the client cert header. If we fail, command aborts.
  3. mirrord ls / mirrord operator session: as soon as we get the operator resource, we try to prepare the client cert header. If we fail, we continue without it

I kind of went full aggro on the operator client code and made more changes than necessary :V

  1. Copied to mirrord ls the extra discovery step present in mirrord exec (https://github.com/metalbear-co/mirrord/issues/2487)
  2. Moved some parts of operator client code to new separate submodules (errors, http upgrade request logic, connection wrapper, operator discovery)
  3. Unified format of progress messages
aviramha commented 3 months ago

We don't want a license to be needed for the non actual usage APIs. It should be fallible and optional.

Razz4780 commented 3 months ago

We don't want a license to be needed for the non actual usage APIs. It should be fallible and optional.

Do you mean operator license or user license?

aviramha commented 3 months ago

We don't want a license to be needed for the non actual usage APIs. It should be fallible and optional.

Do you mean operator license or user license?

I meant user license but we shouldn't check the operator license for getting it's status anyway

Razz4780 commented 3 months ago

We don't want a license to be needed for the non actual usage APIs. It should be fallible and optional.

Do you mean operator license or user license?

I meant user license but we shouldn't check the operator license for getting it's status anyway

So, summarizing:

  1. operator status -> no check at all, plain GET with version/name/hostname headers
  2. target connection -> operator license validity check, user license required
  3. session management or listing targets -> no operator license validity check, fallible and optional user license

Correct?

aviramha commented 3 months ago

I'd add the user license to the status too, just make it optional.