From 076d02a9b303b31b58c1700d1d30b3ccdec08bf4 Mon Sep 17 00:00:00 2001 From: ktimoney Date: Tue, 13 Dec 2022 09:23:43 +0000 Subject: [PATCH] Update installation files Change-Id: I6c9e91bee7e2767c24b7db2227670f8a5f0f4a08 Issue-ID: NONRTRIC-822 Signed-off-by: ktimoney --- service-exposure/Dockerfile_wh | 25 ++++++++++++++++++++++ service-exposure/README.md | 8 +++---- service-exposure/certs/client_certs.sh | 2 +- service-exposure/certs/server_certs.sh | 4 ++-- service-exposure/certs/test_cert.sh | 0 .../certs/{webhook-certs.sh => webhook_certs.sh} | 1 + service-exposure/deploy_rapp.sh | 2 +- service-exposure/keycloak.sh | 0 service-exposure/keycloak.yaml | 4 ++++ service-exposure/postgres.yaml | 1 + service-exposure/rapps-helm-installer.go | 6 +++++- service-exposure/rp_test.sh | 0 service-exposure/start_pods.sh | 1 - service-exposure/stop_pods.sh | 2 +- service-exposure/undeploy_rapp.sh | 2 +- 15 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 service-exposure/Dockerfile_wh mode change 100644 => 100755 service-exposure/certs/client_certs.sh mode change 100644 => 100755 service-exposure/certs/server_certs.sh mode change 100644 => 100755 service-exposure/certs/test_cert.sh rename service-exposure/certs/{webhook-certs.sh => webhook_certs.sh} (98%) mode change 100644 => 100755 mode change 100644 => 100755 service-exposure/deploy_rapp.sh mode change 100644 => 100755 service-exposure/keycloak.sh mode change 100644 => 100755 service-exposure/rp_test.sh mode change 100644 => 100755 service-exposure/start_pods.sh mode change 100644 => 100755 service-exposure/stop_pods.sh mode change 100644 => 100755 service-exposure/undeploy_rapp.sh diff --git a/service-exposure/Dockerfile_wh b/service-exposure/Dockerfile_wh new file mode 100644 index 00000000..1ff9facf --- /dev/null +++ b/service-exposure/Dockerfile_wh @@ -0,0 +1,25 @@ +# +# ============LICENSE_START======================================================= +# Copyright (C) 2022 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# +FROM golang:latest +RUN mkdir /app +COPY ./rapps-webhook /app +RUN chmod +x /app/rapps-webhook +WORKDIR /app +ENTRYPOINT ["/app/rapps-webhook"] diff --git a/service-exposure/README.md b/service-exposure/README.md index 59069e09..42e4a0ac 100644 --- a/service-exposure/README.md +++ b/service-exposure/README.md @@ -18,7 +18,7 @@ # ============LICENSE_END========================================================= # This collection of files represent rapp service exposure prototyping in O-RAN. -Prerequisites: Istio should be installed on your cluster with the demo profile. +Prerequisites: Istio should be installed on your cluster with the demo profile. You may need to add istioctl to you $PATH variable. istioctl install --set profile=demo Please refer to the istio documentation for more information. You will also need cfssl installed on your system: sudo apt install golang-cfssl @@ -36,10 +36,10 @@ rapps-keycloak-mgr.yaml: path: /var/rapps/certs or change them to match your own setup. -The certs directory contains 3 shell scripts for creating the server, client and webhook certs: server_certs.sh, client_certs.sh and webhook-certs.sh +The certs directory contains 3 shell scripts for creating the server, client and webhook certs: server_certs.sh, client_certs.sh and webhook_certs.sh Certs generated by the server_certs.sh script: rootCA.crt, tls.crt and tls.key go in the "/var/keycloak/certs" directory -Certs generated by the client_certs.sh script: client.crt, client.key, client_pub.key and rootCA.crt go in the "/var/rapps/certs" directory -The webhook-certs.sh script generates certs for use in the MutatingWebhookConfiguration.yaml and the rapps-webhook.yaml files. +Certs generated by the client_certs.sh script: client.crt, client.key and rootCA.crt go in the "/var/rapps/certs" directory +The webhook_certs.sh script generates certs for use in the MutatingWebhookConfiguration.yaml and the rapps-webhook.yaml files. To configure MutatingWebhookConfiguration.yaml run the following commands: 1. ca_pem_b64="$(openssl base64 -A <"./certs/ca.pem")" 2. sed -i 's/${CA_PEM_B64}/'"$ca_pem_b64"'/g' MutatingWebhookConfiguration.yaml diff --git a/service-exposure/certs/client_certs.sh b/service-exposure/certs/client_certs.sh old mode 100644 new mode 100755 index 279258d9..fbda1ec6 --- a/service-exposure/certs/client_certs.sh +++ b/service-exposure/certs/client_certs.sh @@ -20,7 +20,7 @@ # -CLIENT_SUBJECT="/C=IE/ST=/L=/O=/OU=Keycloak/CN=localhost/emailAddress=client@mail.com" +CLIENT_SUBJECT="/C=IE/ST=Dublin/L=Dublin/O=Keycloak/OU=Keycloak/CN=localhost/emailAddress=client@mail.com" PW=changeit echo $PW > secretfile.txt diff --git a/service-exposure/certs/server_certs.sh b/service-exposure/certs/server_certs.sh old mode 100644 new mode 100755 index c399033f..a6063683 --- a/service-exposure/certs/server_certs.sh +++ b/service-exposure/certs/server_certs.sh @@ -20,8 +20,8 @@ # -CA_SUBJECT="/C=IE/ST=/L=/O=/OU=Keycloak/CN=localhost/emailAddress=ca@mail.com" -SERVER_SUBJECT="/C=IE/ST=/L=/O=/OU=Keycloak/CN=localhost/emailAddress=server@mail.com" +CA_SUBJECT="/C=IE/ST=Dublin/L=Dublin/O=Keycloak/OU=Keycloak/CN=localhost/emailAddress=ca@mail.com" +SERVER_SUBJECT="/C=IE/ST=Dublin/L=Dublin/O=Keycloak/OU=Keycloak/CN=localhost/emailAddress=server@mail.com" PW=changeit echo $PW > secretfile.txt diff --git a/service-exposure/certs/test_cert.sh b/service-exposure/certs/test_cert.sh old mode 100644 new mode 100755 diff --git a/service-exposure/certs/webhook-certs.sh b/service-exposure/certs/webhook_certs.sh old mode 100644 new mode 100755 similarity index 98% rename from service-exposure/certs/webhook-certs.sh rename to service-exposure/certs/webhook_certs.sh index 2a108aff..dc38befa --- a/service-exposure/certs/webhook-certs.sh +++ b/service-exposure/certs/webhook_certs.sh @@ -35,6 +35,7 @@ apiVersion: v1 kind: Secret metadata: name: webhook-cert + namespace: default type: Opaque data: tls.crt: $(cat webhook-cert.pem | base64 | tr -d '\n') diff --git a/service-exposure/deploy_rapp.sh b/service-exposure/deploy_rapp.sh old mode 100644 new mode 100755 index 4d77350c..4d04f6f0 --- a/service-exposure/deploy_rapp.sh +++ b/service-exposure/deploy_rapp.sh @@ -18,7 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # -export host=$(minikube ip) +export host=$(kubectl get nodes -o wide | tail -1 | sed s'/ */ /'g | cut -f6 -d' ') if [ -z "$1" ] then diff --git a/service-exposure/keycloak.sh b/service-exposure/keycloak.sh old mode 100644 new mode 100755 diff --git a/service-exposure/keycloak.yaml b/service-exposure/keycloak.yaml index c8c4a630..2beace26 100644 --- a/service-exposure/keycloak.yaml +++ b/service-exposure/keycloak.yaml @@ -27,6 +27,7 @@ apiVersion: v1 kind: Service metadata: name: keycloak + namespace: default labels: app: keycloak spec: @@ -123,6 +124,7 @@ apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: kcgateway + namespace: default spec: selector: istio: ingressgateway # use istio default ingress gateway @@ -146,6 +148,7 @@ apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: keycloak-tls-vs + namespace: default spec: hosts: - keycloak.oran.org @@ -166,6 +169,7 @@ apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: keycloak-vs + namespace: default spec: hosts: - "*" diff --git a/service-exposure/postgres.yaml b/service-exposure/postgres.yaml index d0e71c59..4bd13338 100644 --- a/service-exposure/postgres.yaml +++ b/service-exposure/postgres.yaml @@ -53,6 +53,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: db-init + namespace: default data: init.sql: | SELECT 'CREATE DATABASE capif' diff --git a/service-exposure/rapps-helm-installer.go b/service-exposure/rapps-helm-installer.go index 0dc93419..9dec9f7d 100644 --- a/service-exposure/rapps-helm-installer.go +++ b/service-exposure/rapps-helm-installer.go @@ -290,6 +290,7 @@ func main() { func addToRepo(url string) (string, error) { repoFile := settings.RepositoryConfig + fmt.Printf("Repo File %s\n", repoFile) //Ensure the file directory exists as it is required for file locking err := os.MkdirAll(filepath.Dir(repoFile), os.ModePerm) @@ -341,7 +342,10 @@ func dryRun() (*action.Install, error) { install := action.NewInstall(actionConfig) + fmt.Printf("Repo Name: %s\n",repoName) + fmt.Printf("Chart Name: %s\n",chartName) cp, err := install.ChartPathOptions.LocateChart(fmt.Sprintf("%s/%s", repoName, chartName), settings) + fmt.Printf("Chart location: %s\n",cp) chartRequested, err = loader.Load(cp) @@ -537,7 +541,7 @@ func registrerRapp(chartName, chartType string) { id serial PRIMARY KEY, name VARCHAR ( 50 ) UNIQUE NOT NULL, type VARCHAR ( 50 ) NOT NULL, - created_on TIMESTAMP DEFAULT NOW() + created_on TIMESTAMP DEFAULT NOW() );` _, err = db.Exec(createStmt) if err != nil { diff --git a/service-exposure/rp_test.sh b/service-exposure/rp_test.sh old mode 100644 new mode 100755 diff --git a/service-exposure/start_pods.sh b/service-exposure/start_pods.sh old mode 100644 new mode 100755 index f1dc5155..391784ea --- a/service-exposure/start_pods.sh +++ b/service-exposure/start_pods.sh @@ -18,7 +18,6 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # -export host=$(minikube ip) echo "Deploying applications..." echo "-------------------------" diff --git a/service-exposure/stop_pods.sh b/service-exposure/stop_pods.sh old mode 100644 new mode 100755 index fa67b13f..1bc83f6f --- a/service-exposure/stop_pods.sh +++ b/service-exposure/stop_pods.sh @@ -19,7 +19,7 @@ # ============LICENSE_END========================================================= # -export host=$(minikube ip) +export host=$(kubectl get nodes -o wide | tail -1 | sed s'/ */ /'g | cut -f6 -d' ') echo "Undeploying applications..." echo "---------------------------" diff --git a/service-exposure/undeploy_rapp.sh b/service-exposure/undeploy_rapp.sh old mode 100644 new mode 100755 index 5e37e178..4a75d345 --- a/service-exposure/undeploy_rapp.sh +++ b/service-exposure/undeploy_rapp.sh @@ -18,7 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # -export host=$(minikube ip) +export host=$(kubectl get nodes -o wide | tail -1 | sed s'/ */ /'g | cut -f6 -d' ') if [ -z "$1" ] then -- 2.16.6