Do you often need to switch across many different OpenShift environments ?
In doing so, do you often struggle recollecting what user to log in as ? Or what the URL to the master node of your OCP environment is ? Or what version of oc utility to use ?
This utility provides assistance with login to one of many possible OpenShift Container Platform environments so that you can more easily switch between them.
-
Install
libxcrypt-compat
package:$ sudo dnf install -y libxcrypt-compat
-
Download the latest release of this utility and place in a location on your $PATH:
$ release='v.2' $ curl -L https://github.com/jbride/ocp_pick/releases/download/$release/ocp_pick -o $HOME/bin/ocp_pick \ && chmod 755 $HOME/bin/ocp_pick
-
This ocp_pick utility reads a configuration file (in yaml format) of all of your OCP environments.
Download an example config file :
$ curl https://raw.githubusercontent.com/jbride/ocp_pick/$release/src/test/resources/ocp_env_details.yaml -o $HOME/.ocp_env_details.yml
-
Edit this $HOME/.ocp_env_details.yml configuration file as necessary
-
View the help:
$ ocp_pick --help
-
Ensure GraalVM is installed and its java and javac utilities are on your $PATH
-
Ensure Maven 3.5 (or more recent) is installed.
-
Clone this git repo
-
Change directory into this project
-
Build a java artifact and compile to a native executable:
$ mvn clean package
-
Execute this utility as a native executable:
$ ./target/ocp_pick --help
-
This maven project makes use of the com.oracle.substratevm:native-image-maven-plugin for compilation to a native binary. You can optionaly view the details of this plugin as follows:
$ mvn help:describe -Dplugin=com.oracle.substratevm:native-image-maven-plugin -Ddetail
$ mvn clean package -Dnative.skip=true
$ native-image -cp /u02/maven/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/u02/maven/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/u02/maven/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar:/u01/other/ocp_pick/target/ocp_pick-1.0.jar -H:IncludeResources='.*.properties|.*META-INF/persistence.xml|.*.xsd' -H:ReflectionConfigurationFiles=target/classes/graal.json -H:Class=com.ratwater.jbride.OCPick -H:Name=target/ocp_pick