File tree Expand file tree Collapse file tree 5 files changed +34
-3
lines changed Expand file tree Collapse file tree 5 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ longest resource name ("db-migrator-install" = 19 chars).
7878Provide an init container to verify the database is accessible 
7979*/}  }
8080{ {- define " chart.checkDbIsReadyInitContainer"   -}  }
81+ { {- $securityContext   := default  (dict) .Values.checkDbIsReadyInitContainer.securityContext }  }
8182name: check-db-ready
8283{ { if  .Values.postgresql.image.registry -}  }
8384image: { { .Values.postgresql.image.registry }  }/{ { .Values.postgresql.image.repository }  }:{ { .Values.postgresql.image.tag }  }
9293    value: "{ { .Values.db.port }  }"
9394  - name: PGUSER
9495    value: "{ { .Values.db.user }  }"
96+ { {- if  $securityContext   }  }
97+ securityContext:{ {- toYaml $securityContext   | nindent 2 }  }
98+ { {- else  }  }
99+ securityContext: { } 
100+ { {- end }  }
95101command: ['sh', '-c', 'until pg_isready; do echo waiting for database; sleep 2; done;']
96102{ {- end -}  }
97103
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ metadata:
1313spec :
1414  template :
1515    spec :
16+     {{- with .Values.dbmigrator.job.podSecurityContext }} 
17+       securityContext :
18+         {{- toYaml . | nindent 8 }} 
19+     {{- end }} 
1620    {{- with .Values.imagePullSecrets }} 
1721      imagePullSecrets :
1822        {{- toYaml . | nindent 8 }} 
2428        - name : dbmigrator 
2529          image : {{ .Values.dbmigrator.job.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }} 
2630          imagePullPolicy : {{ .Values.pullPolicy }} 
31+           {{- with .Values.dbmigrator.job.containerSecurityContext }} 
32+           securityContext :
33+             {{- toYaml . | nindent 12 }} 
34+           {{- end }} 
2735          env :
2836            - name : TERN_CONF 
2937              value : {{ .Values.configDir }}/tern.conf 
Original file line number Diff line number Diff line change 1717        app.kubernetes.io/component : server 
1818        {{- include "chart.selectorLabels" . | nindent 8 }} 
1919    spec :
20+     {{- with .Values.server.deploy.podSecurityContext }} 
21+       securityContext :
22+         {{- toYaml . | nindent 8 }} 
23+     {{- end }} 
2024    {{- with .Values.imagePullSecrets }} 
2125      imagePullSecrets :
2226        {{- toYaml . | nindent 8 }} 
3842        - name : server 
3943          image : {{ .Values.server.deploy.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }} 
4044          imagePullPolicy : {{ .Values.pullPolicy }} 
45+           {{- with .Values.server.deploy.containerSecurityContext }} 
46+           securityContext :
47+             {{- toYaml . | nindent 12 }} 
48+           {{- end }} 
4149          volumeMounts :
4250            - name : server-config 
4351              mountPath : {{ .Values.configDir | quote }} 
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ fullnameOverride: ""
1818#  Directory path where the configuration files should be mounted
1919configDir : " /home/ocg/.config/ocg" 
2020
21+ #  Check database readiness init container configuration
22+ checkDbIsReadyInitContainer :
23+   securityContext : {} 
24+ 
2125#  Database configuration
2226db :
2327  host : " " 
5357#  Database migrator configuration
5458dbmigrator :
5559  job :
60+     containerSecurityContext : {} 
5661    image :
5762      #  Database migrator image repository (without the tag)
5863      repository : ocg/dbmigrator 
64+     podSecurityContext : {} 
5965
6066#  Server configuration
6167server :
@@ -137,10 +143,12 @@ server:
137143
138144  #  Deployment configuration
139145  deploy :
140-     replicaCount :  1 
146+     containerSecurityContext :  {} 
141147    image :
142148      #  Database migrator image repository (without the tag)
143149      repository : ocg/server 
150+     podSecurityContext : {} 
151+     replicaCount : 1 
144152    resources : {} 
145153
146154#  PostgreSQL configuration
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33#  Database configuration
4- export  PGHOST=" ${PGHOST:- localhost } " 
4+ export  PGHOST=" ${PGHOST:-/  private / tmp } " 
55export  PGPORT=" ${PGPORT:- 5432} " 
66export  PGUSER=" ${PGUSER:- postgres} " 
77export  PGDATABASE=" ${PGDATABASE:- ocg_tests} " 
88export  PGSSLMODE=" ${PGSSLMODE:- disable} " 
99
1010#  Prepare tern config file
11- tern_config=$( mktemp /tmp/tern.conf.XXXXXX) 
11+ export  TERN_CONF_TESTS_PATH=" ${TERN_CONF_TESTS_PATH:-/ tmp/ ocg/ tern.conf.XXXXXX} " 
12+ tern_config=$( mktemp $TERN_CONF_TESTS_PATH ) 
1213cat >  " $tern_config "   << EOF 
1314[database] 
1415host=$PGHOST  
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments