Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional env vars to login #271

Open
iamkirkbater opened this issue Apr 23, 2024 · 2 comments · May be fixed by #282
Open

Add additional env vars to login #271

iamkirkbater opened this issue Apr 23, 2024 · 2 comments · May be fixed by #282

Comments

@iamkirkbater
Copy link
Contributor

When logging into a cluster I'd like some additional environment variables to be available to me, based on what type of cluster it is, and some for both:

ALL:

  • OCM_ENV - should be one of production, staging, integration
  • OCM_REGION - should default to global (this one is for future-proofing, so we can leave this off until we need it)

Classic:

  • HIVE_NS - should be formatted: uhc-$OCM_ENV-$CLUSTER_ID
  • HIVE_NAME - should be the user-readable hive name: hive-stage-01, etc
  • HIVE_ID - should be the Cluster ID of Hive

Hypershift:

  • MC_ID would be set to the Manager Cluster ID
  • SC_ID would be set to the Service Cluster ID
  • HCP_NS would be set to ocm-$OCM_ENVIRONMENT-$CLUSTER_ID-$CLUSTER_NAME
  • HC_NS would be set to ocm-$OCM_ENVIRONMENT-$CLUSTER_ID
  • KUBELET_NS would be set to kubelet-$CLUSTER_ID
@clcollins
Copy link
Member

clcollins commented Apr 23, 2024

+1 to the overall goal here. Extra ENVs are totally useful, and welcome.

This is tricky. I feel very strongly that ocm-container should be usable without installing any other tools on the host, so we'll either need to code up ocm lookups via token into the golang stuff (which I'm not opposed to - some of that exists here, but is not used at all yet: https://github.com/clcollins/ocm-container/blob/golang/pkg/ocm/ocm.go ), or move it into the internal container and process it via bash, which we do a little of, but is really messy and makes startup take longer.

A lot of the ocm stuff is cribbing from osdctl, which is unfortunate. We really should try to get @AlexVulaj's ocm-common package stuff off the ground, if we can. There's too much code duplication here.

Finally, we also want to consider startup time - whatever we do here, we need to be really cognizant about how many calls we make to external services and external latency. One of the big complaints I hear from folks who choose not to adopt ocm-container is the startup time, and they're not wrong.

We should look at the minimum calls we need to make for any given cluster, both internal and external, make sure all required calls to get started are as concurrent as possible, and any subsequent data we need is called as needed (automatically, of course, so at least it feels like what you're going for here).

@rendhalver
Copy link
Contributor

rendhalver commented Apr 30, 2024

ocm backplane login shows a list of namespaces associated with the MC or Hive shard if we login with the --manager flag.
Maybe we can co-ordinate with those lovely folks to set those NSes as env vars (if that doesn't already happen) so everyone can benefit from this.

@clcollins clcollins linked a pull request May 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants