-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update configmap and add staging config (#1776)
- Loading branch information
1 parent
176648f
commit f5239aa
Showing
5 changed files
with
224 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
openshift-v4/templates/knp/knp-test-allow-postgresql-staging-accept-backend.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
labels: | ||
template: tfrs-network-policy | ||
metadata: | ||
name: tfrs-network-policy | ||
objects: | ||
- apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-postgresql-staging-accepts-backend | ||
spec: | ||
## Allow minio to accept communication from nagios | ||
podSelector: | ||
matchLabels: | ||
name: postgresql10 | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
name: tfrs-backend-test | ||
ports: | ||
- protocol: TCP | ||
port: 5432 | ||
- apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-postgresql-staging-accepts-backendmid | ||
spec: | ||
## Allow patroni to accept communications from backend mid lifecycle pod | ||
podSelector: | ||
matchLabels: | ||
name: postgresql10 | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
openshift.io/deployer-pod.type: hook-mid | ||
ports: | ||
- protocol: TCP | ||
port: 5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
The instructions here are to create postgresql staging database and deploy on Test | ||
|
||
1. Create staging secrets | ||
|
||
2. Deploy staging database, pvcs and services. | ||
|
153 changes: 153 additions & 0 deletions
153
openshift-v4/templates/postgresql-staging/postgresql-dc.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
--- | ||
kind: Template | ||
apiVersion: v1 | ||
labels: | ||
template: tfrs-postgresql-persistent-template | ||
metadata: | ||
name: postgresql-dc | ||
creationTimestamp: | ||
objects: | ||
- kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: postgresql | ||
annotations: | ||
template.openshift.io/expose-uri: postgres://{.spec.clusterIP}:{.spec.ports[?(.name=="postgresql")].port} | ||
spec: | ||
ports: | ||
- name: postgresql | ||
protocol: TCP | ||
port: 5432 | ||
targetPort: 5432 | ||
selector: | ||
name: postgresql10 | ||
type: ClusterIP | ||
sessionAffinity: None | ||
status: | ||
loadBalancer: {} | ||
- apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: postgresql10 | ||
annotations: | ||
volume.beta.kubernetes.io/storage-class: netapp-block-standard | ||
template.openshift.io.bcgov/create: 'true' | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
- apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: postgresql10-backup | ||
annotations: | ||
volume.beta.kubernetes.io/storage-class: netapp-file-standard | ||
template.openshift.io.bcgov/create: 'true' | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
- kind: DeploymentConfig | ||
apiVersion: v1 | ||
metadata: | ||
annotations: | ||
template.alpha.openshift.io/wait-for-ready: 'true' | ||
name: postgresql10 | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
triggers: | ||
- type: ImageChange | ||
imageChangeParams: | ||
automatic: true | ||
containerNames: | ||
- postgresql10 | ||
from: | ||
kind: ImageStreamTag | ||
namespace: openshift | ||
name: postgresql:10 | ||
- type: ConfigChange | ||
test: false | ||
selector: | ||
name: postgresql10 | ||
template: | ||
metadata: | ||
creationTimestamp: | ||
labels: | ||
name: postgresql10 | ||
spec: | ||
volumes: | ||
- name: postgresql-data | ||
persistentVolumeClaim: | ||
claimName: postgresql10 | ||
- name: postgresql-backup | ||
persistentVolumeClaim: | ||
claimName: postgresql10-backup | ||
containers: | ||
- name: postgresql10 | ||
image: " " | ||
ports: | ||
- containerPort: 5432 | ||
protocol: TCP | ||
env: | ||
- name: POSTGRESQL_DATABASE | ||
value: tfrs | ||
- name: POSTGRESQL_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: tfrs-postgresql-staging | ||
key: app-db-username | ||
- name: POSTGRESQL_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: tfrs-postgresql-staging | ||
key: app-db-password | ||
resources: | ||
request: | ||
cpu: 300m | ||
memory: 500Mi | ||
limits: | ||
cpu: 500m | ||
memory: 1Gi | ||
volumeMounts: | ||
- name: postgresql-data | ||
mountPath: "/var/lib/pgsql/data" | ||
- name: postgresql-backup | ||
mountPath: "/postgresql-backup" | ||
livenessProbe: | ||
tcpSocket: | ||
port: 5432 | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 1 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
failureThreshold: 3 | ||
readinessProbe: | ||
exec: | ||
command: | ||
- "/bin/sh" | ||
- "-i" | ||
- "-c" | ||
- psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d tfrs -c 'SELECT 1' | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 1 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
failureThreshold: 3 | ||
terminationMessagePath: "/dev/termination-log" | ||
terminationMessagePolicy: File | ||
imagePullPolicy: IfNotPresent | ||
securityContext: | ||
capabilities: {} | ||
privileged: false | ||
restartPolicy: Always | ||
terminationGracePeriodSeconds: 30 | ||
dnsPolicy: ClusterFirst | ||
securityContext: {} | ||
schedulerName: default-scheduler | ||
status: {} |
20 changes: 20 additions & 0 deletions
20
openshift-v4/templates/postgresql-staging/postgresql-staging-secret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
metadata: | ||
annotations: | ||
description: |- | ||
postgresql10 staging database | ||
objects: | ||
# move ServiceAccount and Role to here, otherwise image pulled may fail because ServiceAccount hasn't been created | ||
- apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: tfrs-postgresql-staging | ||
stringData: | ||
replication-username: <from prod> | ||
replication-password: <from prod> | ||
superuser-username: <from prod> | ||
superuser-password: <from prod> | ||
app-db-name: <from prod> | ||
app-db-username: <from prod> | ||
app-db-password: <from prod> |