Skip to content

Commit

Permalink
Fix: Kubeconfig must be set at pod startup (#141)
Browse files Browse the repository at this point in the history
because of how the code is written, setting the env Kubeconfig in the code doesnt set it soon enough. So just moving it to the deployment.yaml to make sure it is set at the start
  • Loading branch information
alewitt2 authored Jun 25, 2020
1 parent 458f289 commit 92a0a18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
22 changes: 14 additions & 8 deletions kubernetes/watch-keeper/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ spec:
fieldPath: metadata.namespace
- name: NODE_ENV
value: "production"
- name: KUBECONFIG
valueFrom:
configMapKeyRef:
name: watch-keeper-config
key: KUBECONFIG
optional: true
image: "quay.io/razee/watch-keeper:{{TRAVIS_TAG}}"
imagePullPolicy: Always
name: watch-keeper
Expand All @@ -51,14 +57,14 @@ spec:
timeoutSeconds: 30
failureThreshold: 1
volumeMounts:
- mountPath: /usr/src/app/envs/watch-keeper-config
name: watch-keeper-config
- mountPath: /usr/src/app/envs/watch-keeper-secret
name: watch-keeper-secret
- mountPath: /usr/src/app/envs/razee-identity-config
name: razee-identity-config
- mountPath: /usr/src/app/envs/razee-identity-secret
name: razee-identity-secret
- name: watch-keeper-config
mountPath: /usr/src/app/envs/watch-keeper-config
- name: watch-keeper-secret
mountPath: /usr/src/app/envs/watch-keeper-secret
- name: razee-identity-config
mountPath: /usr/src/app/envs/razee-identity-config
- name: razee-identity-secret
mountPath: /usr/src/app/envs/razee-identity-secret
volumes:
- name: watch-keeper-config
configMap:
Expand Down
5 changes: 0 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ async function setEnvs() {
if (await fs.pathExists('envs/watch-keeper-config/CONFIG_NAMESPACE')) {
env.CONFIG_NAMESPACE = (await fs.readFile('envs/watch-keeper-config/CONFIG_NAMESPACE', 'utf8')).trim();
}
if (await fs.pathExists('envs/watch-keeper-config/KUBECONFIG')) {
env.KUBECONFIG = (await fs.readFile('envs/watch-keeper-config/KUBECONFIG', 'utf8')).trim();
} else {
env.KUBECONFIG = '/etc/kubernetes/admin-kubeconfig';
}
if (await fs.pathExists('envs/watch-keeper-config/VALIDATE_INTERVAL')) {
env.VALIDATE_INTERVAL = (await fs.readFile('envs/watch-keeper-config/VALIDATE_INTERVAL', 'utf8')).trim();
}
Expand Down

0 comments on commit 92a0a18

Please sign in to comment.