diff options
Diffstat (limited to 'kubernetes/portal-ng')
32 files changed, 867 insertions, 12 deletions
diff --git a/kubernetes/portal-ng/Chart.yaml b/kubernetes/portal-ng/Chart.yaml index f3319df65f..32a45042b4 100644 --- a/kubernetes/portal-ng/Chart.yaml +++ b/kubernetes/portal-ng/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v2 description: ONAP Next Generation Portal name: portal-ng -version: 13.0.0 +version: 13.0.1 dependencies: - name: common @@ -24,6 +24,12 @@ dependencies: - name: portal-ng-bff version: ~13.x-0 repository: '@local' + - name: portal-ng-preferences + version: ~13.x-0 + repository: '@local' + - name: portal-ng-history + version: ~13.x-0 + repository: '@local' - name: portal-ng-ui version: ~13.x-0 repository: '@local' diff --git a/kubernetes/portal-ng/components/portal-ng-bff/Chart.yaml b/kubernetes/portal-ng/components/portal-ng-bff/Chart.yaml index ec9769d819..d925060b81 100644 --- a/kubernetes/portal-ng/components/portal-ng-bff/Chart.yaml +++ b/kubernetes/portal-ng/components/portal-ng-bff/Chart.yaml @@ -34,7 +34,7 @@ version: 13.0.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: latest +appVersion: 0.1.0 dependencies: - name: common diff --git a/kubernetes/portal-ng/components/portal-ng-bff/values.yaml b/kubernetes/portal-ng/components/portal-ng-bff/values.yaml index 660bbdc44c..b8b7c3d061 100644 --- a/kubernetes/portal-ng/components/portal-ng-bff/values.yaml +++ b/kubernetes/portal-ng/components/portal-ng-bff/values.yaml @@ -39,10 +39,11 @@ probes: failureThreshold: 4 env: - KEYCLOAK_URL: http://keycloak-http.keycloak + KEYCLOAK_URL: http://keycloakx-http.keycloak/auth KEYCLOAK_REALM: ONAP HISTORY_URL: http://portal-ng-history:9002 PREFERENCES_URL: http://portal-ng-preferences:9001 + TRACING_ENABLED: true COLLECTOR_HOST: jaeger-collector.istio-system COLLECTOR_PORT: 9411 diff --git a/kubernetes/portal-ng/components/portal-ng-history/.helmignore b/kubernetes/portal-ng/components/portal-ng-history/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/kubernetes/portal-ng/components/portal-ng-history/Chart.yaml b/kubernetes/portal-ng/components/portal-ng-history/Chart.yaml new file mode 100644 index 0000000000..4b62b5def2 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/Chart.yaml @@ -0,0 +1,51 @@ +# Copyright (C) 2022 Deutsche Telekom AG +# +# 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. + +apiVersion: v2 +name: portal-ng-history +description: Helm chart of the history. This micro service provides the latest user actions of the ONAP portal. + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 13.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: 0.1.1 + +dependencies: + - name: common + version: ~13.x-0 + repository: '@local' + - name: repositoryGenerator + version: ~13.x-0 + repository: '@local' + - name: serviceAccount + version: ~13.x-0 + repository: '@local' + - name: mongodb + version: ~14.12.x-0 + repository: '@local' diff --git a/kubernetes/portal-ng/components/portal-ng-history/README.md b/kubernetes/portal-ng/components/portal-ng-history/README.md new file mode 100644 index 0000000000..0c0e7b34bb --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/README.md @@ -0,0 +1,2 @@ +# History helm chart +This repository contains the chart for the history service.
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-history/templates/configmap.yaml b/kubernetes/portal-ng/components/portal-ng-history/templates/configmap.yaml new file mode 100644 index 0000000000..f8c23479e1 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/templates/configmap.yaml @@ -0,0 +1,24 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-configmap + namespace: {{ include "common.namespace" . }} +data: + {{- range $key, $val := .Values.env }} + {{ $key }}: {{ $val | quote }} + {{- end -}}
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-history/templates/deployment.yaml b/kubernetes/portal-ng/components/portal-ng-history/templates/deployment.yaml new file mode 100644 index 0000000000..a2a924b488 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/templates/deployment.yaml @@ -0,0 +1,48 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +apiVersion: apps/v1 +kind: Deployment +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} +spec: + selector: {{- include "common.selectors" . | nindent 4 }} + replicas: {{ .Values.replicaCount }} + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} + template: + metadata: {{- include "common.templateMetadata" . | nindent 6 }} + spec: + {{- include "common.imagePullSecrets" . | nindent 6 }} + containers: + - name: {{ .Chart.Name }} + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image.imageName }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + envFrom: + - configMapRef: + name: {{ include "common.fullname" . }}-configmap + - secretRef: + name: {{ include "common.fullname" . }}-secret + ports: {{ include "common.containerPorts" . | nindent 12 }} + livenessProbe: + httpGet: + path: /actuator/health/liveness + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} + failureThreshold: {{ .Values.probes.liveness.failureThreshold }} + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} + failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-history/templates/hpa.yaml b/kubernetes/portal-ng/components/portal-ng-history/templates/hpa.yaml new file mode 100644 index 0000000000..9ac9406eda --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/templates/hpa.yaml @@ -0,0 +1,47 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "common.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} + {{- end }} diff --git a/kubernetes/portal-ng/components/portal-ng-history/templates/secret.yaml b/kubernetes/portal-ng/components/portal-ng-history/templates/secret.yaml new file mode 100644 index 0000000000..9fee578d43 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/templates/secret.yaml @@ -0,0 +1,25 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }}-secret + namespace: {{ include "common.namespace" . }} +type: Opaque +data: + {{- range $key, $val := .Values.secretEnv }} + {{ $key }}: {{ $val | b64enc | quote }} + {{- end -}}
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-history/templates/service.yaml b/kubernetes/portal-ng/components/portal-ng-history/templates/service.yaml new file mode 100644 index 0000000000..301d358c3b --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/templates/service.yaml @@ -0,0 +1,17 @@ +{{/* +# Copyright © 2023 Deutsche Telekom +# +# 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. +*/}} + +{{ include "common.service" . }} diff --git a/kubernetes/portal-ng/components/portal-ng-history/templates/tests/test-connection.yaml b/kubernetes/portal-ng/components/portal-ng-history/templates/tests/test-connection.yaml new file mode 100644 index 0000000000..327df40ef6 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/templates/tests/test-connection.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "common.fullname" . }}-test-connection + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "common.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/kubernetes/portal-ng/components/portal-ng-history/values.yaml b/kubernetes/portal-ng/components/portal-ng-history/values.yaml new file mode 100644 index 0000000000..dc999841ef --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-history/values.yaml @@ -0,0 +1,81 @@ +global: {} + +image: + imageName: onap/portal-ng/history + pullPolicy: Always + # Overrides the image tag whose default value is the chart appVersion. + # tag: 0.1.0 + +replicaCount: 1 + +# Specifies how many old replicas will be retained in a deployment +revisionHistoryLimit: 2 + +imagePullSecrets: + - name: onap-docker-registry-key +nameOverride: "" +fullnameOverride: "" + +# Custom selector label (for bigger namespaces with other components) +partOf: portal + +service: + type: ClusterIP + port: 9002 + ports: + - name: http + port: 9002 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 5 + targetCPUUtilizationPercentage: 80 + +probes: + readiness: + initialDelaySeconds: 20 + failureThreshold: 4 + liveness: + initialDelaySeconds: 20 + failureThreshold: 4 + +secretEnv: + MONGO_USERNAME: dbuser + MONGO_PASSWORD: dbpassword + MONGO_DATABASE: history + +env: + KEYCLOAK_URL: http://keycloakx-http.keycloak + KEYCLOAK_REALM: ONAP + MONGO_HOST: history-mongodb + MONGO_PORT: 27017 + TRACING_ENABLED: true + COLLECTOR_HOST: jaeger-collector.istio-system + COLLECTOR_PORT: 9411 + +mongodb: + nameOverride: history-mongodb + service: + portName: tcp-mongodb + auth: + rootPassword: TrWAweN9y9eW + usernames: + - dbuser + passwords: + - dbpassword + databases: + - history + resources: + limits: + cpu: "2" + memory: "2Gi" + requests: + cpu: "250m" + memory: "500Mi" + +#Pods Service Account +serviceAccount: + nameOverride: portal-ng-history + roles: + - read diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/.helmignore b/kubernetes/portal-ng/components/portal-ng-preferences/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/Chart.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/Chart.yaml new file mode 100644 index 0000000000..96088586fc --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/Chart.yaml @@ -0,0 +1,53 @@ +# Copyright (C) 2024 Deutsche Telekom AG +# +# 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. + +apiVersion: v2 +name: portal-ng-preferences +description: Helm chart of the preferences. This micro service provides the user preferences for the ONAP portal. + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 13.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: 0.1.1 + +dependencies: + - name: common + version: ~13.x-0 + repository: '@local' + - name: repositoryGenerator + version: ~13.x-0 + repository: '@local' + - name: serviceAccount + version: ~13.x-0 + repository: '@local' + - name: mongodb + version: ~14.12.x-0 + repository: '@local' + + diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/README.md b/kubernetes/portal-ng/components/portal-ng-preferences/README.md new file mode 100644 index 0000000000..4ae034609d --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/README.md @@ -0,0 +1,2 @@ +# Preferences helm chart +This repository contains the chart for the preferences service.
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/templates/configmap.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/templates/configmap.yaml new file mode 100644 index 0000000000..f8c23479e1 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/templates/configmap.yaml @@ -0,0 +1,24 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-configmap + namespace: {{ include "common.namespace" . }} +data: + {{- range $key, $val := .Values.env }} + {{ $key }}: {{ $val | quote }} + {{- end -}}
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/templates/deployment.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/templates/deployment.yaml new file mode 100644 index 0000000000..a2a924b488 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/templates/deployment.yaml @@ -0,0 +1,48 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +apiVersion: apps/v1 +kind: Deployment +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} +spec: + selector: {{- include "common.selectors" . | nindent 4 }} + replicas: {{ .Values.replicaCount }} + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} + template: + metadata: {{- include "common.templateMetadata" . | nindent 6 }} + spec: + {{- include "common.imagePullSecrets" . | nindent 6 }} + containers: + - name: {{ .Chart.Name }} + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image.imageName }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + envFrom: + - configMapRef: + name: {{ include "common.fullname" . }}-configmap + - secretRef: + name: {{ include "common.fullname" . }}-secret + ports: {{ include "common.containerPorts" . | nindent 12 }} + livenessProbe: + httpGet: + path: /actuator/health/liveness + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} + failureThreshold: {{ .Values.probes.liveness.failureThreshold }} + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} + failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/templates/hpa.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/templates/hpa.yaml new file mode 100644 index 0000000000..9ac9406eda --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/templates/hpa.yaml @@ -0,0 +1,47 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "common.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} + {{- end }} diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/templates/secret.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/templates/secret.yaml new file mode 100644 index 0000000000..90c67ee74a --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/templates/secret.yaml @@ -0,0 +1,25 @@ +{{/* +# Copyright © 2024 Deutsche Telekom AG. +# +# 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. +*/}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }}-secret + namespace: {{ include "common.namespace" . }} +type: Opaque +data: + {{- range $key, $val := .Values.secretEnv }} + {{ $key }}: {{ $val | b64enc | quote }} + {{- end -}}
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/templates/service.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/templates/service.yaml new file mode 100644 index 0000000000..3639dace48 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/templates/service.yaml @@ -0,0 +1,17 @@ +{{/* +# Copyright © 2024 Deutsche Telekom. +# +# 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. +*/}} + +{{ include "common.service" . }} diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/templates/tests/test-connection.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/templates/tests/test-connection.yaml new file mode 100644 index 0000000000..327df40ef6 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/templates/tests/test-connection.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "common.fullname" . }}-test-connection + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "common.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/kubernetes/portal-ng/components/portal-ng-preferences/values.yaml b/kubernetes/portal-ng/components/portal-ng-preferences/values.yaml new file mode 100644 index 0000000000..2f6d1bae78 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-preferences/values.yaml @@ -0,0 +1,82 @@ +global: {} + +# Default values for preferences. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +image: + imageName: onap/portal-ng/preferences + pullPolicy: Always + # Overrides the image tag whose default value is the chart appVersion. + # tag: 0.1.0 + +replicaCount: 1 + +# Specifies how many old replicas will be retained in a deployment +revisionHistoryLimit: 2 + +nameOverride: "" +fullnameOverride: "" + +# Custom selector label (for bigger namespaces with other components) +partOf: portal + +service: + type: ClusterIP + port: 9001 + ports: + - name: http + port: 9001 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 5 + targetCPUUtilizationPercentage: 80 + +probes: + readiness: + initialDelaySeconds: 20 + failureThreshold: 4 + liveness: + initialDelaySeconds: 20 + failureThreshold: 4 + +secretEnv: + MONGO_USERNAME: dbuser + MONGO_PASSWORD: dbpassword + MONGO_DATABASE: Preferences + +env: + KEYCLOAK_URL: http://keycloakx-http.keycloak + KEYCLOAK_REALM: ONAP + MONGO_HOST: preferences-mongodb + MONGO_PORT: 27017 + TRACING_ENABLED: true + COLLECTOR_HOST: jaeger-collector.istio-system + COLLECTOR_PORT: 9411 + +mongodb: + nameOverride: preferences-mongodb + service: + portName: tcp-mongodb + auth: + rootPassword: TrWAweN9y9eW + usernames: + - dbuser + passwords: + - dbpassword + databases: + - Preferences + resources: + limits: + cpu: "2" + memory: "2Gi" + requests: + cpu: "250m" + memory: "500Mi" + +#Pods Service Account +serviceAccount: + nameOverride: portal-ng-preferences + roles: + - read diff --git a/kubernetes/portal-ng/components/portal-ng-ui/Chart.yaml b/kubernetes/portal-ng/components/portal-ng-ui/Chart.yaml index 4dcb25cc3a..09178d9694 100644 --- a/kubernetes/portal-ng/components/portal-ng-ui/Chart.yaml +++ b/kubernetes/portal-ng/components/portal-ng-ui/Chart.yaml @@ -34,7 +34,7 @@ version: 13.0.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: latest +appVersion: 0.1.0 dependencies: - name: common diff --git a/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/env.js b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/env.js new file mode 100644 index 0000000000..2e21ca50d0 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/env.js @@ -0,0 +1,11 @@ +(function(window) { + window["env"] = window["env"] || {}; + window["env"]["keycloak"] = window["env"]["keycloak"] || {}; + + // Environment variables + window["env"]["customStyleEnabled"] = "{{ .Values.env.CUSTOM_STYLE_ENABLED }}"; + window["env"]["keycloak"]["hostname"] = "{{ .Values.env.KEYCLOAK_HOSTNAME }}"; + window["env"]["keycloak"]["realm"] = "{{ .Values.env.KEYCLOAK_REALM }}"; + window['env']['keycloak']['clientId'] = '{{ .Values.env.KEYCLOAK_CLIENT_ID }}'; + window["env"]["loggingEnabled"]= '{{ .Values.env.LOGGING_ENABLED }}'; +})(this); diff --git a/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/version.json b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/version.json new file mode 100644 index 0000000000..4f56a1f070 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/version.json @@ -0,0 +1,3 @@ +{ + "number": "{{ .Values.image.tag | default .Chart.AppVersion }}" +} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/resources/default.conf b/kubernetes/portal-ng/components/portal-ng-ui/resources/default.conf new file mode 100644 index 0000000000..d448e278d5 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/resources/default.conf @@ -0,0 +1,48 @@ +resolver {{ .Values.env.CLUSTER_NAMESERVER_IP }}; +server { + listen {{ .Values.env.NGINX_PORT }}; + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html =404; + } + location /api/ { + set $upstream {{ .Values.env.BFF_URL }}; + rewrite /api/(.*) /$1 break; + add_header Access-Control-Allow-Origin *; + proxy_pass $upstream/$1$is_args$args; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_http_version 1.1; + } + location /auth/ { + set $upstream {{ .Values.env.KEYCLOAK_INTERNAL_URL }}; + rewrite /auth/(.*) /$1 break; + add_header Access-Control-Allow-Origin *; + proxy_pass $upstream/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Proto $scheme; + } +} +## +# Gzip Settings +## +gzip on; +gzip_vary on; +gzip_proxied any; +gzip_min_length 1100; +gzip_comp_level 6; +gzip_buffers 16 8k; +gzip_http_version 1.1; +gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-env-js.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-env-js.yaml new file mode 100644 index 0000000000..e2244bd768 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-env-js.yaml @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2024 Deutsche Telekom +# +# 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. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-env-js + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/assets/env.js").AsConfig . | nindent 2 }} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-nginx-config.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-nginx-config.yaml new file mode 100644 index 0000000000..f8e560b908 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-nginx-config.yaml @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2024 Deutsche Telekom +# +# 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. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-nginx-config + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/default.conf").AsConfig . | nindent 2 }} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-version-json.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-version-json.yaml new file mode 100644 index 0000000000..79182a4e51 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-version-json.yaml @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2024 Deutsche Telekom +# +# 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. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-version-json + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/assets/version.json").AsConfig . | nindent 2 }} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml index 96f21f80e9..a06f87b5ba 100644 --- a/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml @@ -36,13 +36,13 @@ spec: livenessProbe: httpGet: path: / - port: http + port: {{ .Values.service.internalPort}} initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} failureThreshold: {{ .Values.probes.liveness.failureThreshold }} readinessProbe: httpGet: path: / - port: http + port: {{ .Values.service.internalPort}} initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} failureThreshold: {{ .Values.probes.readiness.failureThreshold }} volumeMounts: @@ -53,6 +53,22 @@ spec: mountPath: {{ .Values.nginx.tilesPath }} subPath: tiles.json readOnly: true + - name: nginx-config + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + readOnly: true + - name: env-js + mountPath: /usr/share/nginx/html/assets/env.js + subPath: env.js + readOnly: true + - name: version-json + mountPath: /usr/share/nginx/html/assets/version.json + subPath: version.json + readOnly: true + - name: tmp-volume + mountPath: /tmp + - name: nginx-cache-volume + mountPath: /var/cache/nginx resources: {{ include "common.resources" . | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: @@ -76,3 +92,18 @@ spec: items: - key: tiles.json path: tiles.json + - name: nginx-config + configMap: + name: {{ include "common.fullname" . }}-nginx-config + - name: env-js + configMap: + name: {{ include "common.fullname" . }}-env-js + - name: version-json + configMap: + name: {{ include "common.fullname" . }}-version-json + - name: tmp-volume + emptyDir: + sizeLimit: 64Mi + - name: nginx-cache-volume + emptyDir: + sizeLimit: 64Mi diff --git a/kubernetes/portal-ng/components/portal-ng-ui/values.yaml b/kubernetes/portal-ng/components/portal-ng-ui/values.yaml index c213bcf0b1..7e154afae2 100644 --- a/kubernetes/portal-ng/components/portal-ng-ui/values.yaml +++ b/kubernetes/portal-ng/components/portal-ng-ui/values.yaml @@ -46,10 +46,11 @@ partOf: portal service: type: ClusterIP - port: 80 + internalPort: 8080 ports: - name: http port: 80 + port_protocol: http ingress: enabled: true @@ -84,12 +85,11 @@ affinity: {} env: BFF_URL: http://portal-ng-bff.onap.svc.cluster.local:9080 - NGINX_PORT: 80 + NGINX_PORT: 8080 KEYCLOAK_REALM: ONAP - KEYCLOAK_INTERNAL_URL: http://keycloak-http.keycloak.svc.cluster.local -# CLUSTER_NAMESERVER_IP address is needed in the openresty lua part of the nginx, because Lua don't find the nameserver without this setting. -# The IP will be used in the nginx / Lua setting for the resolver. You can get this value from /etc/resolver - CLUSTER_NAMESERVER_IP: 169.254.25.10 + KEYCLOAK_INTERNAL_URL: http://keycloakx-http.keycloak.svc.cluster.local + KEYCLOAK_HOSTNAME: https://keycloak-ui.simpledemo.onap.org + CLUSTER_NAMESERVER_IP: 1.2.3.4 #Pods Service Account serviceAccount: |