Skip to content

Commit

Permalink
feat(logger): Add redis instance for use by logger
Browse files Browse the repository at this point in the history
  • Loading branch information
krancour committed Jul 7, 2016
1 parent 7c91634 commit c9718e4
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 12 deletions.
16 changes: 16 additions & 0 deletions workflow-dev/tpl/deis-logger-rc.yaml
Expand Up @@ -19,6 +19,22 @@ spec:
- name: deis-logger
image: quay.io/{{.logger.org}}/logger:{{env "LOGGER_GIT_TAG" | default .logger.dockerTag}}
imagePullPolicy: {{.logger.pullPolicy}}
env:
- name: STORAGE_ADAPTER
value: redis
{{- if env "LOGGER_REDIS_LOCATION" | default .logger_redis_location | eq "off-cluster" }}
- name: DEIS_LOGGER_REDIS_DB
value: "{{ env "LOGGER_REDIS_DB" | default .loggerRedis.db }}"
- name: DEIS_LOGGER_REDIS_SERVICE_HOST
value: "{{ env "LOGGER_REDIS_HOST" | default .loggerRedis.host }}"
- name: DEIS_LOGGER_REDIS_SERVICE_PORT
value: "{{ env "LOGGER_REDIS_PORT" | default .loggerRedis.port }}"
{{- end }}
- name: DEIS_LOGGER_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: logger-redis-creds
key: password
ports:
- containerPort: 8088
name: http
Expand Down
32 changes: 32 additions & 0 deletions workflow-dev/tpl/deis-logger-redis-rc.yaml
@@ -0,0 +1,32 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: deis-logger-redis
namespace: deis
labels:
heritage: deis
annotations:
helm-keep: "true"
spec:
replicas: 1
selector:
app: deis-logger-redis
template:
metadata:
labels:
app: deis-logger-redis
spec:
serviceAccount: deis-logger
containers:
- name: deis-logger-redis
image: quay.io/{{.loggerRedis.org}}/redis:{{env "LOGGER_REDIS_GIT_TAG" | default .loggerRedis.dockerTag}}
imagePullPolicy: {{.loggerRedis.pullPolicy}}
ports:
- containerPort: 6379
volumeMounts:
- name: logger-redis-creds
mountPath: /var/run/secrets/deis/redis/creds
volumes:
- name: logger-redis-creds
secret:
secretName: logger-redis-creds
12 changes: 12 additions & 0 deletions workflow-dev/tpl/deis-logger-redis-secret-creds.yaml
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: logger-redis-creds
namespace: deis
labels:
app: deis-logger-redis
heritage: deis
annotations:
helm-keep: "true"
data:
password: {{ if env "LOGGER_REDIS_LOCATION" | default .logger_redis_location | eq "off-cluster" }}{{ env "LOGGER_REDIS_PASSWORD" | default .loggerRedis.password | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
14 changes: 14 additions & 0 deletions workflow-dev/tpl/deis-logger-redis-service.yaml
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: deis-logger-redis
namespace: deis
labels:
heritage: helm
annotations:
helm-keep: "true"
spec:
selector:
app: deis-logger-redis
ports:
- port: 6379
17 changes: 17 additions & 0 deletions workflow-dev/tpl/generate_params.toml
Expand Up @@ -28,6 +28,13 @@ storage = "minio"
# - off-cluster: Run PostgreSQL outside the Kubernetes cluster (configure in database section)
database_location = "on-cluster"

# Set the location of Workflow's logger-specific Redis instance
#
# Valid values are:
# - on-cluster: Run Redis within the Kubernetes cluster
# - off-cluster: Run Redis outside the Kubernetes cluster (configure in loggerRedis section)
logger_redis_location = "on-cluster"

[minio]
org = "deisci"
pullPolicy = "Always"
Expand Down Expand Up @@ -113,6 +120,16 @@ org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"

[loggerRedis]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
# Configure the following ONLY if using an off-cluster Redis instance for logger
db = "0"
host = "redis host"
port = "redis port"
password = "redis password" # "" == no password

[router]
org = "deisci"
pullPolicy = "Always"
Expand Down
9 changes: 9 additions & 0 deletions workflow-dev/tpl/storage.sh
Expand Up @@ -15,3 +15,12 @@ else
rm -rf $HELM_GENERATE_DIR/manifests/deis-database-*
fi
helmc tpl -d $HELM_GENERATE_DIR/tpl/generate_params.toml -o $HELM_GENERATE_DIR/manifests/deis-database-secret-creds.yaml $HELM_GENERATE_DIR/tpl/deis-database-secret-creds.yaml

logger_redis_location=`grep "logger_redis_location\s*=\s*" $HELM_GENERATE_DIR/tpl/generate_params.toml | cut -d "=" -f2 | tr -dc '[:alnum:]-\n\r'`
if [ "$LOGGER_REDIS_LOCATION" = "on-cluster" ] || ( [ -z "$LOGGER_REDIS_LOCATION" ] && [ "$logger_redis_location" = "on-cluster" ] ); then
helmc tpl -d $HELM_GENERATE_DIR/tpl/generate_params.toml -o $HELM_GENERATE_DIR/manifests/deis-logger-redis-rc.yaml $HELM_GENERATE_DIR/tpl/deis-logger-redis-rc.yaml
cp $HELM_GENERATE_DIR/tpl/deis-logger-redis-service* $HELM_GENERATE_DIR/manifests/
else
rm -rf $HELM_GENERATE_DIR/manifests/deis-logger-redis-*
fi
helmc tpl -d $HELM_GENERATE_DIR/tpl/generate_params.toml -o $HELM_GENERATE_DIR/manifests/deis-logger-redis-secret-creds.yaml $HELM_GENERATE_DIR/tpl/deis-logger-redis-secret-creds.yaml
12 changes: 0 additions & 12 deletions workflow-rc1/tpl/minio.sh

This file was deleted.

0 comments on commit c9718e4

Please sign in to comment.