Skip to content

Commit

Permalink
Add ConfigMap
Browse files Browse the repository at this point in the history
  • Loading branch information
joyliu-q committed Oct 21, 2023
1 parent e76b19b commit 05ce4af
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
32 changes: 29 additions & 3 deletions k8s/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Construct } from 'constructs';
import { App } from 'cdk8s';
import { CronJob, DjangoApplication, PennLabsChart, ReactApplication, RedisApplication } from '@pennlabs/kittyhawk';
import { KubeConfigMap } from '@pennlabs/kittyhawk/lib/imports/k8s';
import dedent from "ts-dedent";

const cronTime = require('cron-time-generator');

Expand All @@ -16,6 +18,20 @@ export class MyChart extends PennLabsChart {
const clubsSecret = 'penn-clubs';
const clubsDomain = 'pennclubs.com';

/** Redis ConfigMap */
new KubeConfigMap(this, 'redis-config', {
data: {
'redis.conf': dedent`
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
data:
redis-config: ""
`,
}
});

/** Ingress HTTPS Enforcer */
const ingressProps = {
annotations: {
Expand All @@ -26,13 +42,23 @@ export class MyChart extends PennLabsChart {

new RedisApplication(this, 'redis', {
deployment: {
cmd: ['redis-server', '/redis-master/redis.conf'],
secretMounts: [
{
name: 'redis-data',
mountPath: '/data',
name: 'config',
mountPath: '/redis-master',
},
{
name: 'data',
mountPath: 'redis-master-data',
}
],
}
env: [{
name: "MASTER",
value: "true",
}],
},

});

new DjangoApplication(this, 'django-wsgi', {
Expand Down
5 changes: 3 additions & 2 deletions k8s/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"dependencies": {
"@pennlabs/kittyhawk": "^1.1.8",
"cdk8s": "^2.2.63",
"constructs": "^10.0.119"
"constructs": "^10.0.119",
"ts-dedent": "^2.2.0"
},
"devDependencies": {
"@types/jest": "^26.0.24",
Expand All @@ -27,4 +28,4 @@
"ts-jest": "^26.5.6",
"typescript": "^4.6.3"
}
}
}
5 changes: 5 additions & 0 deletions k8s/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4463,6 +4463,11 @@ triple-beam@^1.3.0:
resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984"
integrity sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==

ts-dedent@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.2.0.tgz#39e4bd297cd036292ae2394eb3412be63f563bb5"
integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==

ts-jest@^26.5.6:
version "26.5.6"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.6.tgz#c32e0746425274e1dfe333f43cd3c800e014ec35"
Expand Down

0 comments on commit 05ce4af

Please sign in to comment.