static boolean isOpenShift ( Client client ) { URL masterUrl = client . getMasterUrl ( ) ; if ( IS_OPENSHIFT . containsKey ( masterUrl ) ) { return IS_OPENSHIFT . get ( masterUrl ) ; } else { RootPaths rootPaths = client . rootPaths ( ) ; if ( rootPaths != null ) { List < String > paths = rootPaths . getPaths ( ) ; if ( paths != null ) { for ( String path : paths ) { // lets detect the new API Groups APIs for OpenShift if ( path . endsWith ( ".openshift.io" ) || path . contains ( ".openshift.io/" ) ) { USES_OPENSHIFT_APIGROUPS . putIfAbsent ( masterUrl , true ) ; IS_OPENSHIFT . putIfAbsent ( masterUrl , true ) ; return true ; } } for ( String path : paths ) { if ( java . util . Objects . equals ( "/oapi" , path ) || java . util . Objects . equals ( "oapi" , path ) ) { IS_OPENSHIFT . putIfAbsent ( masterUrl , true ) ; return true ; } } } } } IS_OPENSHIFT . putIfAbsent ( masterUrl , false ) ; return false ; }
Check if OpenShift is available .