Skip to content

Commit

Permalink
CMAN poc.
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp committed Oct 13, 2023
1 parent 53b8365 commit 20374ac
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/on-pr-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
needs:
- builds
runs-on: ubuntu-22.04
environment: test
steps:
- uses: actions/checkout@v3
- name: Deploy to OpenShift
Expand All @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ nb-configuration.xml

# Plugin directory
/.quarkus/cli/plugins/
cman_certificate.crt
16 changes: 11 additions & 5 deletions charts/nr-oracle-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
mountPath: /app/cert
4 changes: 3 additions & 1 deletion charts/nr-oracle-service/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
2 changes: 2 additions & 0 deletions charts/nr-oracle-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 20374ac

Please sign in to comment.