First version of service exposure
[nonrtric.git] / service-exposure / README.md
1 This collection of files represent rapp service exposure prototyping in O-RAN.
2 Prerequisites: Istio should be installed on your cluster with the demo profile (istioctl install --set profile=demo). Please refer to the istio documentation for more information.
3 The deployments have been implemented and tested using minikube.
4 To replicate these tests you will need to setup the various host path referenced in the yaml files on your own machine.
5
6 chartmuseum.yaml:             path: /var/chartmuseum/charts
7 keycloak.yaml:                path: /auth/realms/master
8 keycloak.yaml:                path: /var/keycloak/certs
9 postgres.yaml:                path: "/var/keycloak/data2"
10 postgres.yaml:                path: /tmp
11 rapps-keycloak-mgr.yaml:      path: /var/rapps/certs
12
13 or change them to match your own setup.
14
15 Create the istio-nonrtric namespace and enable it for istio injection
16
17    kubectl create ns istio-nonrtric 
18
19    kubectl label namespace istio-nonrtric istio-injection=enabled
20
21
22 All go programs need to be built prior to running the Dockerfiles
23
24    go build rapps-helm-installer.go    
25    go build rapps-keycloak-mgr.go  
26    go build rapps-istio-mgr.go     
27    go build rapps-rapp-provider.go
28    go build rapps-rapp-invoker.go
29
30 Once the go programs have been compile you then need to build a docker image for each of them.
31
32    docker build -f Dockerfile_rim . -t <tag prefix>/rapps-istio-mgr
33    docker build -f Dockerfile_rkm . -t <tag prefix>/rapps-keycloak-mgr
34    docker build -f Dockerfile_rhi . -t <tag prefix>/rapps-helm-installer
35    docker build -f Dockerfile_rri . -t <tag prefix>/rapps-rapp-invoker
36    docker build -f Dockerfile_rrp . -t <tag prefix>/rapps-rapp-provider
37
38 Image references in the yaml files/helm charts should be changed to match your own tagged images. 
39
40 You will need to package your rapp charts and copy them to the /var/chartmuseum/charts directory before starting.
41
42    cd charts/
43    helm package rapp-provider
44    scp -i $(minikube ssh-key) rapp-provider-0.1.0.tgz docker@$(minikube ip):/var/chartmuseum/charts
45
46    helm package rapp-invoker
47    scp -i $(minikube ssh-key) rapp-invoker-0.1.0.tgz docker@$(minikube ip):/var/chartmuseum/charts
48
49
50 Start keycloak and postgres in the default namespace with istio injection:
51
52    istioctl kube-inject -f postgres.yaml | kubectl apply -f -
53    istioctl kube-inject -f keycloak.yaml | kubectl apply -f -
54
55 To start the management pods run: 
56
57    start_pods.sh
58
59 Run: 
60    kubectl get pods to ensure all managements pods are up and running
61    NAME                                             READY   STATUS    RESTARTS   AGE
62    chartmuseum-deployment-7b8cd4c9d4-tpmhl          1/1     Running   0          8s
63    keycloak-bc6f78f88-zmxlt                         2/2     Running   0          2m20s
64    postgres-6fb4cc8db6-bbhg9                        2/2     Running   0          2m34s
65    rapps-helm-installer-deployment-67476694-sxb2d   1/1     Running   0          6s
66    rapps-istio-mgr-deployment-67c67647b6-scmqc      1/1     Running   0          7s
67    rapps-keycloak-mgr-deployment-7464f87575-trvmx   1/1     Running   0          7s
68
69 Get the node port for the helm installer that corresponds to port 80
70
71    kubectl get svc rapps-helm-installer
72    NAME                   TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
73    rapps-helm-installer   NodePort   10.96.58.211   <none>        80:31570/TCP   8m9s
74
75 Once these pods are up and running run: 
76    curl http://<minikube ip>:<helm installer node port>/install?chart=<rapp chart name> 
77    to install your rapp
78
79    e.g. curl http://192.168.49.2:31570/install?chart=rapp-provider
80         Successfully installed release: rapp-provider
81
82 This will setup keycloak realm + client, istio policies and deploy your chart.
83
84 You should install both the provider and the invoker to see the pods communicating.
85
86 Check the invoker logs to see the test message:
87
88    kubectl logs rapp-invoker-758468d7d4-njmdn  -n istio-nonrtric
89    Received response for rapp-provider get request - Hello World!
90
91 If you want to test using the rp_test.sh file, the client_secret field needs be changed to match the secret for you keycloak client.
92 You can find this in the keycloak-mgr log.
93
94 To uninstall run: 
95    curl http://<minikube ip>:<helm installer node port>/uninstall?chart=<rapp chart name>
96    e.g. curl http://192.168.49.2:31570/uninstall?chart=rapp-invoker
97         Successfully uninstalled release: rapp-invoker
98
99 To stop the management pods run: 
100    stop_pods.sh
101
102 Remove postgres and keycloak with the following commands:
103    kubectl delete -f keycloak.yaml
104    kubectl delete -f postgres.yaml