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 --manager, --service, and --namespace flags #282

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

clcollins
Copy link
Member

@clcollins clcollins commented May 16, 2024

Add management/service/hive & namespace login flags

  • Adds --manager and --service flags to allow logging into MC/Hive and SC clusters for a provided --cluster-id.
  • Adds --namespace flag to override the default NS on whatever cluster is being logged into
  • Removes login logic from ~/.bashrc.d/* files inside the container, moving the responsibility of login to ocm-container's binary
  • Adds related and other helpful ENV vars inside the container

Example ENVs logging into a classic cluster (or it's hive):

CLUSTER_NAME=
HIVE_NAME=
HIVE_NS=
CLUSTER_UID=
CLUSTER_ID=
CLUSTER_UUID=

And example for HPC:

CLUSTER_NAME=
CLUSTER_UID=
SC_ID=
HCP_NS=
CLUSTER_ID=
HC_NS=
MC_ID=
KUBELET_NS=
CLUSTER_UUID=

And extra vars that might be helpful, for any cluster:

CLUSTER_STS=
CLUSTER_PRIVATE_LINK=
CLUSTER_CCS=
CLUSTER_CLOUD_PROVIDER=

Fixes #271
Fixes #270

WIP - TODO:

  • Add a log message immediately before spawning login execs so users will have positive feedback on why they're waiting. This used to be incidental as a result of the different bash scripts, making it feel like login wasn't just hanging, but even though it's the same length if ocm-container executes the login, because there's no feedback it feels like ocm-container has hung.
  • Figure out how to perform the login to ocm and backplane in order, but async from the container attachment, to speed up the login.
  • Do the plumbing to pick the right cluster if --manager, --service or --namespace are provided.

Signed-off-by: Chris Collins [email protected]

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 16, 2024
Copy link
Contributor

openshift-ci bot commented May 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clcollins

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 16, 2024
@openshift-merge-robot openshift-merge-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 30, 2024
@rendhalver
Copy link
Contributor

I have been thinking about this one.
I think replicating the flags ocm backplane login uses is a good idea so we can just pass them to backplane.
Adding extra flags seems like something we should do in backplane so we aren't doing things differently and we can share idea across the teams.
Other thoughts: does backplane have anything we can use to work out which flags are mutually exclusive so we don't need to keep our own copy of those?

The new --ohss and existing --pd flags would also be good to replicate.
https://source.redhat.com/groups/public/sre/wiki/setup_backplane_cli#isPasted4

Kirk's changes in #295 will also help with the OCM logins.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 22, 2024
Adds flags for management- and service-cluster bools, and marks the two
mutually exclusive.  If either are provided, then --cluster-id is
required as well.

This is setting groundwork for HCP MC and SC support.

Signed-off-by: Chris Collins <[email protected]>
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 27, 2024
* Adds `--manager` and `--service` flags to allow logging into MC/Hive and SC clusters for a provided `--cluster-id`.
* Adds related and other helpful ENV vars inside the container
* Adds `--namespace` flag to override the default NS on whatever cluster is being logged into
* Removes login logic from ~/.bashrc.d/* files inside the container, moving the responsibility of login to ocm-container's binary

WIP - TODO:

* Add a log message immediately before spawning login execs so users will have positive feedback on why they're waiting.  This used to be incidental as a result of the different bash scripts, making it feel like login wasn't just hanging, but even though it's the same length if ocm-container executes the login, because there's no feedback it feels like ocm-container has hung.
* Figure out how to perform the login to ocm and backplane in order, but async from the container attachment, to speed up the login.
* Do the plumbing to pick the right cluster if `--manager`, `--service` or `--namespace` are provided.

Signed-off-by: Chris Collins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add additional env vars to login Add an option to log directly into a manager or service cluster
3 participants