Skip to content

Commit 22ae609

Browse files
author
Brad Barnes
committed
Anti-affinity and Creds from k8s secrets
1 parent 3dcd7d8 commit 22ae609

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

connectors/postgres/k8s-docs/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,22 @@ The final link is the environment variable that instructs Redis Connect to use t
127127

128128
## 4. Configure the Redis Connect Deployment Manifests
129129

130-
Update both the `redis-connect-postgres-stage.yaml` and `redis-connect-postgres-start.yaml` to map the appropriate environment variables in the `env:` section. Notable, the `REDISCONNECT_SOURCE_USERNAME`, `REDISCONNECT_SOURCE_PASSWORD`, `REDISCONNECT_TARGET_USERNAME` and `REDISCONNECT_TARGET_PASSWORD`.
130+
Update both the `redis-connect-postgres-stage.yaml` and `redis-connect-postgres-start.yaml` to map the appropriate environment variables in the `env:` section. Notable, the `REDISCONNECT_SOURCE_USERNAME`, `REDISCONNECT_SOURCE_PASSWORD`, `REDISCONNECT_TARGET_USERNAME` and `REDISCONNECT_TARGET_PASSWORD`.
131+
132+
Examples are provided to populate environment variables from the manifest/yaml, from configmap, and from k8s secrets for sensitive info such as credentials:
133+
134+
```
135+
- name: REDISCONNECT_SOURCE_PASSWORD
136+
value: admin123
137+
# valueFrom:
138+
# configMapKeyRef:
139+
# key: REDISCONNECT_SOURCE_PASSWORD
140+
# name: redis-connect-postgres-config
141+
# valueFrom:
142+
# secretKeyRef:
143+
# key: password
144+
# name: redis-connect-secret
145+
```
131146

132147
## 5. Stage the Redis Connect Job
133148

connectors/postgres/k8s-docs/redis-connect-postgres-stage.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
containers:
1616
- name: redis-connect-postgres # Container name
1717
image: redislabs/redis-connect-postgres:pre-release-alpine #repo/image:tag
18-
# #### comment out the following two lines for troubleshooting
18+
# #### uncomment the following two lines for troubleshooting
1919
# command: [ "/bin/bash", "-c", "--" ]
2020
# args: [ "while true; do sleep 30; done;" ]
2121
# ####
@@ -62,12 +62,20 @@ spec:
6262
# configMapKeyRef:
6363
# key: REDISCONNECT_SOURCE_USERNAME
6464
# name: redis-connect-postgres-config
65+
# valueFrom:
66+
# secretKeyRef:
67+
# key: username
68+
# name: redis-connect-secret
6569
- name: REDISCONNECT_SOURCE_PASSWORD
6670
value: admin123
6771
# valueFrom:
6872
# configMapKeyRef:
6973
# key: REDISCONNECT_SOURCE_PASSWORD
7074
# name: redis-connect-postgres-config
75+
# valueFrom:
76+
# secretKeyRef:
77+
# key: password
78+
# name: redis-connect-secret
7179
- name: REDISCONNECT_JAVA_OPTIONS
7280
value: "-XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx1g"
7381
# valueFrom:

connectors/postgres/k8s-docs/redis-connect-postgres-start.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,24 @@ spec:
1414
labels:
1515
app: redis-connect-postgres
1616
spec:
17+
affinity: ### the following
18+
podAntiAffinity:
19+
requiredDuringSchedulingIgnoredDuringExecution:
20+
- labelSelector:
21+
matchExpressions:
22+
- key: app
23+
operator: In
24+
values:
25+
- redis-connect-postgres # must match Deployment:metadata:labels:app
26+
topologyKey: "kubernetes.io/hostname"
1727
containers:
1828
- name: redis-connect-postgres # Container name
1929
image: redislabs/redis-connect-postgres:pre-release-alpine #repo/image:tag
20-
#### comment out the following two lines while you are setting up your
30+
#### uncomment the following two lines while you are setting up your
2131
# command: [ "/bin/bash", "-c", "--" ]
2232
# args: [ "while true; do sleep 30; done;" ]
2333
####
24-
####
25-
# command: [ "/opt/redislabs/redis-connect-postgres/bin/redisconnect.sh", "stage"]
2634
command: ["/opt/redislabs/redis-connect-postgres/bin/redisconnect.sh", "start"]
27-
####
2835
imagePullPolicy: Always # IfNotPresent # Always pull image
2936
resources:
3037
limits:
@@ -67,12 +74,20 @@ spec:
6774
# configMapKeyRef:
6875
# key: REDISCONNECT_SOURCE_USERNAME
6976
# name: redis-connect-postgres-config
77+
# valueFrom:
78+
# secretKeyRef:
79+
# key: username
80+
# name: redis-connect-secret
7081
- name: REDISCONNECT_SOURCE_PASSWORD
7182
value: admin123
7283
# valueFrom:
7384
# configMapKeyRef:
7485
# key: REDISCONNECT_SOURCE_PASSWORD
7586
# name: redis-connect-postgres-config
87+
# valueFrom:
88+
# secretKeyRef:
89+
# key: password
90+
# name: redis-connect-secret
7691
- name: REDISCONNECT_JAVA_OPTIONS
7792
value: "-XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx1g"
7893
# valueFrom:

0 commit comments

Comments
 (0)