From 4f2eeac7c32d4e62d35c5f2f93d58e6153c51f67 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 22 Oct 2017 23:58:02 -0500 Subject: [PATCH] support global config in k8s. (#295) Signed-off-by: Bo-Yi Wu --- k8s/gorush-aws-alb-ingress.yaml | 4 ++-- k8s/gorush-configmap.yaml | 9 +++++++++ k8s/gorush-deployment.yaml | 13 +++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 k8s/gorush-configmap.yaml diff --git a/k8s/gorush-aws-alb-ingress.yaml b/k8s/gorush-aws-alb-ingress.yaml index ba3a47a..9603c0a 100644 --- a/k8s/gorush-aws-alb-ingress.yaml +++ b/k8s/gorush-aws-alb-ingress.yaml @@ -7,8 +7,8 @@ metadata: # Kubernetes Ingress Controller for AWS ALB # https://github.com/coreos/alb-ingress-controller alb.ingress.kubernetes.io/scheme: internet-facing - alb.ingress.kubernetes.io/subnets: "subnet-3cd22c75,subnet-4aff342d" - alb.ingress.kubernetes.io/security-groups: sg-329c2b54 + alb.ingress.kubernetes.io/subnets: subnet-aa3dfbe3,subnet-4aff342d + alb.ingress.kubernetes.io/security-groups: sg-71069b17 spec: rules: - host: gorush.example.com diff --git a/k8s/gorush-configmap.yaml b/k8s/gorush-configmap.yaml new file mode 100644 index 0000000..f5dc63a --- /dev/null +++ b/k8s/gorush-configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: gorush-config + namespace: gorush +data: + # stat + stat.engine: redis + stat.redis.host: redis:6379 diff --git a/k8s/gorush-deployment.yaml b/k8s/gorush-deployment.yaml index 5b923b5..e07a458 100644 --- a/k8s/gorush-deployment.yaml +++ b/k8s/gorush-deployment.yaml @@ -15,8 +15,6 @@ spec: - image: appleboy/gorush name: gorush imagePullPolicy: Always - command: ["/gorush"] - args: ["-c", "config.yml", "-e", "redis", "--redis-addr", "redis:6379"] ports: - containerPort: 8088 livenessProbe: @@ -25,3 +23,14 @@ spec: port: 8088 initialDelaySeconds: 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