Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Merged k8s cron job definitions into one generator function
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasK33 committed Feb 2, 2021
1 parent 0cbe7b8 commit aa6015e
Showing 1 changed file with 31 additions and 82 deletions.
113 changes: 31 additions & 82 deletions devops/kubernetes/src/fortify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,87 +369,36 @@ export class Fortify extends Chart {
});

// CronJobs
new FortifyCronJob(this, "import-standard", {
name: "import-standard",
version: jobsPackage.version,

schedule: "14 * * * *",
script: "import",

env: [
{
name: "LEADERBOARD_TYPE",
value: "standard",
},
{
name: "KAFKA_CLIENT_ID",
valueFrom: { fieldRef: { fieldPath: "metadata.name" } },
},
{ name: "SENTRY_TRACE_SAMPLE_RATE", value: "0" },
],
secrets: [vaultSecret],
configmaps: [redisConfig, kafkaConfig, postgresConfig, vaultConfig],
});
new FortifyCronJob(this, "import-turbo", {
name: "import-turbo",
version: jobsPackage.version,

schedule: "14 * * * *",
script: "import",

env: [
{
name: "LEADERBOARD_TYPE",
value: "turbo",
},
{
name: "KAFKA_CLIENT_ID",
valueFrom: { fieldRef: { fieldPath: "metadata.name" } },
},
{ name: "SENTRY_TRACE_SAMPLE_RATE", value: "0" },
],
secrets: [vaultSecret],
configmaps: [redisConfig, kafkaConfig, postgresConfig, vaultConfig],
});
new FortifyCronJob(this, "import-duos", {
name: "import-duos",
version: jobsPackage.version,

schedule: "14 * * * *",
script: "import",

env: [
{
name: "LEADERBOARD_TYPE",
value: "duos",
},
{
name: "KAFKA_CLIENT_ID",
valueFrom: { fieldRef: { fieldPath: "metadata.name" } },
},
{ name: "SENTRY_TRACE_SAMPLE_RATE", value: "0" },
],
secrets: [vaultSecret],
configmaps: [redisConfig, kafkaConfig, postgresConfig, vaultConfig],
});
new FortifyCronJob(this, "db-cleanup", {
name: "db-cleanup",
version: jobsPackage.version,

// Every hour
suspend: true,
schedule: "0 * * * *",
script: "clean_db",

env: [
{
name: "KAFKA_CLIENT_ID",
valueFrom: { fieldRef: { fieldPath: "metadata.name" } },
},
{ name: "SENTRY_TRACE_SAMPLE_RATE", value: "0" },
],
secrets: [vaultSecret],
configmaps: [redisConfig, kafkaConfig, postgresConfig, vaultConfig],
});
const ImportCronJob = (leaderboardType: string) => {
new FortifyCronJob(this, `import-${leaderboardType}`, {
name: `import-${leaderboardType}`,
version: jobsPackage.version,

schedule: "14 * * * *",
script: "import",

env: [
{
name: "LEADERBOARD_TYPE",
value: leaderboardType,
},
{
name: "KAFKA_CLIENT_ID",
valueFrom: { fieldRef: { fieldPath: "metadata.name" } },
},
{ name: "SENTRY_TRACE_SAMPLE_RATE", value: "0" },
],
secrets: [vaultSecret],
configmaps: [
redisConfig,
kafkaConfig,
postgresConfig,
vaultConfig,
],
});
};
ImportCronJob("standard");
ImportCronJob("turbo");
ImportCronJob("duos");
}
}

0 comments on commit aa6015e

Please sign in to comment.