-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Display oc and kube server versions as part of oc version #9785
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
Display oc and kube server versions as part of oc version #9785
Conversation
[test] |
@fabianofranz Could you please take a look? |
that is a surprisingly large number of completions changes for this |
newline between client a server versions |
any idea what happened to the generation? |
add a header or something indicating the version information is switching to server info, and maybe include the host that is being shown? (e.g. |
for i := 0; i < 2; i++ { | ||
select { | ||
case ocVersion := <-ocServerVersionChan: | ||
fmt.Fprintf(o.Out, "OpenShift Master %v\n", ocVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random order of output is going to bother me, make the output order consistent.
Thanks for the feedback! e85107a |
var maxRequestDuration int32 = 10 | ||
|
||
// start goroutine to fetch openshift / kubernetes server version | ||
go func(f *clientcmd.Factory, timeout int32) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done := make(chan struct{})
var serverVersionErr error
oVersion := ""
kVersion := ""
go func{
defer close(done)
oversion, err := oclient.Get().AbsPath("/version/openshift").Do().Raw()
if err != nil{
serverVersionErr = err
return
}
//parse
//repeat for kube version
}
select {
case <- done:
case <- time.After(timeout):
return fmt.Errorf("error getting server version)
}
fmt.Fprintf("server vesrion stuf")
looks a little tighter I think
4efb92b
to
bec40dd
Compare
re[test] |
@juanvallejo what is going on with your completions? |
bec40dd
to
005dbbb
Compare
I was passing It should be fixed: 5e7f3be |
|
||
const ( | ||
versionLong = ` | ||
Display client and server versions for Kubernetes and OpenShift.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop the product names
005dbbb
to
ea02ef2
Compare
flake? re[test] |
I would leave the existing client version output alone (no header) |
I would include the server host in the header, something like:
|
|
||
type VersionOptions struct { | ||
BaseName string | ||
Config clientcmdapi.Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead?
final comments in. |
c01ec83
to
d268f24
Compare
re[test] |
@@ -339,6 +339,10 @@ os::cmd::expect_success "oadm completion zsh" | |||
os::cmd::expect_failure_and_text "oadm completion test_shell" 'Unsupported shell type "test_shell"' | |||
echo "oc completion: ok" | |||
|
|||
# test oc version output | |||
os::cmd::expect_success_and_text "oc version" "Server" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better content test. Check both server down and server up.
d268f24
to
9e415fc
Compare
|
||
select { | ||
case err, closed := <-done: | ||
if strings.HasSuffix(fmt.Sprintf("%v", err), "connection refused") || clientcmd.IsConfigurationMissing(err) || kclientcmd.IsConfigurationInvalid(err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k
It turns out that the IsConfigurationInvalid
function in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation.go#L95 does not take into account config files that are completely missing, just ones with invalid values. I also tried using the method IsEmptyConfig
instead but that one doesn't take into account a config location that is missing altogether. Since the error for a missing config file is located in our clientcmd
package, I went ahead and placed the method IsConfigurationMissing
there.
lgtm, squash for merge. |
0aeeaaa
to
658de10
Compare
re[test] |
658de10
to
7ea6811
Compare
@fabianofranz @liggitt @deads2k While working on PR #9944, I ended up needing to add an error type for missing config file (like I did with this one) upstream. I have updated this PR so that it implements the new error type upstream as well, instead of in EDIT: PR #9944 did not end up needing the new type of error, reverted changes to use |
7ea6811
to
fac96a8
Compare
re[test] |
flake re[test] |
re[test] |
2 similar comments
re[test] |
re[test] |
fac96a8
to
131728a
Compare
re[test] |
Evaluated for origin test up to 131728a |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7003/) |
[merge] |
Evaluated for origin merge up to 131728a |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7003/) (Image: devenv-rhel7_4688) |
Upstream: kubernetes/kubernetes#29236
Before
oc version
After
oc version
On Error Connecting to Server
oc version