support global config in k8s. (#295)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-10-22 23:58:02 -05:00 committed by GitHub
parent f76343b840
commit 4f2eeac7c3
3 changed files with 22 additions and 4 deletions

View File

@ -7,8 +7,8 @@ metadata:
# Kubernetes Ingress Controller for AWS ALB # Kubernetes Ingress Controller for AWS ALB
# https://github.com/coreos/alb-ingress-controller # https://github.com/coreos/alb-ingress-controller
alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/subnets: "subnet-3cd22c75,subnet-4aff342d" alb.ingress.kubernetes.io/subnets: subnet-aa3dfbe3,subnet-4aff342d
alb.ingress.kubernetes.io/security-groups: sg-329c2b54 alb.ingress.kubernetes.io/security-groups: sg-71069b17
spec: spec:
rules: rules:
- host: gorush.example.com - host: gorush.example.com

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: gorush-config
namespace: gorush
data:
# stat
stat.engine: redis
stat.redis.host: redis:6379

View File

@ -15,8 +15,6 @@ spec:
- image: appleboy/gorush - image: appleboy/gorush
name: gorush name: gorush
imagePullPolicy: Always imagePullPolicy: Always
command: ["/gorush"]
args: ["-c", "config.yml", "-e", "redis", "--redis-addr", "redis:6379"]
ports: ports:
- containerPort: 8088 - containerPort: 8088
livenessProbe: livenessProbe:
@ -25,3 +23,14 @@ spec:
port: 8088 port: 8088
initialDelaySeconds: 3 initialDelaySeconds: 3
periodSeconds: 3 periodSeconds: 3
env:
- name: GORUSH_STAT_ENGINE
valueFrom:
configMapKeyRef:
name: gorush-config
key: stat.engine
- name: GORUSH_STAT_REDIS_ADDR
valueFrom:
configMapKeyRef:
name: gorush-config
key: stat.redis.host