...
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ helm create simple-app
Successfully packaged chart and saved it to: /nonrtric/helm-manager/simple-app-0.1.0.tgz
$ helm package simple-app |
Run in
...
kubernetes
The helm-manger is possible to run as a docker container. However, a local kubernetes must be running where the application can be installed.
This instruction is valid for running both in a local kubernetes and in a kubernetes ccluster
If running in a local kubernetes, set the env KUBE_HOST to localhostCreate a private docker network, unless it already exists, for the containers to run in.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ docker network create nonrtric-docker-netKUBE_HOST="localhost" |
If running in a kubernetes cluster, set the env KUBE_HOST to the ip of the clusterStart the chartmuseum container in a separate window. This will be used as a chart repository. Make note of the port, 8222, which will be available on local host. Charts uploaded to the chartmuseum container will be availed in the mounted dir 'charts' on your host.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
title | Example |
---|
|
$ ./docker-cm.shkubectl cluster-info
Kubernetes master is running at https://10.2.0.103:6443
$ KUBE_HOST=10.2.0.103 |
Check if the nonrtric names space exists. If not, create the namespace
Code Block |
---|
language | bash |
---|
title | docker-cm.sh |
---|
linenumbers | true |
---|
collapse | true |
---|
theme | Midnight |
---|
|
$ kubectl get ns nonrtric
$ kubectl create ns nonrtric |
Start the chartmuseum service and pod
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl apply -f kube-cm.yaml |
Code Block |
---|
language | bash |
---|
title | kube-cm.yaml |
---|
collapse | true |
---|
|
apiVersion: v1
kind: Service
metadata:
name: chartrepo
namespace: nonrtric
labels:
run: chartrepo
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
selector:
run: chartrepo
---
apiVersion: v1
kind: Pod
metadata:
name: chartrepo
namespace: nonrtric
labels:
run: chartrepo
spec:
securityContext:
runAsUser: 0
containers:
- name: chartrepo
image: docker run \
--rm \
-it \
-p 8222:8080 \
--name chartmuseum \
--network nonrtric-docker-net \
-e DEBUG=1 \
-e STORAGE=local \
-e STORAGE_LOCAL_ROOTDIR=/charts \
-v $(pwd)/charts:/charts \
ghcr.io/helm/chartmuseum:v0.13.1 |
Add the chart, created in the section 'Create helm for test', to the repo
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ curl --data-binary "@simple-app-0.1.0.tgz" -X POST http://localhost:8222/api/charts
{"saved":true} |
Start the helm manager in a separate window. Make note of the port, 8112, which will be available on local host. This is the port to the Helm manager REST API.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./docker-hm.sh |
Code Block |
---|
language | bash |
---|
title | docker-hm.sh |
---|
collapse | true |
---|
|
docker run \
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
env:
- name: DEBUG
value: "1"
--rm name: \STORAGE
-it \ value: "local"
-p 8112name:8083 \
STORAGE_LOCAL_ROOTDIR
--name helmmanagerservice \value: "/var/chartrepo/charts"
--network nonrtric-docker-net \
name: DISABLE_API
-v $(pwd)/mnt/database:/var/helm-manager/database \ value: "false"
volumeMounts:
-v ~/.kube:/root/.kube \
mountPath: /var/chartrepo/charts
-v ~/.helm:/root/.helm \ name: chartrepo-pv
volumes:
-v ~/.config/helm:/root/.config/helm \ name: chartrepo-pv
-v ~/.cache/helm:/root/.cache/helm \
persistentVolumeClaim:
-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 |
The chartmusem repo need to added to helm. This operation must be called with a url accessible from the helm manager container.
Go into the helm manager container and add the repo.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ docker exec -it helmmanagerservice sh
# helm repo add cm http://chartmuseum:8080
"cm" has been added to your repositories
$ exit |
The helm manager is now running and configured with a chart repo.
Run the script test.sh to execute the sequence for installing the application 'simpleapp' namespace 'ckhm':
- Namespace 'ckhm' is created in kubernetes if not existing
- Onboard chart
- Install chart
- Uninstall chart
- Remove (the onboarded) chart
All operations should report "OK".
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./test.sh docker |
claimName: chartrepo-pvc
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: chartrepo-pv
annotations:
pv.beta.kubernetes.io/gid: "999"
labels:
run: chartrepo
spec:
storageClassName: chartrepo-standard
capacity:
storage: 10Mi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
hostPath:
path: "/tmp/chartrepo"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chartrepo-pvc
namespace: nonrtric
labels:
run: chartrepo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
storageClassName: chartrepo-standard
volumeMode: Filesystem |
Add the chart, created in the section 'Create helm for test', to the chartmuseum repo. The node port of the chartmuseum service is obtained and env var CM_PORT is assigned that port number.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ CM_PORT=$(kubectl get svc chartrepo -n nonrtric -o jsonpath='{...ports[?(@.name=="'http'")].nodePort}')
$ curl --data-binary @simple-app-0.1.0.tgz -X POST http://$KUBE_HOST:$CM_PORT/api/charts
{"saved":true} |
Create a service account for the helm manager. This example service account bind to the "cluster-admin" role which normally has full permissions to the add/change/read/delete any kubernetes object. It is advisable to bind the service account to a ClusterRole with less permissions if desired.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl apply -f helm-manager-sa.yaml
serviceaccount/helm-manager-sa created
clusterrolebinding.rbac.authorization.k8s.io/helm-manager-sa-clusterrolebinding created |
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 |
The chartmuseum repo need to added to helm. This operation must be called with a url accessible from the helm manager pod.
Go into the helm manager container and add the repo.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl exec -it helmmanagerservice -n nonrtric -- sh
# helm repo add cm http://chartrepo.nonrtric:8080
"cm" has been added to your repositories
$ exit |
The helm manager is now running and configured with a chart repo.
Run the script test.sh to execute the sequence for installing the application 'simpleapp' namespace 'ckhm':
- Namespace 'ckhm' is created in kubernetes if not existing
- Onboard chart
- Install chart
- Uninstall chart
- Remove (the onboarded) chart
All operations should report "OK".
If running in a local kubernetes
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./test.sh kube-local |
if running in a kubernetes cluster. Use the previously set env var KUBE_HOST as second arg to the script
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./test.sh kube-cluster $KUBE_HOST |
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:
========= |
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
=====================
Get apps - simple-app
=====================
curl -sw %{http_code} http://localhost:811232743/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-nsdefault 1 2021-05-17 01:2217:2903.514917671637 +0200 CEST deployed app3-0.1.0 1.16.0
kalle3 defaultapp3-ns 1 2021-05-17 01:1722:0329.671637514917 +0200 CEST deployed app3-0.1.0 1.16.0
simpleapp ckhm 1 2021-06-01 1622:3124:3012.255849815797624073 +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.102105.2091.44129 <none> 80/TCP 31s
NAME READY STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-vm6hd 1/1 30s
NAME 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. READY STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-k6vsl 1/1 Running 0 30s
========================
GetUninstall apps -app simple-app
========================
curl -sw %{http_code} http://localhost:811232743/helm/charts/uninstall/simple-app/0.1.0 -X DELETE
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
204
Body:
sleep 10 - give the app some time to remove
================
Delete chart
============================
curl -sw %{http_code} http://localhost:8112/helm/charts/simple-app/0.1.0 -X DELETE
Curl OK
Response: 204
Body:
=
List svc and pod of the app - should be gone
=============================
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 |
Run in kubernetes
This instruction is valid for running both in a local kubernetes and in a kubernetes ccluster
If running in a local kubernetes, set the env KUBE_HOST to localhost
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ KUBE_HOST="localhost" |
If running in a kubernetes cluster, set the env KUBE_HOST to the ip of the cluster.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
title | Example |
---|
|
$ kubectl cluster-info
Kubernetes master is running at https://10.2.0.103:6443
$ KUBE_HOST=10.2.0.103 |
Check if the nonrtric names space exists. If not, create the namespace
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl get ns nonrtric
$ kubectl create ns nonrtric |
Start the chartmuseum service and pod
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl apply -f kube-cm.yaml |
Code Block |
---|
language | bash |
---|
title | kube-cm.yaml |
---|
collapse | true |
---|
|
apiVersion: v1
kind: Service
metadata:
name: chartrepo
namespace: nonrtric
labels:
run: chartrepo
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
selector:
run: chartrepo
---
apiVersion: v1
kind: Pod
metadata:
name: chartrepo
namespace: nonrtric
labels:
run: chartrepo
spec:
securityContext:
runAsUser: 0
containers:
- name: chartrepo
image: ghcr.io/helm/chartmuseum:v0.13.1
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
env:
- name: DEBUG
value: "1"
- name: STORAGE
value: "local"
- name: STORAGE_LOCAL_ROOTDIR
value: "/var/chartrepo/charts"
- name: DISABLE_API
value: "false"
volumeMounts:
- mountPath: /var/chartrepo/charts
name: chartrepo-pv
volumes:
- name: chartrepo-pv
persistentVolumeClaim:
claimName: chartrepo-pvc
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: chartrepo-pv
annotations:
pv.beta.kubernetes.io/gid: "999"
labels:
run: chartrepo
spec:
storageClassName: chartrepo-standard
capacity:
storage: 10Mi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
hostPath:
path: "/tmp/chartrepo"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chartrepo-pvc
namespace: nonrtric
labels:
run: chartrepo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
storageClassName: chartrepo-standard
volumeMode: Filesystem |
Add the chart, created in the section 'Create helm for test', to the chartmuseum repo. The node port of the chartmuseum service is obtained and env var CM_PORT is assigned that port number.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ CM_PORT=$(kubectl get svc chartrepo -n nonrtric -o jsonpath='{...ports[?(@.name=="'http'")].nodePort}')
$ curl --data-binary @simple-app-0.1.0.tgz -X POST http://$KUBE_HOST:$CM_PORT/api/charts
{"saved":true} |
Create a service account for the helm manager. This example service account bind to the "cluster-admin" role which normally has full permissions to the add/change/read/delete any kubernetes object. It is advisable to bind the service account to a ClusterRole with less permissions if desired.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl apply -f helm-manager-sa.yaml
serviceaccount/helm-manager-sa created
clusterrolebinding.rbac.authorization.k8s.io/helm-manager-sa-clusterrolebinding created |
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 |
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 |
Cleanup of all created kubernetes object
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl delete -f kube-hm.yaml
service "helmmanagerservice" deleted
pod "helmmanagerservice" deleted
persistentvolume "helm-manager-service-pv" deleted
persistentvolumeclaim "helm-manager-service-pvc" deleted
$ kubectl delete -f kube-cm.yaml
service "chartrepo" deleted
pod "chartrepo" deleted
persistentvolume "chartrepo-pv" deleted
persistentvolumeclaim "chartrepo-pvc" deleted
$ kubectl delete -f helm-manager-sa.yaml
serviceaccount "helm-manager-sa" deleted
clusterrolebinding.rbac.authorization.k8s.io "helm-manager-sa-clusterrolebinding" deleted |
Run in docker with local kubernetes
The helm-manger is possible to run as a docker container. However, a local kubernetes must be running where the application can be installed.
Create a private docker network, unless it already exists, for the containers to run in.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ docker network create nonrtric-docker-net |
Start the chartmuseum container in a separate window. This will be used as a chart repository. Make note of the port, 8222, which will be available on local host. Charts uploaded to the chartmuseum container will be availed in the mounted dir 'charts' on your host.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./docker-cm.sh |
Code Block |
---|
language | bash |
---|
title | docker-cm.sh |
---|
linenumbers | true |
---|
collapse | true |
---|
|
docker run \
--rm \
-it \
-p 8222:8080 \
--name chartmuseum \
--network nonrtric-docker-net \
-e DEBUG=1 \
-e STORAGE=local \
-e STORAGE_LOCAL_ROOTDIR=/charts \
-v $(pwd)/charts:/charts \
ghcr.io/helm/chartmuseum:v0.13.1 |
Add the chart, created in the section 'Create helm for test', to the repo
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ curl --data-binary "@simple-app-0.1.0.tgz" -X POST http://localhost:8222/api/charts
{"saved":true} |
Start the helm manager in a separate window. Make note of the port, 8112, which will be available on local host. This is the port to the Helm manager REST API.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./docker-hm.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 |
The chartmusem The chartmuseum repo need to added to helm. This operation must be called with a url accessible from the helm manager podcontainer.
Go into the helm manager container and add the repo.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectldocker exec -it helmmanagerservice -n nonrtric -- sh
# helm repo add cm http://chartrepo.nonrtricchartmuseum:8080
"cm" has been added to your repositories
$ exit |
...
- Namespace 'ckhm' is created in kubernetes if not existing
- Onboard chart
- Install chart
- Uninstall chart
- Remove (the onboarded) chart
All operations should report "OK".
If running in a local kubernetes
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./test.sh kube-local |
...
- in kubernetes if not existing
- Onboard chart
- Install chart
- Uninstall chart
- Remove (the onboarded) chart
All operations should report "OK". a kubernetes cluster. Use the previously set env var KUBE_HOST as second arg to the script
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ ./test.sh kube-cluster $KUBE_HOST |
...
Code Block |
---|
|
Start test
================
Get apps - empty
================
curl -sw %{http_code} http://localhost:327438112/helm/charts
Curl OK
Response: 200
Body: {"charts":[]}
============
Onboard app
===========
curl -sw %{http_code} http://localhost:327438112/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:327438112/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:327438112/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:327438112/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 defaultapp3-ns 1 2021-05-17 01:1722:0329.671637514917 +0200 CEST deployed app3-0.1.0 1.16.0
kalle3 app3-nsdefault 1 2021-05-17 01:2217:2903.514917671637 +0200 CEST deployed app3-0.1.0 1.16.0
simpleapp ckhm 1 2021-06-01 2216:2431:1230.797624073255849815 +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.105102.1209.12944 <none> 80/TCP 30s31s
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
========== STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-vm6hd 1/1 Running 0 31s
===================================
List svc and pod of the app - should be gone
====================
Uninstall app simple-app
=========================
Nocurl resources found in ckhm namespace.
NAME READY STATUS RESTARTS AGE
simpleapp-simple-app-858c798f97-k6vsl 0/1 Terminating 0 41s
-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
========================
Get apps - simple-app
=====================
curlList -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"}]}
svc and pod of the app - should be gone
==================================
Delete chart
===========
curlNo -sw %{http_code} http://localhost:32743/helm/charts/simple-app/0.1.0 -X DELETE
Curl OK
Response: 204
Body:
resources found in ckhm namespace.
No resources found in ckhm namespace.
=====================
Get apps - empty
simple-app
=====================
curl -sw %{http_code} http://localhost:327438112/helm/charts
Curl OK
Response: 200
Body: {"charts":[{"releaseName":"simpleapp","chartName":"simple-app","version":"0.1.0","namespace":"ckhm","repository":"cm"}]}
Test result All tests ok
End of test |
Cleanup of all created kubernetes object
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
$ kubectl delete -f kube-hm.yaml
service "helmmanagerservice" deleted
pod "helmmanagerservice" deleted
persistentvolume "helm-manager-service-pv" deleted
persistentvolumeclaim "helm-manager-service-pvc" deleted
$ kubectl delete -f kube-cm.yaml
service "chartrepo" deleted
pod "chartrepo" deleted
persistentvolume "chartrepo-pv" deleted
persistentvolumeclaim "chartrepo-pvc" deleted
$ kubectl delete -f helm-manager-sa.yaml
serviceaccount "helm-manager-sa" deleted
clusterrolebinding.rbac.authorization.k8s.io "helm-manager-sa-clusterrolebinding" deleted
============
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 |