Skip to content

Commit

Permalink
feat(metadata): use manifest to drive config
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Aug 5, 2021
1 parent 67b5afa commit 99ab647
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
10 changes: 8 additions & 2 deletions gen3/bin/kube-setup-metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ DB_HOST=$(jq -r .db_host < "$secretsFolder/dbcreds.json")
DB_USER=$(jq -r .db_username < "$secretsFolder/dbcreds.json")
DB_PASSWORD=$(jq -r .db_password < "$secretsFolder/dbcreds.json")
DB_DATABASE=$(jq -r .db_database < "$secretsFolder/dbcreds.json")
USE_AGG_MDS=false
AGG_MDS_NAMESPACE=$(gen3 db namespace)
ADMIN_LOGINS=gateway:$password
EOM
# make it easy for nginx to get the Authorization header ...
Expand All @@ -59,6 +57,14 @@ if ! setup_database; then
exit 1
fi

aggregateConfigFile="$(dirname $(g3k_manifest_path))/metadata/aggregate_config.json"
if [ -f "${aggregateConfigFile}" ]; then
if g3kubectl get secrets metadata-config > /dev/null 2>&1; then
g3kubectl delete secret metadata-config
fi
g3kubectl create secret generic metadata-config --from-file="${aggregateConfigFile}"
fi

if grep "USE_AGG_MDS=true" "$(gen3_secrets_folder)/g3auto/metadata/metadata.env" > /dev/null 2>&1; then
gen3_log_info "kube-setup-metadata setting up aws-es-proxy dependency"
gen3 kube-setup-aws-es-proxy || true
Expand Down
36 changes: 31 additions & 5 deletions kube/services/metadata/metadata-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ spec:
topologyKey: "kubernetes.io/hostname"
automountServiceAccountToken: false
volumes:
- name: config-volume-g3auto
secret:
secretName: metadata-g3auto
- name: config-volume
secret:
secretName: "metadata-g3auto"
secretName: metadata-config
- name: config-manifest
configMap:
name: manifest-metadata
containers:
- name: metadata
GEN3_METADATA_IMAGE
Expand All @@ -51,6 +57,18 @@ spec:
GEN3_DEBUG_FLAG|-value: "False"-|
- name: GEN3_ES_ENDPOINT
value: http://esproxy-service:9200
- name: USE_AGG_MDS
valueFrom:
configMapKeyRef:
name: manifest-metadata
key: USE_AGG_MDS
optional: true
- name: AGG_MDS_NAMESPACE
valueFrom:
configMapKeyRef:
name: manifest-metadata
key: AGG_MDS_NAMESPACE
optional: true
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -66,10 +84,18 @@ spec:
ports:
- containerPort: 80
volumeMounts:
- name: "config-volume"
- name: config-volume-g3auto
readOnly: true
mountPath: /src/.env
subPath: metadata.env
- name: config-volume
readOnly: true
mountPath: /aggregate_config.json
subPath: aggregate_config.json
- name: config-manifest
readOnly: true
mountPath: "/src/.env"
subPath: "metadata.env"
mountPath: /metadata.json
subPath: json
resources:
requests:
cpu: 0.4
Expand All @@ -82,7 +108,7 @@ spec:
GEN3_METADATA_IMAGE
imagePullPolicy: Always
volumeMounts:
- name: "config-volume"
- name: "config-volume-g3auto"
readOnly: true
mountPath: "/src/.env"
subPath: "metadata.env"
Expand Down

0 comments on commit 99ab647

Please sign in to comment.