From 53f44e4d8d2e740d3ff7f28a2e0a40b7827d8161 Mon Sep 17 00:00:00 2001 From: Alex Dehn Date: Tue, 1 Oct 2024 11:56:14 +0000 Subject: [PATCH] k8s solution: fix issues with pm-metric-service Issue-ID: OAM-419 Change-Id: If0ba7900167b5207bf58f63ea0a86e97d1d88732 Signed-off-by: Alexander Dehn --- solution_k8s/Makefile | 48 +++++++++++++++++----- .../{metrics => application}/deploy-pm-ms.sh | 2 +- .../helm/pm-metric-service/.helmignore | 0 .../helm/pm-metric-service/Chart.yaml | 0 .../helm/pm-metric-service/templates/_helpers.tpl | 0 .../pm-metric-service/templates/deployment.yaml | 0 .../pm-metric-service/templates/kafka-user-pm.yaml | 0 .../helm/pm-metric-service/templates/service.yaml | 0 .../templates/serviceaccount.yaml | 0 .../templates/tests/test-connection.yaml | 0 .../helm/pm-metric-service/values.yaml | 0 .../helm/pm-metric-service/templates/NOTES.txt | 22 ---------- 12 files changed, 38 insertions(+), 34 deletions(-) rename solution_k8s/{metrics => application}/deploy-pm-ms.sh (97%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/.helmignore (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/Chart.yaml (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/templates/_helpers.tpl (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/templates/deployment.yaml (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/templates/kafka-user-pm.yaml (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/templates/service.yaml (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/templates/serviceaccount.yaml (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/templates/tests/test-connection.yaml (100%) rename solution_k8s/{metrics => application}/helm/pm-metric-service/values.yaml (100%) delete mode 100644 solution_k8s/metrics/helm/pm-metric-service/templates/NOTES.txt diff --git a/solution_k8s/Makefile b/solution_k8s/Makefile index 1b5991f..cd0b1c5 100644 --- a/solution_k8s/Makefile +++ b/solution_k8s/Makefile @@ -37,13 +37,11 @@ prepare-templates: # for metrics and smo stack (cd application; ./setup-smo-template.sh) - - ## create-infrastructure: Create kubernetes all-in one infrastructure .PHONY: create-infrastructure create-infrastructure: # TODO: create kubeone.yaml from template file - + (cd infrastructure; kubeone apply -m kubeone.yaml) (cd infrastructure; mkdir -p ~/.kube; cp o-ran-sc-test-cluster-kubeconfig ~/.kube/config) kubectl wait --for=condition=ready node -l node-role.kubernetes.io/control-plane= @@ -69,32 +67,60 @@ deploy-smo: kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=sdnc-web --timeout 1800s --namespace onap (cd application; ./patch-pmbulk.sh) -## undeploy-smo: Un-Deploys SMO +## undeploy-smo: Un-Deploys SMO .PHONY: undeploy-smo undeploy-smo: helm undeploy onap -n onap for topic in $$(kubectl get kafkatopic -n onap -o name); do kubectl patch $$topic -n onap --type=json -p '[{"op": "remove", "path": "/metadata/finalizers"}]'; done kubectl delete ns onap sudo rm -rf /dockerdata-nfs/onap - + ## deploy-metric: Deploys grafana and influxdb for PM data .PHONY: deploy-metric deploy-metric: (cd metrics; ./deploy-metric-stack.sh ) - (cd metrics; ./deploy-pm-ms.sh ) + (cd application; ./deploy-pm-ms.sh ) ## undeploy-metric: Deploys grafana and influxdb for PM data .PHONY: undeploy-metric undeploy-metric: (cd metrics; ./undeploy-metric-stack.sh ) - helm uninstall -n metric pm-metric-service + helm uninstall -n onap pm-metric-service ## deploy-test-nfs: Deploys test network functions .PHONY: deploy-test-nfs deploy-test-nfs: (cd tests/network-simulation; ./start-network-simulation.sh ) -## undeploy-test-nfs: un-deploys test network functions -.PHONY: undeploy-test-nfs -undeploy-test-nfs: - (cd tests/network-simulation; ./stop-network-simulation.sh ) + +## get-deploy-info: returns list of useful information +.PHONY: get-deploy-info +get-deploy-info: + @echo "FQDN and passwords for services" + @echo "Grafana Dashboard:" + @kubectl get ingress -o custom-columns="NAME:.metadata.name,HOSTS:.spec.rules[].host" -n metric |grep grafana + @echo "Grafana Credentials:" + @echo user: $$(kubectl get secret --namespace metric onap-grafana -o jsonpath="{.data.admin-user}" | base64 --decode ; echo) + @echo password: $$(kubectl get secret --namespace metric onap-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo) + @echo + @echo "SMO RESTCONF ODLUX:" + @kubectl get ingress -o custom-columns="NAME:.metadata.name,HOSTS:.spec.rules[].host" -n onap |grep sdnc + @echo user: $$(kubectl get secret --namespace onap onap-sdnc-odl-creds -o jsonpath="{.data.login}" | base64 --decode ; echo) + @echo password: $$(kubectl get secret --namespace onap onap-sdnc-odl-creds -o jsonpath="{.data.password}" | base64 --decode ; echo) + @echo + @echo "SMO O1-VES-Collector:" + @kubectl get ingress -o custom-columns="NAME:.metadata.name,HOSTS:.spec.rules[].host" -n onap |grep ves + @VES_USER=$$(kubectl get secret --namespace onap onap-sdnc-ves-collector-secret -o jsonpath="{.data.login}" | base64 --decode);\ + VES_PASSWORD=$$(kubectl get secret --namespace onap onap-sdnc-ves-collector-secret -o jsonpath="{.data.password}" | base64 --decode ; echo);\ + echo user: $$VES_USER; \ + echo password: $$VES_PASSWORD;\ + echo example for ves-collector end point: https://$$VES_USER:$$VES_PASSWORD@$$(kubectl get ingress -o custom-columns="HOSTS:.spec.rules[].host" -n onap |grep ves)/eventListener/v7 \ + + + + + + + + + diff --git a/solution_k8s/metrics/deploy-pm-ms.sh b/solution_k8s/application/deploy-pm-ms.sh similarity index 97% rename from solution_k8s/metrics/deploy-pm-ms.sh rename to solution_k8s/application/deploy-pm-ms.sh index 76cf75f..030ba05 100755 --- a/solution_k8s/metrics/deploy-pm-ms.sh +++ b/solution_k8s/application/deploy-pm-ms.sh @@ -18,7 +18,7 @@ # - converts stddefined file ready messages to legacy ves file readymessage and publishs to kafka # - get 3GPP pm data from kafka topics and publishs to influxdb set -x -export METRIC_NAMESPACE=metric +export METRIC_NAMESPACE=onap influxdbpass=$(kubectl get secret -n metric onap-influxdb2-auth -o jsonpath='{.data.admin-password}' | base64 -d) influxdbtoken=$(kubectl get secret -n metric onap-influxdb2-auth -o jsonpath='{.data.admin-token}' | base64 -d) cd helm diff --git a/solution_k8s/metrics/helm/pm-metric-service/.helmignore b/solution_k8s/application/helm/pm-metric-service/.helmignore similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/.helmignore rename to solution_k8s/application/helm/pm-metric-service/.helmignore diff --git a/solution_k8s/metrics/helm/pm-metric-service/Chart.yaml b/solution_k8s/application/helm/pm-metric-service/Chart.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/Chart.yaml rename to solution_k8s/application/helm/pm-metric-service/Chart.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/_helpers.tpl b/solution_k8s/application/helm/pm-metric-service/templates/_helpers.tpl similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/templates/_helpers.tpl rename to solution_k8s/application/helm/pm-metric-service/templates/_helpers.tpl diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/deployment.yaml b/solution_k8s/application/helm/pm-metric-service/templates/deployment.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/templates/deployment.yaml rename to solution_k8s/application/helm/pm-metric-service/templates/deployment.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/kafka-user-pm.yaml b/solution_k8s/application/helm/pm-metric-service/templates/kafka-user-pm.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/templates/kafka-user-pm.yaml rename to solution_k8s/application/helm/pm-metric-service/templates/kafka-user-pm.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/service.yaml b/solution_k8s/application/helm/pm-metric-service/templates/service.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/templates/service.yaml rename to solution_k8s/application/helm/pm-metric-service/templates/service.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/serviceaccount.yaml b/solution_k8s/application/helm/pm-metric-service/templates/serviceaccount.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/templates/serviceaccount.yaml rename to solution_k8s/application/helm/pm-metric-service/templates/serviceaccount.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/tests/test-connection.yaml b/solution_k8s/application/helm/pm-metric-service/templates/tests/test-connection.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/templates/tests/test-connection.yaml rename to solution_k8s/application/helm/pm-metric-service/templates/tests/test-connection.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/values.yaml b/solution_k8s/application/helm/pm-metric-service/values.yaml similarity index 100% rename from solution_k8s/metrics/helm/pm-metric-service/values.yaml rename to solution_k8s/application/helm/pm-metric-service/values.yaml diff --git a/solution_k8s/metrics/helm/pm-metric-service/templates/NOTES.txt b/solution_k8s/metrics/helm/pm-metric-service/templates/NOTES.txt deleted file mode 100644 index 67a35ed..0000000 --- a/solution_k8s/metrics/helm/pm-metric-service/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "pm-metric-service.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "pm-metric-service.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "pm-metric-service.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "pm-metric-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} -- 2.16.6