|
| 1 | +# oc helm |
| 2 | + |
| 3 | +OpenShift CLI plugin to integrate with platform capabilities supporting [Helm](https://helm.sh/). |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +OpenShift provides support for managing the lifecycle of Helm charts. This capability is limited primarily to the [Web Console](https://docs.openshift.com/container-platform/4.7/applications/application_life_cycle_management/odc-working-with-helm-charts-using-developer-perspective.html). This plugin enables the management of Helm charts similar to using the standalone Helm CLI while offloading much of the work to OpenShift. |
| 8 | + |
| 9 | +## Capabilities |
| 10 | + |
| 11 | +The following capabilities are provides by this plugin |
| 12 | + |
| 13 | +* Discovering Helm Charts and Repositories registered on the platform |
| 14 | +* Chart lifecycle |
| 15 | + * Install |
| 16 | + * Upgrade |
| 17 | + * Rollback |
| 18 | + * History |
| 19 | + * List |
| 20 | + * Uninstall |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | + |
| 24 | +The following prerequisites must be met prior to using the plugin: |
| 25 | + |
| 26 | +1. OpenShift CLI |
| 27 | +2. OpenShift environment |
| 28 | + 1. You must be logged in using the OpenShift CLI or have a valid environment and OAuth token |
| 29 | + |
| 30 | +## Installing |
| 31 | + |
| 32 | +Perform the following steps to setup and configure the plugin on your machine: |
| 33 | + |
| 34 | +1. Clone the repository and navigate to the project directory: |
| 35 | + |
| 36 | +```shell |
| 37 | +git clone https://github.com/sabre1041/oc-helm |
| 38 | +cd oc-helm |
| 39 | +``` |
| 40 | + |
| 41 | +2. Build the plugin |
| 42 | + |
| 43 | +```shell |
| 44 | +go build -o oc-helm main.go |
| 45 | +``` |
| 46 | + |
| 47 | +3. Copy the resulting binary to a location on your `PATH` |
| 48 | + |
| 49 | +```shell |
| 50 | +mv oc-helm <DIRECTORY_ON_PATH> |
| 51 | +``` |
| 52 | + |
| 53 | +4. Confirm the installation of the plugin |
| 54 | + |
| 55 | +```shell |
| 56 | +oc helm |
| 57 | + |
| 58 | +OpenShift Command Line tool to interact with Helm capabilities. |
| 59 | + |
| 60 | +Usage: |
| 61 | + oc-helm [command] |
| 62 | +... |
| 63 | + |
| 64 | +``` |
| 65 | + |
| 66 | +## Walkthrough |
| 67 | + |
| 68 | +The following provides an example of some of the features provided by the plugin. |
| 69 | + |
| 70 | +Assuming all prerequisites have been met, first list all repositories and their associated charts using the `oc helm index` command: |
| 71 | + |
| 72 | +```shell |
| 73 | +oc helm index |
| 74 | + |
| 75 | +REPOSITORY NAME LATEST VERSION |
| 76 | +redhat-helm-repo ibm-b2bi-prod 2.0.0 |
| 77 | +redhat-helm-repo ibm-cpq-prod 4.0.1 |
| 78 | +redhat-helm-repo ibm-mongodb-enterprise-helm 0.1.0 |
| 79 | +redhat-helm-repo ibm-object-storage-plugin 2.0.7 |
| 80 | +redhat-helm-repo ibm-oms-ent-prod 6.0.0 |
| 81 | +redhat-helm-repo ibm-oms-pro-prod 6.0.0 |
| 82 | +redhat-helm-repo ibm-operator-catalog-enablement 1.1.0 |
| 83 | +redhat-helm-repo ibm-sfg-prod 2.0.0 |
| 84 | +redhat-helm-repo nodejs 0.0.1 |
| 85 | +redhat-helm-repo nodejs-ex-k 0.2.1 |
| 86 | +redhat-helm-repo quarkus 0.0.3 |
| 87 | +``` |
| 88 | + |
| 89 | +Next, create a new project for this walkthrough called `oc-helm-test` |
| 90 | + |
| 91 | +```shell |
| 92 | +oc new-project oc-helm-test |
| 93 | +``` |
| 94 | + |
| 95 | +Next, install the `quarkus` chart from the `redhat-helm` repository and provide `quarkus` as the release name: |
| 96 | + |
| 97 | +```shell |
| 98 | +oc helm install quarkus redhat-helm-repo/quarkus |
| 99 | + |
| 100 | +NAME: quarkus |
| 101 | +NAMESPACE: oc-helm-test |
| 102 | +LAST DEPLOYED: Mon Apr 26 05:35:55 2021 |
| 103 | +STATUS: deployed |
| 104 | +REVISION: 1 |
| 105 | +``` |
| 106 | + |
| 107 | +A new build will be started and in a few moments, the resulting container will be deployed. |
| 108 | + |
| 109 | +By default, the Build will make use of the _jvm_ mode of Quarkus. Native compilation can be enabled by setting the `build.mode` value to `native`. Upgrade the chart to modify the build mode: |
| 110 | + |
| 111 | +```shell |
| 112 | +oc helm upgrade quarkus redhat-helm-repo/quarkus --set build.mode=native |
| 113 | + |
| 114 | +NAME: quarkus |
| 115 | +NAMESPACE: oc-helm-test |
| 116 | +LAST DEPLOYED: Mon Apr 26 05:44:50 2021 |
| 117 | +STATUS: deployed |
| 118 | +REVISION: 2 |
| 119 | +``` |
| 120 | + |
| 121 | +The _quarkus_ BuildConfig will now be updated with _native_ compilation enabled. |
| 122 | + |
| 123 | +Revert the changes by rolling back to the prior revision |
| 124 | + |
| 125 | +```shell |
| 126 | +oc helm rollback quarkus |
| 127 | + |
| 128 | +Rollback was a success! Happy Helming! |
| 129 | +``` |
| 130 | + |
| 131 | +Review the history of the release |
| 132 | + |
| 133 | +```shell |
| 134 | +oc helm history quarkus |
| 135 | + |
| 136 | +REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION |
| 137 | +1 Mon Apr 26 05:35:55 2021 superseded quarkus-0.0.3 Install complete |
| 138 | +2 Mon Apr 26 05:44:50 2021 superseded quarkus-0.0.3 Upgrade complete |
| 139 | +3 Mon Apr 26 05:48:40 2021 deployed quarkus-0.0.3 Rollback to 1 |
| 140 | +``` |
| 141 | + |
| 142 | +Finally, uninstall the chart |
| 143 | + |
| 144 | +```shell |
| 145 | +oc helm uninstall quarkus |
| 146 | + |
| 147 | +release "quarkus" uninstalled |
| 148 | +``` |
0 commit comments