Skip to content

Instantly share code, notes, and snippets.

@drshrey
Last active March 9, 2019 00:31
Show Gist options
  • Save drshrey/7df7cff5cf15273f4895bbb58f0232f9 to your computer and use it in GitHub Desktop.
Save drshrey/7df7cff5cf15273f4895bbb58f0232f9 to your computer and use it in GitHub Desktop.
redis plugin

Redis Extension Spec

Problem

We want to provide apps access to Redis in Staging, but providing a dedicated ElastiCache instance to each application is problematic for 2 reasons:

  1. Large financial costs where we would at worst case, double our costs.
  2. Increased complexity as any outage or problems caused by AWS would cascade onto us (and other classic external dependency problems).

We also cannot use a shared Redis ElastiCache instance across all apps as there is no built-in way to guarantee unique prefix keys for each service in order to avoid collisions between services.

Solution

A CodeAmp extension that initializes a Redis deployment that contains a container of the official Redis image within the namespace of the requesting project. In case of instability in any of the redis containers, we may need to manually intervene and restart containers, but this provides us guaranteed isolation between services as well as reducing our cost burden since the container resource requirements are much lighter (100mb, 100 millicpus per pod).

Name and Functions

kubernetes:redis:create, kubernetes:redis:delete

Required Inputs

project.slug, project.environment.key

Side Effects

  • Redis deployment in <project.slug>-<project.environment.key> Kubernetes namespace

Output Artifacts

REDIS_DNS REDIS_PORT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment