Skip to content

Instantly share code, notes, and snippets.

@xcoulon
Last active February 17, 2022 19:25
Show Gist options
  • Save xcoulon/bf0b09de5a21559a9a1ec6118ba5e79c to your computer and use it in GitHub Desktop.
Save xcoulon/bf0b09de5a21559a9a1ec6118ba5e79c to your computer and use it in GitHub Desktop.
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: webapp
spec:
template:
metadata:
labels:
app: webapp
spec:
volumes:
- name: config-volume
configMap:
name: app-config
initContainers:
- name: check-db-ready
image: postgres:9.6.5
command: ['sh', '-c',
'until pg_isready -h postgres -p 5432;
do echo waiting for database; sleep 2; done;']
containers:
- image: xcoulon/go-url-shortener:0.2.0
name: go-url-shortener
volumeMounts:
- name: config-volume
mountPath: /etc/config
ports:
- containerPort: 8080
env:
- name: CONFIG_FILE
value: /etc/config/config.yaml
- name: POSTGRES_HOST
value: postgres
- name: POSTGRES_PORT
value: "5432"
- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: database-secret-config
key: dbname
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: database-secret-config
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: database-secret-config
key: password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment