Skip to content

Commit

Permalink
doc: Updated the README.md to mention the pull secret
Browse files Browse the repository at this point in the history
- Included the create_pull_secret.sh script with registry.redhat.io default.
- Updated and reorganized the README.md for the CLI usage.
  • Loading branch information
abellotti committed Mar 28, 2024
1 parent 3267f8f commit de7945b
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 20 deletions.
62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Discovery Helm Chart Repository (downstream)
# Discovery Helm Chart Repository

This Helm repository contains the helm charts for the RedHat Discovery product.

Expand Down Expand Up @@ -30,26 +30,15 @@ Within a minute or so then the Discovery Helm Chart will appear in the OpenShift
## Installing Discovery using the Helm CLI
Altenatively, one can download a specific version of the Helm Chart from this repo and install Discovery by using the Helm CLI.

First look at the chart index in this repo to determine which helm chart version to download.
In [Chart Index](https://quipucords.github.io/discovery-helm-repo/charts/index.yaml), find the Helm Chart `version` that reflects the desired `appVersion` of Discovery.

For example, you can see Helm Chart version `0.9.2` pulls in Discovery `1.5.3`.

Then download the appropriate
First, login to the OpenShift cluster and create a project for running discovery. For these examples we will use `discovery-qe`:

```
$ mkdir -p ~/discovery-helm
$ cd ~/discovery-helm
$ curl -k https://quipucords.github.io/discovery-helm-repo/charts/discovery-0.9.2.tgz \
--output discovery-0.9.2.tgz
$ tar -xzf discovery-0.9.2.tgz
$ ls -FC
discovery/ discovery-0.9.2.tgz
$ oc login https://api.<your_cluster>:6443 -u kubeadmin -p <kubeadmin_password>
$ oc new-project discovery-qe
```

The downloaded and extracted Discovery helm chart 0.9.2 will be in the `discovery` directory

To deploy to your OpenShift cluster, first make sure the Helm CLI is installed:
Next, make sure the Helm CLI is installed:

On Mac:

Expand All @@ -59,14 +48,47 @@ $ brew install helm

For all others, please visit [https://helm.sh/docs/intro/install/]()

First, login to the OpenShift cluster and set your working project, for these examples we will use `discovery-qe`:
For downloading the Discovery image, you need to create a `discovery-pull-secret` that has the credentials needed to access `registry.redhat.io`. The secret can be created using `oc create secret ...` or by using the helper script provided here:

```
$ oc login https://api.<your_cluster>:6443 -u kubeadmin -p <kubeadmin_password>
$ oc project discovery-qe
$ mkdir ~/bin
$ curl -k https://quipucords.github.io/discovery-helm-repo/bin/create_pull_secret.sh \
--output ~/bin/create_pull_secret.sh
$ chmod 755 ~/bin/create_pull_secret.sh
$ create_pull_secret.sh "discovery-pull-secret"
Registry server - registry.redhat.io:
Registry username - <user>: <user-email>
Registry password: ....
Registry user e-mail - <user-email>:
Add another docker server (y/n)?n
Creating pull secret discovery-pull-secret ...
secret/discovery-pull-secret created
$
```


Next, look at the chart index in this repo to determine which helm chart version to download.
In [Chart Index](https://quipucords.github.io/discovery-helm-repo/charts/index.yaml), find the Helm Chart `version` that reflects the desired `appVersion` of Discovery.

For example, you can see Helm Chart version `0.9.2` pulls in Discovery `1.5.3`.

Then download the appropriate

```
$ mkdir -p ~/discovery-helm
$ cd ~/discovery-helm
$ curl -k https://quipucords.github.io/discovery-helm-repo/charts/discovery-0.9.2.tgz \
--output discovery-0.9.2.tgz
$ tar -xzf discovery-0.9.2.tgz
$ ls -FC
discovery/ discovery-0.9.2.tgz
```

Then, install discovery using the Helm CLI:
The downloaded and extracted Discovery helm chart 0.9.2 will be in the `discovery` directory

Finally, install discovery using the Helm CLI:

```
$ helm install discovery ./discovery --set server.password="EXAMPLE-superadmin1"
Expand Down
51 changes: 51 additions & 0 deletions bin/create_pull_secret.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#
# Helper script to create a pull secret with one or more registry servers.
#
if [ $# -ne 1 ]; then
echo "Usage: ${0} <pull-secret-name>"
exit 1
fi

pull_secret="${1}"
config_json='{"auths":{}}'

while :
do
default="registry.redhat.io"
echo
reg_server=$(read -p "Registry server - $default: " server; echo $server)
reg_server=${reg_server:-$default}

default="$(whoami)"
reg_username=$(read -p "Registry username - $default: " username; echo $username)
reg_username=${reg_username:-$default}

reg_password=$(read -s -p "Registry password: " pwd; echo $pwd)
stty echoe; echo

default="${reg_username}"
[[ ! "${default}" =~ "@" ]] && default="${default}@redhat.com"

reg_email=$(read -p "Registry user e-mail - $default: " email; echo $email)
reg_email=${reg_email:-$default}

config_json=`echo ${config_json} | jq ".auths += {\"${reg_server}\":{\"username\":\"${reg_username}\",\"password\":\"${reg_password}\",\"email\":\"${reg_email}\"}}"`

echo
another=$(read -p "Add another registry server (y/n)?" ans; echo $ans)
if [ ! "${another}" = "y" ]; then
break
fi
done

config_json_file="$(mktemp)"
echo -n "${config_json}" > "${config_json_file}"
echo
echo "Creating pull secret ${pull_secret} ..."
oc delete secret/${pull_secret} --ignore-not-found=true
oc create secret generic ${pull_secret} \
--from-file=.dockerconfigjson="${config_json_file}" \
--type=kubernetes.io/dockerconfigjson
rm -f "${config_json_file}"

0 comments on commit de7945b

Please sign in to comment.