Skip to content

Commit dea46cf

Browse files
bczomaPhilippeKhalife
authored andcommitted
Nfs example + doc updates for OpenShift newer releases, also fixes issue #45 (#48)
* Adjusting dev100 cpu requirements so pod can be scheduled on a 1CPU node * Updating helm chart templates * Fix delete example in documentation * Adjust individual names for ClusterRole and ClusterRoleBinding * Added nfs support * Added -r switch to restore helm * Changed dev100 persist to work on Minikube - use default storage class * Added doc updates for OpenShift newer releases * Fixed missing timing info in log for config-sync-check at <show><redundancy><detail> * Updated maintainer details
1 parent ec1e726 commit dea46cf

13 files changed

+228
-77
lines changed

.travis.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ script:
3737
- wget https://raw.githubusercontent.com/$SOLACE_KUBERNETES_QUICKSTART_REPO/$SOLACE_KUBERNETES_QUICKSTART_BRANCH/scripts/configure.sh
3838
- chmod 755 configure.sh
3939
- #./configure.sh -c gcp -p admin -i gcr.io/capable-stream-180018/solace-pubsub-standard:8.10.0.1057 -v values-examples/prod1k-direct-noha.yaml
40-
- ./configure.sh -c gcp -p admin -i solace/solace-pubsub-standard:8.11.0.1029 -v values-examples/dev100-persist-ha-provisionPvc.yaml
40+
- #./configure.sh -c gcp -p admin -i solace/solace-pubsub-standard:8.11.0.1029 -v values-examples/dev100-persist-ha-provisionPvc.yaml
41+
- ./configure.sh -c gcp -p admin -v values-examples/dev100-persist-ha-provisionPvc.yaml
4142
- cd solace-kubernetes-quickstart/solace
4243
- helm install . -f values.yaml
4344
- kubectl get statefulset,svc,pods,pvc,pv --show-labels
@@ -54,9 +55,12 @@ script:
5455
- tar -xvf SDKPERF_C_LINUX64
5556
- pubSubTools/sdkperf_c -cip=$url -mn=100000 -mr=0 -ptl=t1 -stl=t1 | grep "Total Messages"
5657
- sleep 30
57-
- bash -c 'if [[ -z `curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc semp-version=\"soltr/8_5VMR\"><show><config-sync></config-sync></show></rpc>" | grep "<oper-status>Up</oper-status>"` ]] ; then echo "config-sync not up!"; exit 1; fi'
58-
- curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc semp-version=\"soltr/8_5VMR\"><show><redundancy></redundancy></show></rpc>"
59-
- curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc semp-version=\"soltr/8_5VMR\"><show><config-sync></config-sync></show></rpc>"
58+
- bash -c 'if [[ -z `curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc><show><config-sync></config-sync></show></rpc>" | grep "<oper-status>Up</oper-status>"` ]] ; then echo "config-sync not up!"; exit 1; fi'
59+
- curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc><show><redundancy></redundancy></show></rpc>"
60+
- curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc><show><config-sync></config-sync></show></rpc>"
61+
- helm list
62+
- helm delete $(helm list | grep DEPLOYED | awk '{print $1}')
63+
- kubectl delete pvc --all
6064

6165

6266
after_success:

README.md

+28-13
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This repository explains how to install a Solace PubSub+ Software Message Broker
99
This document is applicable to any platform supporting Kubernetes, with specific hints on how to set up a simple single-node MiniKube deployment on a Unix-based machine. To view examples of other platforms see:
1010

1111
- [Deploying a Solace PubSub+ Software Message Broker HA group onto a Google Kubernetes Engine](https://github.com/SolaceProducts/solace-gke-quickstart )
12-
- [Deploying a Solace PubSub+ Software Message Broker HA Group onto an OpenShift 3.7 or 3.9 platform](https://github.com/SolaceProducts/solace-openshift-quickstart )
12+
- [Deploying a Solace PubSub+ Software Message Broker HA Group onto an OpenShift 3.10 or 3.11 platform](https://github.com/SolaceProducts/solace-openshift-quickstart )
1313
- Deploying a Solace PubSub+ Software Message Broker HA Group onto Amazon EKS (Amazon Elastic Container Service for Kubernetes): follow the [AWS documentation](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html ) to set up EKS then this guide to deploy.
1414

1515
## Description of the Solace PubSub+ Software Message Broker
@@ -62,18 +62,18 @@ To load the docker image into a docker registry, follow the steps specific to th
6262

6363
Deploy message broker Pods and Service to the cluster.
6464

65-
The [Kubernetes `helm`](https://github.com/kubernetes/helm/blob/master/README.md ) tool is used to manage this deployment. A deployment is defined by a "helm chart", which consists of templates and values. The values specify the particular configuration properties in the templates.
65+
The [Kubernetes Helm](https://github.com/kubernetes/helm/blob/master/README.md ) tool is used to manage this deployment. A deployment is defined by a "Helm chart", which consists of templates and values. The values specify the particular configuration properties in the templates.
6666

6767
The following diagram illustrates the template structure used for the Solace Deployment chart. Note that the minimum is shown in this diagram to give you some background regarding the relationships and major functions.
6868

6969
![alt text](/images/template_relationship.png "Template Relationship")
7070

71-
* First, clone this repo, which includes helper scripts and the `solace` helm chart:
71+
* First, clone this repo, which includes helper scripts and the `solace` Helm chart:
7272

7373
```sh
7474
mkdir ~/workspace; cd ~/workspace
75-
git clone https://github.com/SolaceDev/solace-kubernetes-quickstart.git
76-
cd solace-kubernetes-quickstart/solace # location of the solace helm chart
75+
git clone https://github.com/SolaceProducts/solace-kubernetes-quickstart.git
76+
cd solace-kubernetes-quickstart/solace # location of the solace Helm chart
7777
```
7878

7979
* Next, prepare your environment and customize your chart by executing the `configure.sh` script and pass it the required parameters:
@@ -85,7 +85,7 @@ cd solace-kubernetes-quickstart/solace # location of the solace helm chart
8585
| `-c` | OPTIONAL: The cloud environment you will be running in, current options are [aws\|gcp]. NOTE: if you are not using dynamic provisioned persistent disks, or, if you are running a local MiniKube environment, this option can be left out. |
8686
| `-v` | OPTIONAL: The path to a `values.yaml` example/custom file to use. The default file is `values-examples/dev100-direct-noha.yaml` |
8787

88-
The location of the `configure.sh` script is in the `../scripts` directory, relative to the `solace` chart. Executing the configuration script will install the required version of the `helm` tool if needed, as well as customize the `solace` helm chart to your desired configuration.
88+
The location of the `configure.sh` script is in the `../scripts` directory, relative to the `solace` chart. Executing the configuration script will install the required version of the Helm tool if needed, as well as customize the `solace` Helm chart to your desired configuration.
8989

9090
When customizing the `solace` chart by the script, the `values.yaml` located in the root of the chart will be replaced with what is specified in the argument `-v <value-file>`. A number of examples are provided in the `values-examples/` directory, for details refer to [this section](#other-message-broker-deployment-configurations).
9191

@@ -103,7 +103,7 @@ cd ~/workspace/solace-kubernetes-quickstart/solace
103103
../scripts/configure.sh -p <ADMIN_PASSWORD> -i <SOLACE_IMAGE_URL> -c <CLOUD_PROVIDER> -v values-examples/prod1k-persist-ha-provisionPvc.yaml
104104
```
105105

106-
* Finally, use `helm` to install the deployment from the `solace` chart location, using your generated `values.yaml` file:
106+
* Finally, use Helm to install the deployment from the `solace` chart location, using your generated `values.yaml` file:
107107

108108
```sh
109109
cd ~/workspace/solace-kubernetes-quickstart/solace
@@ -116,7 +116,7 @@ To modify a deployment, refer to the section [Upgrading/modifying the message br
116116

117117
### Validate the Deployment
118118

119-
Now you can validate your deployment on the command line. In this example an HA cluster is deployed with po/XXX-XXX-solace-0 being the active message broker/pod. The notation XXX-XXX is used for the unique release name that `helm` dynamically generates, e.g: "tinseled-lamb".
119+
Now you can validate your deployment on the command line. In this example an HA cluster is deployed with po/XXX-XXX-solace-0 being the active message broker/pod. The notation XXX-XXX is used for the unique release name that Helm dynamically generates, e.g: "tinseled-lamb".
120120

121121
```sh
122122
prompt:~$ kubectl get statefulsets,services,pods,pvc,pv
@@ -251,7 +251,20 @@ Use the external Public IP to access the cluster. If a port required for a proto
251251

252252
## Upgrading/modifying the message broker cluster
253253

254-
To upgrade/modify the message broker cluster, make the required modifications to the chart in the `solace-kubernetes-quickstart/solace` directory as described next, then run the `helm` tool from here. When passing multiple `-f <values-file>` to helm, the override priority will be given to the last (right-most) file specified.
254+
To upgrade/modify the message broker cluster, make the required modifications to the chart in the `solace-kubernetes-quickstart/solace` directory as described next, then run the Helm tool from here. When passing multiple `-f <values-file>` to Helm, the override priority will be given to the last (right-most) file specified.
255+
256+
### Restoring Helm if not available
257+
258+
Before getting into the details of how to make changes to a deployment, it shall be noted that when using a new machine to access the deployment Helm may not be available. This can be the case when e.g. using cloud shell, which may be terminated any time.
259+
260+
To restore Helm, run the configure command with the -r option:
261+
262+
```
263+
cd ~/workspace/solace-kubernetes-quickstart/solace
264+
../scripts/configure.sh -r
265+
```
266+
267+
Now Helm shall be available, e.g: `helm list` shall no longer return an error message.
255268

256269
### Upgrading the cluster
257270

@@ -344,14 +357,15 @@ Use Helm to delete a deployment, also called a release:
344357
helm delete XXX-XXX
345358
```
346359

347-
> Note: In some versions, Helm may return an error even if the deletion was successful.
348-
349-
Check what has remained from the deployment, which should only return a single line with svc/kubernetes.
360+
Check what has remained from the deployment, which should only return a single line with svc/kubernetes:
350361

351362
```
352363
kubectl get statefulsets,services,pods,pvc,pv
364+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
365+
service/kubernetes ClusterIP XX.XX.XX.XX <none> 443/TCP XX
353366
```
354-
> Note: In some versions, Helm may not be able to clean up all the deployment artifacts, e.g.: pvc/ and pv/. Check their existence with `kubectl get all` and if necessary, use `kubectl delete` to delete those.
367+
368+
> Note: In some versions, Helm may not be able to clean up all the deployment artifacts, e.g.: pvc/ and pv/. If necessary, use `kubectl delete` to delete those.
355369
356370
## Other Message Broker Deployment Configurations
357371

@@ -363,6 +377,7 @@ The `solace-kubernetes-quickstart/solace/values-examples` directory provides exa
363377
* `prod1k-direct-noha-localDirectory`: production, up to 1000 connections, non-HA, bind the PVC to a local directory on the host node
364378
* `prod1k-direct-noha-provisionPvc`: production, up to 1000 connections, non-HA, bind the PVC to a provisioned PersistentVolume (PV) in Kubernetes
365379
* `prod1k-persist-ha-provisionPvc`: production, up to 1000 connections, HA, to bind the PVC to a provisioned PersistentVolume (PV) in Kubernetes
380+
* `prod1k-persist-ha-nfs`: production, up to 1000 connections, HA, to dynamically bind the PVC to an NFS volume provided by an NFS server, exposed as storage class `nfs`. Note: "root_squash" configuration is supported on the NFS server.
366381

367382
Similar value-files can be defined extending above examples:
368383

scripts/configure.sh

+38-22
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
# The purpose of this script is to:
1919
# - take a URL to a Solace PubSub+ docker container, admin password and cloud provider parameters
2020
# - install the required version of helm
21-
# - clone locally and prepare the solace chart for deployment
21+
# - clone locally if not already cloned and prepare the solace chart for deployment
22+
# - optionally restore helm installed on both client and server if missing
2223

2324
# Use external env variables if defined: SOLACE_KUBERNETES_QUICKSTART_REPO, SOLACE_KUBERNETES_QUICKSTART_BRANCH
2425
# otherwise fall back to defaults (defaults are after the - (dash))
@@ -36,16 +37,18 @@ verbose=0
3637

3738
# Read options
3839
OPTIND=1 # Reset in case getopts has been used previously in the shell.
39-
while getopts "c:i:p:v:" opt; do
40+
while getopts "c:i:p:v:r" opt; do
4041
case "$opt" in
4142
c) cloud_provider=$OPTARG # optional but default will not work in all env
4243
;;
4344
i) solace_image=$OPTARG # optional
4445
;;
45-
p) solace_password=$OPTARG
46+
p) solace_password=$OPTARG # optional if using -s (skip values.yaml customization)
4647
;;
4748
v) values_file=$OPTARG # optional
4849
;;
50+
r) values_file="" # optional - restore helm only, no values file customization
51+
;;
4952
esac
5053
done
5154

@@ -79,31 +82,39 @@ case ${os_type} in
7982
archive_extension="tar.gz"
8083
sed_options="-E -i.bak"
8184
sudo_command="sudo"
85+
helm_target_location="/usr/bin"
8286
;;
8387
"Linux" )
8488
helm_type="linux-amd64"
8589
helm_version="v2.9.1"
8690
archive_extension="tar.gz"
8791
sed_options="-i.bak"
8892
sudo_command="sudo"
93+
helm_target_location="/usr/bin"
8994
;;
9095
*_NT* ) # BASH emulation on windows
9196
helm_type="windows-amd64"
9297
helm_version=v2.9.1
9398
archive_extension="zip"
9499
sed_options="-i.bak"
95100
sudo_command=""
101+
helm_target_location="/usr/bin"
96102
;;
97103
esac
98104
if exists helm; then
99105
echo "`date` INFO: Found helm $(helm version --client --short)"
100106
else
101-
pushd /tmp
102-
curl -O https://storage.googleapis.com/kubernetes-helm/helm-${helm_version}-${helm_type}.${archive_extension}
103-
tar zxf helm-${helm_version}-${helm_type}.${archive_extension} || unzip helm-${helm_version}-${helm_type}.${archive_extension}
104-
${sudo_command} mv ${helm_type}/helm* /usr/bin
105-
popd
106-
echo "`date` INFO: Installed helm $(helm version --client --short)"
107+
if [[ "$helm_type" != "windows-amd64" ]]; then
108+
pushd /tmp
109+
curl -O https://storage.googleapis.com/kubernetes-helm/helm-${helm_version}-${helm_type}.${archive_extension}
110+
tar zxf helm-${helm_version}-${helm_type}.${archive_extension} || unzip helm-${helm_version}-${helm_type}.${archive_extension}
111+
${sudo_command} mv ${helm_type}/helm* $helm_target_location
112+
popd
113+
echo "`date` INFO: Installed helm $(helm version --client --short)"
114+
else
115+
echo "Automated install of helm is not supported on Windows. Please refer to https://github.com/helm/helm#install to install it manually then re-run this script."
116+
exit -1
117+
fi
107118
fi
108119

109120
# Deploy tiller
@@ -137,20 +148,25 @@ else
137148
cd solace
138149
fi
139150

140-
# Ensure current dir is within the chart - e.g solace-kubernetes-quickstart/solace
141-
if [ ! -d "templates" ]; then
142-
echo "`date` INFO: Must be in the chart directory, exiting. Current dir is $(pwd)."
143-
exit -1
151+
# Copy and customize values.xml
152+
if [[ "${values_file}" != "" ]]; then
153+
# Ensure current dir is within the chart - e.g solace-kubernetes-quickstart/solace
154+
if [ ! -d "templates" ]; then
155+
echo "`date` INFO: Must be in the chart directory, exiting. Current dir is $(pwd)."
156+
exit -1
157+
fi
158+
echo "`date` INFO: Building helm charts"
159+
cp ${values_file} ./values.yaml
160+
IFS=':' read -ra container_array <<< "$solace_image"
161+
sed ${sed_options} "s:SOLOS_IMAGE_REPO:${container_array[0]}:g" values.yaml
162+
tag=${container_array[1]-latest} # default to latest if no tag provided
163+
sed ${sed_options} "s:SOLOS_IMAGE_TAG:${tag}:g" values.yaml
164+
sed ${sed_options} "s/SOLOS_CLOUD_PROVIDER/${cloud_provider}/g" values.yaml
165+
sed ${sed_options} "s/SOLOS_ADMIN_PASSWORD/${solace_password}/g" templates/secret.yaml
166+
rm templates/secret.yaml.bak
167+
else
168+
echo "-r option detected, skipping the setup of helm charts."
144169
fi
145-
echo "`date` INFO: Building helm charts"
146-
cp ${values_file} ./values.yaml
147-
IFS=':' read -ra container_array <<< "$solace_image"
148-
sed ${sed_options} "s:SOLOS_IMAGE_REPO:${container_array[0]}:g" values.yaml
149-
tag=${container_array[1]-latest} # default to latest if no tag provided
150-
sed ${sed_options} "s:SOLOS_IMAGE_TAG:${tag}:g" values.yaml
151-
sed ${sed_options} "s/SOLOS_CLOUD_PROVIDER/${cloud_provider}/g" values.yaml
152-
sed ${sed_options} "s/SOLOS_ADMIN_PASSWORD/${solace_password}/g" templates/secret.yaml
153-
rm templates/secret.yaml.bak
154170

155171
# Wait until helm tiller is up and ready to proceed
156172
# workaround until https://github.com/kubernetes/helm/issues/2114 resolved

solace/Chart.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apiVersion: v1
22
description: Deploy Solace PubSub+ Message Broker Singleton or HA Cluster onto a Kubernetes Cluster
33
name: solace
4-
version: 0.3.0
5-
icon: https://dev.solace.com/wp-content/uploads/2016/10/solace-logo-white.png
4+
version: 1.0.1
5+
icon: https://solace.com/wp-content/uploads/2018/05/Solace_Logo_Green_360x100-1.png
66
maintainers:
7-
- name: kenbarr
8-
email: ken.barr@solace.com
7+
- name: support
8+
email: support@solace.com
99
home: http://dev.solace.com
1010
sources:
1111
- https://github.com/SolaceProducts/solace-kubernetes-quickstart

solace/templates/podModRbac.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Fix rbac
2-
---
32
{{- if semverCompare ">=1.8-0" .Capabilities.KubeVersion.GitVersion }}
43
kind: ClusterRole
54
apiVersion: rbac.authorization.k8s.io/v1
65
metadata:
7-
name: pod-tag-updater
6+
name: {{ template "solace.fullname" . }}-podtagupdater
87
rules:
98
- apiGroups: [""] # "" indicates the core API group
109
resources: ["pods"]
@@ -13,11 +12,11 @@ rules:
1312
kind: ClusterRoleBinding
1413
apiVersion: rbac.authorization.k8s.io/v1beta1
1514
metadata:
16-
name: solace
15+
name: {{ template "solace.fullname" . }}-serviceaccounts-to-podtagupdater
1716
roleRef:
1817
apiGroup: rbac.authorization.k8s.io
1918
kind: ClusterRole
20-
name: pod-tag-updater
19+
name: {{ template "solace.fullname" . }}-podtagupdater
2120
subjects:
2221
- kind: Group
2322
name: system:serviceaccounts

solace/templates/secret.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
apiVersion: v1
32
kind: Secret
43
metadata:

solace/templates/service.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Load Service part of template
2-
---
32
apiVersion: v1
43
kind: Service
54
metadata:

solace/templates/solaceConfigMap.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ data:
9494
role_results=`{{ .Values.filepaths.configmap }}/semp_query.sh -n admin -p ${password} -u http://localhost:8080/SEMP \
9595
-q "<rpc><show><redundancy><detail/></redundancy></show></rpc>" \
9696
-v "/rpc-reply/rpc/show/redundancy/active-standby-role[text()]"`
97+
run_time=$((${count} * ${pause}))
9798
case "`echo ${role_results} | xmllint -xpath "string(returnInfo/valueSearchResult)" -`" in
9899
"Primary")
99100
role="primary"

0 commit comments

Comments
 (0)