Skip to content

Conversation

@wking
Copy link
Member

@wking wking commented Sep 27, 2018

Builds on #350; review that first.

To make it easier to pass this in when you don't have a shell for:

$ OPENSHIFT_INSTALL_SSH_PUB_KEY="$(cat path/to/key)" openshift-install install-config

For example, this is useful in CI where we can launch the cluster without hitting a shell at all. And it's also a bit more compact for folks who are reading from files anyway.

I've also added a check for "do we only have one choice?". If so, I just pick that value instead of bothering the user when they don't have a decision to make.

And I've reformatted the docs to use a list. Tables are annoying to maintain in ASCII, and lists give us more space to talk about the expected input format, etc.

/assign @crawford

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 27, 2018
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to allow the user to opt out of using a key at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to allow the user to opt out of using a key at all.

I think we do. Some cases:

  • You set OPENSHIFT_INSTALL_SSH_PUB_KEY and exit up here.
  • You set OPENSHIFT_INSTALL_SSH_PUB_KEY_PATH, get that single entry in your pubKeys, and exit here without a prompt.
  • You set no variables, so you get the <none> choice injected. Then...
    • Go finds no valid pubkeys in ~/.ssh/*.pub, and you exit here with the none choice selected.
    • Go finds some valid pubkeys in ~/.ssh/*.pub, and you pass by here and fall down to the interactive prompt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that seems okay then.

By switching to survey.Question which has room for a validator [1].
I've also pushed the Required validator up into the per-property
config, so we don't bake requiredness into UserProvided itself.

[1]: https://godoc.org/github.com/AlecAivazis/survey#Question
Tables are annoying to maintain in ASCII, and lists give us more space
to talk about the expected input format, etc.
To make it easier to pass this in when you don't have a shell for:

  $ OPENSHIFT_INSTALL_SSH_PUB_KEY="$(cat path/to/key)" openshift-install install-config

For example, this is useful in CI where we can launch the cluster
without hitting a shell at all.  And it's also a bit more compact for
folks who are reading from files anyway.

I've also added a check for "do we only have one choice?".  If so, I
just pick that value instead of bothering the user when they don't
have a decision to make.
@wking wking force-pushed the ssh-path-from-env-var branch from 005a175 to c2f93fd Compare September 27, 2018 18:32
@crawford
Copy link
Contributor

@wking If you rebase this, I'll LGTM it.

@wking
Copy link
Member Author

wking commented Sep 27, 2018

@wking If you rebase this, I'll LGTM it.

Does it need a rebase?

@crawford
Copy link
Contributor

I just want to be sure that this has the changes that I requested back in #350. This should just be two commits.

@crawford
Copy link
Contributor

Nevermind, I see the commit hash is the same.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 27, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crawford, wking

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

The pull request process is described here

Details 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-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@crawford
Copy link
Contributor

On second thought, can we just drop OPENSHIFT_INSTALL_SSH_PUB_KEY? I don't want to have too many options here since we'll get support for reading an install config directly.

@wking
Copy link
Member Author

wking commented Sep 27, 2018

On second thought, can we just drop OPENSHIFT_INSTALL_SSH_PUB_KEY?

We could, I just don't like touching the disk if the caller already happens to have this in memory. But having this in memory is unlikely (maybe for unit tests?), so I'm ok dropping it if you want.

I don't want to have too many options here since we'll get support for reading an install config directly.

With some variables read directly and some read from paths, at least #352 is going to need to support both approaches. The SSH reader could be simplified slightly if we only supported one approach, but I think it's going to be a difference of ~10 lines. Is that too much?

@wking
Copy link
Member Author

wking commented Sep 27, 2018

/retest

#352 was happy (before I had to push to fix gofmt ;), so the e2e errors must be flakes.

@crawford
Copy link
Contributor

The SSH reader could be simplified slightly if we only supported one approach, but I think it's going to be a difference of ~10 lines. Is that too much?

I'm not concerned with the amount of code so much as I'm concerned about supporting all of these interfaces.

@crawford
Copy link
Contributor

In the interest of time, let's leave this as is. We can clean it up after CI is working.

@openshift-merge-robot openshift-merge-robot merged commit c2f93fd into openshift:master Sep 27, 2018
@openshift-ci-robot
Copy link
Contributor

@wking: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws-smoke c2f93fd link /test e2e-aws-smoke

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants