Package: cdk8s-redis-sts
cdk8s-redis-stsCreate a Replicated Redis Statefulset on Kubernetes, powered by thecdk8s project🚀DisclaimerThis 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.Overviewcdk8s-redis-stsis acdk8slibrary.# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826fromconstructsimportConstructfromcdk8simportApp,Chart,ChartPropsfromopencdk8s.cdk8s_redis_stsimportMyRedisclassMyChart(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 bycdk8s synthcommand will have Kubernetes resources such asStatefulset,ConfigMapandServiceas follows.manifest.k8s.yamlallowVolumeExpansion:trueapiVersion:storage.k8s.io/v1kind:StorageClassmetadata:name:io1-slowparameters:fsType:ext4iopsPerGB:"10"type:io1provisioner:kubernetes.io/aws-ebsreclaimPolicy:Retain---apiVersion:v1data:master.conf:|-bind 0.0.0.0daemonize noport 6379tcp-backlog 511timeout 0tcp-keepalive 300supervised noslave.conf:|-slaveof dev 6379kind:ConfigMapmetadata:name:dev-redis-conf---apiVersion:v1kind:Servicemetadata:labels:app:devname:devnamespace:databasesspec:ports:-port:6379targetPort:6379selector:app:devtype:ClusterIP---apiVersion:apps/v1kind:StatefulSetmetadata:labels:app:devname:devnamespace:databasesspec:replicas:2selector:matchLabels:app:devserviceName:devtemplate:metadata:labels:app:devspec:containers:-command:-bash--c-|-[[ `hostname` =~ -([0-9]+)$ ]] || exit 1ordinal=${BASH_REMATCH[1]}if [[ $ordinal -eq 0 ]]; thenredis-server /mnt/redis/master.confelseredis-server /mnt/redis/slave.conffienv:[]image:redisname:redisports:-containerPort:6379resources:limits:cpu:400mmemory:512Mirequests:cpu:200mmemory:256MivolumeMounts:-mountPath:/dataname:dev-mountPath:/mnt/redis/name:dev-redis-confterminationGracePeriodSeconds:10volumes:-configMap:name:dev-redis-confname:dev-redis-confvolumeClaimTemplates:-metadata:name:devnamespace:databasesspec:accessModes:-ReadWriteOnceresources:requests:storage:10GistorageClassName:io1-slowInstallationTypeScriptUseyarnornpmto install.$npminstall@opencdk8s/cdk8s-redis-sts$yarnadd@opencdk8s/cdk8s-redis-stsPython$pipinstallcdk8s-redis-stsContributionFork (link)Bootstrap the repo:npxprojen# generates package.jsonyarninstall# installs dependenciesDevelopment scripts:CommandDescriptionyarn compileCompiles typescript => javascriptyarn watchWatch & compileyarn testRun unit test & linter through jestyarn test -uUpdate jest snapshotsyarn run packageCreates adistwith packages for all languages.yarn buildCompile + test + packageyarn bumpBump version (with changelog) based on [conventional commits]yarn releaseBump + push tomasterCreate a feature branchCommit your changesRebase your local changes against the master branchCreate a new Pull Request (useconventional commitsfor the title please)LicenceApache License, Version 2.0AuthorHunter-Thompson