Skip to main content

cdk8s-redis-sts Release

Create a Replicated Redis Statefulset on Kubernetes, powered by the cdk8s project 🚀

Disclaimer

This construct is under heavy development, and breaking changes will be introduced very often. Please don't forget to version lock your code if you are using this construct.

Overview

cdk8s-redis-sts is a cdk8s library.

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from constructs import Construct
from cdk8s import App, Chart, ChartProps
from opencdk8s.cdk8s_redis_sts import MyRedis

class MyChart(Chart):
    def __init__(self, scope, id, *, namespace=None, labels=None):
        super().__init__(scope, id, namespace=namespace, labels=labels)
        MyRedis(self, "dev",
            image="redis",
            namespace="databases",
            volume_size="10Gi",
            replicas=2,
            create_storage_class=True,
            volume_provisioner="kubernetes.io/aws-ebs",
            storage_class_name="io1-slow",
            storage_class_params={
                "type": "io1",
                "fs_type": "ext4",
                "iops_per_gB": "10"
            }
        )

app = App()
MyChart(app, "dev")
app.synth()

Then the Kubernetes manifests created by cdk8s synth command will have Kubernetes resources such as Statefulset, ConfigMap and Service as follows.

manifest.k8s.yaml
allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: io1-slow
parameters:
  fsType: ext4
  iopsPerGB: "10"
  type: io1
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Retain
---
apiVersion: v1
data:
  master.conf: |-

    bind 0.0.0.0
    daemonize no
    port 6379
    tcp-backlog 511
    timeout 0
    tcp-keepalive 300
    supervised no
  slave.conf: |-

    slaveof dev 6379
kind: ConfigMap
metadata:
  name: dev-redis-conf
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: dev
  name: dev
  namespace: databases
spec:
  ports:
    - port: 6379
      targetPort: 6379
  selector:
    app: dev
  type: ClusterIP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: dev
  name: dev
  namespace: databases
spec:
  replicas: 2
  selector:
    matchLabels:
      app: dev
  serviceName: dev
  template:
    metadata:
      labels:
        app: dev
    spec:
      containers:
        - command:
            - bash
            - -c
            - |-
              [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
              ordinal=${BASH_REMATCH[1]}
              if [[ $ordinal -eq 0 ]]; then
              redis-server /mnt/redis/master.conf
              else
              redis-server /mnt/redis/slave.conf
              fi
          env: []
          image: redis
          name: redis
          ports:
            - containerPort: 6379
          resources:
            limits:
              cpu: 400m
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 256Mi
          volumeMounts:
            - mountPath: /data
              name: dev
            - mountPath: /mnt/redis/
              name: dev-redis-conf
      terminationGracePeriodSeconds: 10
      volumes:
        - configMap:
            name: dev-redis-conf
          name: dev-redis-conf
  volumeClaimTemplates:
    - metadata:
        name: dev
        namespace: databases
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        storageClassName: io1-slow

Installation

TypeScript

Use yarn or npm to install.

$ npm install @opencdk8s/cdk8s-redis-sts
$ yarn add @opencdk8s/cdk8s-redis-sts

Python

$ pip install cdk8s-redis-sts

Contribution

  1. Fork (link)

  2. Bootstrap the repo:

    npx projen   # generates package.json
    yarn install # installs dependencies
    
  3. Development scripts:

    Command Description
    yarn compile Compiles typescript => javascript
    yarn watch Watch & compile
    yarn test Run unit test & linter through jest
    yarn test -u Update jest snapshots
    yarn run package Creates a dist with packages for all languages.
    yarn build Compile + test + package
    yarn bump Bump version (with changelog) based on [conventional commits]
    yarn release Bump + push to master
  4. Create a feature branch

  5. Commit your changes

  6. Rebase your local changes against the master branch

  7. Create a new Pull Request (use conventional commits for the title please)

Licence

Apache License, Version 2.0

Author

Hunter-Thompson

Metadata

Release files for cdk8s-redis-sts 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdk8s-redis-sts 0.0.7
File Size Uploaded Provenance Actions
cdk8s-redis-sts-0.0.7.tar.gz 319.6 kB Without provenance Details for cdk8s-redis-sts-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cdk8s-redis-sts 0.0.7
File Interpreter ABI Platform Actions
cdk8s_redis_sts-0.0.7-py3-none-any.whl Python 3 none any Details for cdk8s_redis_sts-0.0.7-py3-none-any.whl

Total release size: 637.2 kB

Release files / cdk8s-redis-sts-0.0.7.tar.gz

Download URL cdk8s-redis-sts-0.0.7.tar.gz
Size 319.6 kB
Tags Source
SHA-256 checksum
How to use checksums
71c87e770594c3f2db668325cdd9825028f47f098053461015535a50bddbcbe8
BLAKE2b-256 checksum
How to use checksums
ebbe0167aa04b21f794cdcdc8ef552d350945d3d1fe4902d06764417e18ac6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9

Release files / cdk8s_redis_sts-0.0.7-py3-none-any.whl

Download URL cdk8s_redis_sts-0.0.7-py3-none-any.whl
Size 317.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8575061bdbdbcc3a67f01659297f8ca52b4f5fad17ee0863e99fc7c8f0121a95
BLAKE2b-256 checksum
How to use checksums
fd4a871fc615c550479a04229974be79aae64e73104a54c398cf130dae34bc83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9

Security for cdk8s-redis-sts 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page