[jbosstools-issues] [JBoss JIRA] (JBIDE-26877) Connection, OpenShift 4/CRC: wont show OpenShift master version

André Dietisheim (Jira) issues at jboss.org
Thu Oct 17 04:13:00 EDT 2019


    [ https://issues.jboss.org/browse/JBIDE-26877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13800802#comment-13800802 ] 

André Dietisheim edited comment on JBIDE-26877 at 10/17/19 4:12 AM:
--------------------------------------------------------------------

The oc command line reports the openshift version if you're logging in as admin. Further details are insightable in their code (look for the error message *"OpenShift Version not found (must be logged in to cluster as admin)"*): https://github.com/openshift/oc/blob/master/pkg/cli/version/version.go#L110

{code}
			var clusterOperator *configv1.ClusterOperator
			clusterOperator, serverErr = o.oClient.ClusterOperators().Get("openshift-apiserver", metav1.GetOptions{})
			// error here indicates logged in as non-admin, log and move on
			if serverErr != nil {
				switch {
				case kerrors.IsForbidden(serverErr), kerrors.IsNotFound(serverErr):
					klog.V(5).Infof("OpenShift Version not found (must be logged in to cluster as admin): %v", serverErr)
					serverErr = nil
				}
			}
			if clusterOperator != nil {
				for _, ver := range clusterOperator.Status.Versions {
					if ver.Name == "operator" {
						// openshift-apiserver does not report version,
						// clusteroperator/openshift-apiserver does, and only version number
						versionInfo.OpenShiftVersion = ver.Version
					}
				}
			}
		}
{code}


was (Author: adietish):
The oc command line reports the openshift version if you're logging in as admin. Further details are insightable in their code (look for the error message *"OpenShift Version not found (must be logged in to cluster as admin): %v"*): https://github.com/openshift/oc/blob/master/pkg/cli/version/version.go#L110

{code}
			var clusterOperator *configv1.ClusterOperator
			clusterOperator, serverErr = o.oClient.ClusterOperators().Get("openshift-apiserver", metav1.GetOptions{})
			// error here indicates logged in as non-admin, log and move on
			if serverErr != nil {
				switch {
				case kerrors.IsForbidden(serverErr), kerrors.IsNotFound(serverErr):
					klog.V(5).Infof("OpenShift Version not found (must be logged in to cluster as admin): %v", serverErr)
					serverErr = nil
				}
			}
			if clusterOperator != nil {
				for _, ver := range clusterOperator.Status.Versions {
					if ver.Name == "operator" {
						// openshift-apiserver does not report version,
						// clusteroperator/openshift-apiserver does, and only version number
						versionInfo.OpenShiftVersion = ver.Version
					}
				}
			}
		}
{code}

> Connection, OpenShift 4/CRC: wont show OpenShift master version
> ---------------------------------------------------------------
>
>                 Key: JBIDE-26877
>                 URL: https://issues.jboss.org/browse/JBIDE-26877
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 4.13.0.AM1
>            Reporter: André Dietisheim
>            Priority: Major
>             Fix For: 4.14.x
>
>         Attachments: image-2019-09-27-15-47-36-396.png, properties-crc.png
>
>
> Here's how OpenShift Master Version looks for CRC (OpenShift 4):
>  !properties-crc.png! 
> Here's how OpenShift Master Version is reported for employee.openshift.com (OpenShift 3.11 currently):
>  !image-2019-09-27-15-47-36-396.png! 



--
This message was sent by Atlassian Jira
(v7.13.8#713008)



More information about the jbosstools-issues mailing list