From b472c167413a55a42fc7bfa08d2138f967a204fb Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Tue, 14 Dec 2021 09:19:33 +0100 Subject: [PATCH] Adaptations to latest helm participant jar Issue-ID: NONRTRIC-618 Signed-off-by: BjornMagnussonXA Change-Id: Ie72db61fc5bc3064a29dc60417cba4b27980a643 --- helm-manager/Dockerfile | 7 +--- helm-manager/charts/templates/_service.tpl | 8 ---- helm-manager/charts/templates/deployment.yaml | 2 - helm-manager/charts/values.yaml | 21 ++++------ helm-manager/cm-repo.json | 6 +++ .../config/KubernetesParticipantConfig.json | 49 ---------------------- helm-manager/config/application.yaml | 37 ++++++++++++++-- helm-manager/helm-manager.yaml | 6 +-- helm-manager/pom.xml | 10 ----- helm-manager/simple-app.json | 14 ++++--- helm-manager/test.sh | 26 +++++++++--- 11 files changed, 82 insertions(+), 104 deletions(-) create mode 100644 helm-manager/cm-repo.json delete mode 100644 helm-manager/config/KubernetesParticipantConfig.json diff --git a/helm-manager/Dockerfile b/helm-manager/Dockerfile index 90164fd7..5e96b60f 100644 --- a/helm-manager/Dockerfile +++ b/helm-manager/Dockerfile @@ -40,13 +40,10 @@ RUN chmod +x ./kubectl RUN mv ./kubectl /usr/local/bin/kubectl -# Copy app config and app jar -WORKDIR /opt/app/helm-manager/src/main/resources/config - -COPY config/KubernetesParticipantConfig.json . +WORKDIR /etc/app/helm-manager COPY config/application.yaml . WORKDIR /opt/app/helm-manager COPY target/app.jar app.jar -CMD [ "java", "-jar", "app.jar" ] +CMD [ "java", "-jar", "app.jar", "--spring.config.location=optional:file:/etc/app/helm-manager/"] diff --git a/helm-manager/charts/templates/_service.tpl b/helm-manager/charts/templates/_service.tpl index 4c3cd7fc..04249945 100644 --- a/helm-manager/charts/templates/_service.tpl +++ b/helm-manager/charts/templates/_service.tpl @@ -23,12 +23,4 @@ protocol: TCP {{- end }} {{- end }} -{{- if .tls }} -{{if eq .tls.enabled true -}} -- name: {{ .name }}-tls - port: {{ .tls.servicePort }} - targetPort: {{ .tls.containerPort }} - protocol: TCP -{{- end }} -{{- end }} {{- end -}} \ No newline at end of file diff --git a/helm-manager/charts/templates/deployment.yaml b/helm-manager/charts/templates/deployment.yaml index 8296ca5f..d863bf65 100644 --- a/helm-manager/charts/templates/deployment.yaml +++ b/helm-manager/charts/templates/deployment.yaml @@ -39,8 +39,6 @@ spec: ports: - containerPort: {{ .Values.service.http.containerPort }} protocol: TCP - - containerPort: {{ .Values.service.tls.containerPort }} - protocol: TCP volumeMounts: - name: {{ template "helmmanager.name" . }}-pv mountPath: /var/helm-manager-service diff --git a/helm-manager/charts/values.yaml b/helm-manager/charts/values.yaml index c6459153..deb37d03 100644 --- a/helm-manager/charts/values.yaml +++ b/helm-manager/charts/values.yaml @@ -28,23 +28,16 @@ # ----------------------------------------------------------------------------- # Specify Helm Manager's Docker image and repository details here image: - registry: nexus3.o-ran-sc.org:10004 + registry: nexus3.o-ran-sc.org:10002 name: o-ran-sc/nonrtric-helm-manager - tag: "1.0.0" - pullPolicy: IfNotPresent + tag: "1.1.0" + pullPolicy: Always service: type: NodePort http: - # Enable plaintext HTTP call to the API - # Disabling this and using a TLS listen only is recommended for most configuration enabled: true - servicePort: 8080 - containerPort: 8080 - tls: - # Enable HTTPS listen for the API - enabled: true - servicePort: 8443 - containerPort: 8443 + servicePort: 8112 + containerPort: 8083 # ----------------------------------------------------------------------------- # Ingress Controller parameters @@ -73,7 +66,7 @@ replicaCount: 1 readinessProbe: httpGet: path: "/helm/charts" - port: 8080 + port: 8083 scheme: HTTP initialDelaySeconds: 60 timeoutSeconds: 5 @@ -85,7 +78,7 @@ readinessProbe: livenessProbe: httpGet: path: "/helm/charts" - port: 8080 + port: 8083 scheme: HTTP initialDelaySeconds: 60 timeoutSeconds: 5 diff --git a/helm-manager/cm-repo.json b/helm-manager/cm-repo.json new file mode 100644 index 00000000..3335e022 --- /dev/null +++ b/helm-manager/cm-repo.json @@ -0,0 +1,6 @@ +{ + "address" : "chartrepo.nonrtric", + "repoName": "cm", + "protocol": "http", + "port": "8080" +} \ No newline at end of file diff --git a/helm-manager/config/KubernetesParticipantConfig.json b/helm-manager/config/KubernetesParticipantConfig.json deleted file mode 100644 index 7eeb456d..00000000 --- a/helm-manager/config/KubernetesParticipantConfig.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "ControlLoopParticipantK8s", - "localChartDirectory": "/var/helm-manager/local-charts", - "infoFileName": "CHART_INFO.json", - - "intermediaryParameters":{ - "name":"Participant parameters", - "reportingTimeInterval":120000, - "description":"Participant Description", - "participantId":{ - "name":"K8sParticipant0", - "version":"1.0.0" - }, - "participantType":{ - "name":"org.onap.k8s.controlloop.K8SControlLoopParticipant", - "version":"2.3.4" - }, - "clampControlLoopTopics":{ - "topicSources":[ - - ], - "topicSinks":[ - { - "topic":"POLICY-CLRUNTIME-PARTICIPANT", - "servers":[ - "localhost" - ], - "topicCommInfrastructure":"dmaap" - }, - { - "topic":"POLICY-NOTIFICATION", - "servers":[ - "localhost" - ], - "topicCommInfrastructure":"dmaap" - } - ] - } - }, - "databaseProviderParameters":{ - "name":"PolicyProviderParameterGroup", - "implementation":"org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", - "databaseDriver":"org.mariadb.jdbc.Driver", - "databaseUrl":"jdbc:mariadb://localhost:3306/controlloop", - "databaseUser":"admin", - "databasePassword":"passme", - "persistenceUnit":"ToscaConceptTest" - } -} diff --git a/helm-manager/config/application.yaml b/helm-manager/config/application.yaml index 44de5098..5da6c530 100644 --- a/helm-manager/config/application.yaml +++ b/helm-manager/config/application.yaml @@ -18,9 +18,36 @@ spring: profiles: active: prod + security: + user: + name: helmadmin + password: itisasecret +security: + enable-csrf: false + participant: - file: src/main/resources/config/KubernetesParticipantConfig.json + localChartDirectory: /var/helm-manager-service + # This below is not used but need to be here to make the app work + infoFileName: CHART_INFO.json + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Dummy Description + participantId: + name: noname + version: 0.0.1 + participantType: + name: noname + version: 0.0.1 + clampControlLoopTopics: + topicSources: + topicSinks: + - + topic: NOTOPIC + servers: + - localhost + topicCommInfrastructure: dmaap + management: endpoints: web: @@ -29,7 +56,9 @@ management: server: # Configuration of the HTTP/REST server. The parameters are defined and handled by the springboot framework. # See springboot documentation. - http-port : 8083 + port: 8083 + servlet: + context-path: logging: # Configuration of logging @@ -38,5 +67,7 @@ logging: org.springframework: ERROR org.springframework.data: ERROR org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR + com.att.nsa.cambria.client.impl: OFF + com.att.nsa.apiClient.http: OFF file: - name: /var/log/helm-manager/application.log + name: /var/log/onap/policy/clamp/application.log diff --git a/helm-manager/helm-manager.yaml b/helm-manager/helm-manager.yaml index 5a3465c9..2dafed8e 100644 --- a/helm-manager/helm-manager.yaml +++ b/helm-manager/helm-manager.yaml @@ -26,7 +26,7 @@ spec: type: NodePort ports: - port: 8080 - targetPort: 8080 + targetPort: 8083 protocol: TCP name: http - port: 8443 @@ -49,11 +49,11 @@ spec: serviceAccountName: helm-manager-sa containers: - name: helmmanagerservice - image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-helm-manager:1.1.0-SNAPSHOT + image: nexus3.o-ran-sc.org:10002/o-ran-sc/nonrtric-helm-manager:1.1.0 imagePullPolicy: Always ports: - name: http - containerPort: 8080 + containerPort: 8083 - name: https containerPort: 8443 volumeMounts: diff --git a/helm-manager/pom.xml b/helm-manager/pom.xml index 7ca62919..5864f001 100644 --- a/helm-manager/pom.xml +++ b/helm-manager/pom.xml @@ -45,16 +45,6 @@ onap-releases https://nexus.onap.org/content/repositories/releases/ - - onap-snapshots - onap-snapshots - https://nexus.onap.org/content/repositories/snapshots/ - - - nordix - 39bf7eabe020-releases - https://artifactory.nordix.org/artifactory/onap-policy-clamp-participant-maven-local - diff --git a/helm-manager/simple-app.json b/helm-manager/simple-app.json index 27f73c84..ba9c826a 100644 --- a/helm-manager/simple-app.json +++ b/helm-manager/simple-app.json @@ -1,7 +1,11 @@ { - "releaseName": "simpleapp", - "chartName": "simple-app", - "version": "0.1.0", + "chartId": { + "name": "simple-app", + "version": "0.1.0" + }, "namespace": "ckhm", - "repository": "cm" -} \ No newline at end of file + "repository": { + "repoName": "cm" + }, + "releaseName": "simpleapp" + } \ No newline at end of file diff --git a/helm-manager/test.sh b/helm-manager/test.sh index 1b652bf2..89c79da1 100755 --- a/helm-manager/test.sh +++ b/helm-manager/test.sh @@ -34,6 +34,7 @@ APP_TGZ="simple-app-0.1.0.tgz" VALUES_YAML="simple-app-values.yaml" INFO_JSON="simple-app.json" INSTALL_JSON="simple-app-installation.json" +REPO_JSON="cm-repo.json" PORT="" HOST="" @@ -43,7 +44,12 @@ NAMESPACE="ckhm" #kube namespace for simple-app PROXY_TAG="" OK="All tests ok" - +USER=helmadmin +#USER="" +PWD=itisasecret +#PWD="" +PREFIX=/onap/k8sparticipant +PREFIX="" print_usage() { echo "usage: ./test.sh docker|(kube )" } @@ -51,7 +57,8 @@ if [ $# -eq 1 ]; then if [ $1 == "docker" ]; then PORT=8112 HOST="localhost" - URL="http://$HOST:$PORT" + URL="http://$USER:$PWD@$HOST:$PORT"$PREFIX + #URL="http://$HOST:$PORT"$PREFIX HM_PATH=$URL else print_usage @@ -61,7 +68,8 @@ elif [ $# -eq 2 ]; then if [ $1 == "kube" ]; then PORT=$(kubectl get svc helmmanagerservice -n nonrtric -o jsonpath='{...ports[?(@.name=="'http'")].nodePort}') HOST=$2 - URL="http://$HOST:$PORT" + URL="http://$USER:$PWD@$HOST:$PORT"$PREFIX + #URL="http://$HOST:$PORT"$PREFIX HM_PATH=$URL else print_usage @@ -113,10 +121,18 @@ run-curl $cmd echo +echo "================" +echo "Add repo" +echo "================" +cmd="/helm/repo -X POST -H Content-Type:application/json -d @$REPO_JSON" +run-curl $cmd +echo + + echo "============" echo "Onboard app" echo "===========" -cmd="/helm/charts -X POST -F chart=@$APP_TGZ -F values=@$VALUES_YAML -F info=<$INFO_JSON" +cmd="/helm/onboard/chart -X POST -F chart=@$APP_TGZ -F values=@$VALUES_YAML -F info=<$INFO_JSON" run-curl $cmd echo @@ -193,7 +209,7 @@ echo echo "============" echo "Delete chart" echo "===========" -cmd="/helm/charts/simple-app/0.1.0 -X DELETE" +cmd="/helm/chart/simple-app/0.1.0 -X DELETE" run-curl $cmd echo -- 2.16.6