...
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./docker-cmhm.sh |
Code Block |
---|
language | bash |
---|
title | docker-hm.sh |
---|
collapse | true |
---|
|
docker run \
--rm \
-it \
-p 8112:8083 \
--name helmmanagerservice \
--network nonrtric-docker-net \
-v $(pwd)/mnt/database:/var/helm-manager/database \
-v ~/.kube:/root/.kube \
-v ~/.helm:/root/.helm \
-v ~/.config/helm:/root/.config/helm \
-v ~/.cache/helm:/root/.cache/helm \
-v $(pwd)/config/KubernetesParticipantConfig.json:/opt/app/helm-manager/src/main/resources/config/KubernetesParticipantConfig.json \
-v $(pwd)/config/application.yaml:/opt/app/helm-manager/src/main/resources/config/application.yaml \
o-ran-sc/nonrtric-helm-manager:1.0.0-SNAPSHOT |
...
All operations should report "OK".
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./test.sh docker |
Code Block |
---|
|
Start test
================
Get apps - empty
================
curl -sw %{http_code} http://localhost:8112/helm/charts
Curl OK
Response: 200
Body: {"charts":[]}
============
Onboard app
===========
curl -sw %{http_code} http://localhost:8112/helm/charts -X POST -F chart=@simple-app-0.1.0.tgz -F values=@simple-app-values.yaml -F info=<simple-app.json
Curl OK
Response: 200
Body:
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:8112/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
===========
Install app
===========
curl -sw %{http_code} http://localhost:8112/helm/install -X POST -H Content-Type:application/json -d @simple-app-installation.json
Curl OK
Response: 201
Body:
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:8112/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
=============================
helm ls to list installed app
=============================
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
hm-app hm-app-ns 1 2021-05-19 17:15:26.068017436 +0000 UTC deployed hm-app-0.1.0 1.16.0
kall1 default 2 2021-05-16 21:32:46.710349 +0200 CEST deployed app1-0.1.0 1.16.0
kall11 default 1 2021-05-16 21:40:57.073819 +0200 CEST deployed app1-0.1.0 1.16.0
kalle3 app3-ns 1 2021-05-17 01:22:29.514917 +0200 CEST deployed app3-0.1.0 1.16.0
kalle3 default 1 2021-05-17 01:17:03.671637 +0200 CEST deployed app3-0.1.0 1.16.0
simpleapp ckhm 1 2021-06-01 16:31:30.255849815 +0000 UTC deployed simple-app-0.1.0 1.16.0
==========================================
sleep 30 - give the app some time to start
==========================================
============================
List svc and pod of the app
============================
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
simpleapp-simple-app ClusterIP 10.102.209.44 <none> 80/TCP 31s
NAME READY STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-vm6hd 1/1 Running 0 31s
========================
Uninstall app simple-app
========================
curl -sw %{http_code} http://localhost:8112/helm/uninstall/simple-app/0.1.0 -X DELETE
Curl OK
Response: 204
Body:
sleep 10 - give the app some time to remove
=============================================
List svc and pod of the app - should be gone
=============================================
No resources found in ckhm namespace.
No resources found in ckhm namespace.
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:8112/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
============
Delete chart
===========
curl -sw %{http_code} http://localhost:8112/helm/charts/simple-app/0.1.0 -X DELETE
Curl OK
Response: 204
Body:
================
Get apps - empty
================
curl -sw %{http_code} http://localhost:8112/helm/charts
Curl OK
Response: 200
Body: {"charts":[]}
Test result All tests ok
End of test |
...
Start the helm manager. Four objects will be created. Note that the service is defined as a NodePort. This enables access from outside the cluster and is also a precondition for the test script to work. Change 'type' to 'ClusterIP' in the 'helmmanagerservice' service definition in the file helm-manager.yaml.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl apply -f helm-manager.yaml
service/helmmanagerservice created
pod/helmmanagerservice created
persistentvolume/helm-manager-service-pv created
persistentvolumeclaim/helm-manager-service-pvc created |
...
Example output of the script
Code Block |
---|
|
Start test
================
Get apps - empty
================
curl -sw %{http_code} http://localhost:32743/helm/charts
Curl OK
Response: 200
Body: {"charts":[]}
============
Onboard app
===========
curl -sw %{http_code} http://localhost:32743/helm/charts -X POST -F chart=@simple-app-0.1.0.tgz -F values=@simple-app-values.yaml -F info=<simple-app.json
Curl OK
Response: 200
Body:
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:32743/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
===========
Install app
===========
curl -sw %{http_code} http://localhost:32743/helm/install -X POST -H Content-Type:application/json -d @simple-app-installation.json
Curl OK
Response: 201
Body:
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:32743/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
=============================
helm ls to list installed app
=============================
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
hm-app hm-app-ns 1 2021-05-19 17:15:26.068017436 +0000 UTC deployed hm-app-0.1.0 1.16.0
kall1 default 2 2021-05-16 21:32:46.710349 +0200 CEST deployed app1-0.1.0 1.16.0
kall11 default 1 2021-05-16 21:40:57.073819 +0200 CEST deployed app1-0.1.0 1.16.0
kalle3 default 1 2021-05-17 01:17:03.671637 +0200 CEST deployed app3-0.1.0 1.16.0
kalle3 app3-ns 1 2021-05-17 01:22:29.514917 +0200 CEST deployed app3-0.1.0 1.16.0
simpleapp ckhm 1 2021-06-01 22:24:12.797624073 +0000 UTC deployed simple-app-0.1.0 1.16.0
==========================================
sleep 30 - give the app some time to start
==========================================
============================
List svc and pod of the app
============================
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
simpleapp-simple-app ClusterIP 10.105.1.129 <none> 80/TCP 30s
NAME READY STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-k6vsl 1/1 Running 0 30s
========================
Uninstall app simple-app
========================
curl -sw %{http_code} http://localhost:32743/helm/uninstall/simple-app/0.1.0 -X DELETE
Curl OK
Response: 204
Body:
sleep 10 - give the app some time to remove
=============================================
List svc and pod of the app - should be gone
=============================================
No resources found in ckhm namespace.
NAME READY STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-k6vsl 0/1 Terminating 0 41s
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:32743/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
============
Delete chart
===========
curl -sw %{http_code} http://localhost:32743/helm/charts/simple-app/0.1.0 -X DELETE
Curl OK
Response: 204
Body:
================
Get apps - empty
================
curl -sw %{http_code} http://localhost:32743/helm/charts
Curl OK
Response: 200
Body: {"charts":[]}
Test result All tests ok
End of test |
...