diff --git a/.github/workflows/on-pr-main.yml b/.github/workflows/on-pr-main.yml index a021152..65cb274 100644 --- a/.github/workflows/on-pr-main.yml +++ b/.github/workflows/on-pr-main.yml @@ -57,6 +57,7 @@ jobs: needs: - builds runs-on: ubuntu-22.04 + environment: test steps: - uses: actions/checkout@v3 - name: Deploy to OpenShift @@ -70,4 +71,4 @@ jobs: oc project ${{ vars.oc_namespace }} # Deploy Helm Chart - helm upgrade --install --wait --atomic nr-oracle-service-${{ github.event.number }} --set nameOverride=nr-oracle-service-${{ github.event.number }} --set image.tag=pr-${{ github.event.number }} --set app.envs.DB_HOST=${{ secrets.DB_HOST }} --set app.envs.DB_NAME=${{ secrets.DB_NAME }} --set app.envs.DB_PASSWORD=${{ secrets.DB_PASSWORD }} --set app.envs.DB_USER=${{ secrets.DB_USER }} --set image.repository=ghcr.io/${{ github.repository }}/nr-oracle-service --set image.repositoryInit=ghcr.io/${{ github.repository }}/nr-oracle-service-init --set namespace=${{ vars.oc_namespace }} --timeout 10m charts/nr-oracle-service --debug + helm upgrade --install --wait --atomic nr-oracle-service-${{ github.event.number }} --set nameOverride=nr-oracle-service-${{ github.event.number }} --set image.tag=pr-${{ github.event.number }} --set app.envs.DB_HOST=${{ secrets.DB_HOST }} --set app.envs.DB_NAME=${{ secrets.DB_NAME }} --set app.envs.DB_PASSWORD=${{ secrets.DB_PWD }} --set app.envs.DB_USER=${{ secrets.DB_USER }} --set app.envs.DB_PORT=${{ secrets.DB_PORT }} --set app.envs.CMAN_CERT=${{ secrets.CMAN_CERT }} --set image.repository=ghcr.io/${{ github.repository }}/nr-oracle-service --set image.repositoryInit=ghcr.io/${{ github.repository }}/nr-oracle-service-init --set namespace=${{ vars.oc_namespace }} --timeout 10m charts/nr-oracle-service --debug diff --git a/.gitignore b/.gitignore index 8c7863e..126b357 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ nb-configuration.xml # Plugin directory /.quarkus/cli/plugins/ +cman_certificate.crt diff --git a/charts/nr-oracle-service/templates/deployment.yaml b/charts/nr-oracle-service/templates/deployment.yaml index a0265e9..a2fc168 100644 --- a/charts/nr-oracle-service/templates/deployment.yaml +++ b/charts/nr-oracle-service/templates/deployment.yaml @@ -3,14 +3,14 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "component.name" . }} - labels: + labels: {{- include "component.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: - matchLabels: + matchLabels: {{- include "component.selectorLabels" . | nindent 6 }} template: metadata: @@ -45,7 +45,10 @@ spec: key: certSecret name: {{ include "component.name" . }} - name: DB_PORT - value: "1543" + valueFrom: + secretKeyRef: + key: dbPort + name: {{ include "component.name" . }} volumeMounts: - name: {{ include "component.name" . }} mountPath: /app/cert @@ -100,7 +103,10 @@ spec: key: apiKey name: {{ include "component.name" . }} - name: DB_PORT - value: '1543' + valueFrom: + secretKeyRef: + key: dbPort + name: {{ include "component.name" . }} - name: CERT_SECRET valueFrom: secretKeyRef: @@ -122,4 +128,4 @@ spec: value: {{ required "A valid .Values.app.envs.POOL_LEAK_DETECTION_INTERVAL entry required!" .Values.app.envs.POOL_LEAK_DETECTION_INTERVAL | quote }} volumeMounts: - name: {{ include "component.name" . }} - mountPath: /app/cert \ No newline at end of file + mountPath: /app/cert diff --git a/charts/nr-oracle-service/templates/secret.yaml b/charts/nr-oracle-service/templates/secret.yaml index 8a00dd8..d445626 100644 --- a/charts/nr-oracle-service/templates/secret.yaml +++ b/charts/nr-oracle-service/templates/secret.yaml @@ -3,7 +3,7 @@ {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace $secretName) | default dict }} {{- $secretData := (get $secretObj "data") | default dict }} # set below to existing secret data or generate a random one when not exists -{{- $certSecret := (get $secretData "certSecret") | default (randAlpha 10 | lower | b64enc) }} +{{- $certSecret := (get $secretData "certSecret") | default (randAlpha 10 | lower | b64enc) }} {{- $apiKey := (get $secretData "apiKey") | default (randAlphaNum 32 | b64enc) }} --- apiVersion: v1 @@ -15,6 +15,8 @@ data: dbUser: {{ .Values.app.envs.DB_USER | b64enc | quote }} dbPassword: {{ .Values.app.envs.DB_PASSWORD | b64enc | quote }} dbHost: {{ .Values.app.envs.DB_HOST | b64enc | quote }} + dbPort: {{ .Values.app.envs.DB_PORT | b64enc | quote }} dbName: {{ .Values.app.envs.DB_NAME | b64enc | quote }} certSecret: {{ $certSecret | quote }} # cert secret is reused. apiKey: {{ $apiKey | quote }} + cmanCert: {{ .Values.app.envs.CMAN_CERT | b64enc | quote }} diff --git a/charts/nr-oracle-service/values.yaml b/charts/nr-oracle-service/values.yaml index fd469ff..54315fa 100644 --- a/charts/nr-oracle-service/values.yaml +++ b/charts/nr-oracle-service/values.yaml @@ -72,9 +72,11 @@ affinity: {} app: envs: DB_HOST: ~ + DB_PORT: ~ DB_NAME: ~ DB_PASSWORD: ~ DB_USER: ~ + CMAN_CERT: ~ HTTP_PORT: "3000" POOL_IDLE_TIMEOUT: "60000" POOL_INITIAL_SIZE: "1"