-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ab88bd
commit 6fcfbfa
Showing
6 changed files
with
66 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules/ | ||
node_modules/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
app: npx tsx config/app.ts | ||
language: typescript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import { App } from 'cdk8s'; | ||
|
||
import { ArgoSemaphore } from './charts/argo.semaphores'; | ||
|
||
const app = new App(); | ||
|
||
async function main(): Promise<void> { | ||
// const ns = new NamespaceChart(app, 'namespace', { namespace: 'argo' }); | ||
// const ns = new NamespaceChart(app, 'namespace', { namespace: 'argo' }); | ||
|
||
// const fluentBit = new FluentBit(app, 'fluentBit', {}); | ||
// fluentBit.addDependency(ns); | ||
// app.synth(); | ||
// } | ||
// FIXME: metadata name is not correct, like 'semaphore-semaphores-c8f222a7' | ||
new ArgoSemaphore(app, 'semaphore', {}); | ||
|
||
main(); | ||
app.synth(); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
import { Chart, ChartProps } from 'cdk8s'; | ||
import * as kplus from 'cdk8s-plus-27'; | ||
import { Construct } from 'constructs'; | ||
|
||
import { applyDefaultLabels } from '../labels/labels'; | ||
import { applyDefaultLabels } from '../util/labels'; | ||
|
||
export class ArgoSemaphore extends Chart { | ||
constructor(scope: Construct, id: string, props: ChartProps) { | ||
super(scope, id, applyDefaultLabels(props, 'argo', 'v1', 'semaphores', 'workflows')); | ||
|
||
const cm = new kplus.ConfigMap(this, 'semaphores', { | ||
new kplus.ConfigMap(this, 'semaphores', { | ||
data: { | ||
'config.yaml': [ | ||
`tunnel: ${props.tunnelName}`, // Tunnel name must match the credentials | ||
'credentials-file: /etc/cloudflared/creds/credentials.json', // defined by "secret" | ||
`metrics: "[::]:2000"`, | ||
'no-autoupdate: true', | ||
'protocol: http2', // quic is blocked in the LINZ network | ||
].join('\n'), | ||
standardising: '2', // Limit of how many standardising workflow instances can run at the same time | ||
bulk: '4', // Limit of how many bulk workflow instances can run at the same time | ||
bulkcopy: '8', // Limit of how many publish-copy workflow instances can run at the same time | ||
basemaps_import: '10', // Limit of how many basemaps import workflow instances can run at the same time | ||
}, | ||
}); | ||
|
||
// apiVersion: v1 | ||
// kind: ConfigMap | ||
// metadata: | ||
// name: semaphores | ||
// namespace: argo | ||
// data: | ||
// standardising: '2' # Limit of how many standardising workflow instances can run at the same time | ||
// bulk: '4' # Limit of how many bulk workflow instances can run at the same time | ||
// bulkcopy: '8' # Limit of how many publish-copy workflow instances can run at the same time | ||
// basemaps_import: '10' # Limit of how many basemaps import workflow instances can run at the same time | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { execFileSync } from 'node:child_process'; | ||
|
||
interface GitBuildInfo { | ||
/** | ||
* Last git version tag | ||
* | ||
* @example | ||
* "v6.45.0" | ||
*/ | ||
version: string; | ||
/** | ||
* Current git commit hash | ||
* | ||
* @example | ||
* "e460a1bf611b9464f4c2c3feb48e4823277f14a4" | ||
*/ | ||
hash: string; | ||
/** | ||
* Github actions run id and attempt if it exists, otherwise "" | ||
* | ||
* @example | ||
* "6228679664-1" | ||
*/ | ||
buildId: string; | ||
} | ||
|
||
let buildInfo: GitBuildInfo | undefined; | ||
|
||
/** | ||
* Attempt to guess build information from the currently checked out version of the source code | ||
* | ||
* @returns Basic Git/Github build information | ||
*/ | ||
export function getGitBuildInfo(): GitBuildInfo { | ||
if (buildInfo == null) { | ||
buildInfo = { | ||
version: execFileSync('git', ['describe', '--tags', '--always', '--match', 'v*']).toString().trim(), | ||
hash: execFileSync('git', ['rev-parse', 'HEAD']).toString().trim(), | ||
buildId: process.env['GITHUB_RUN_ID'] | ||
? `${process.env['GITHUB_RUN_ID']}-${process.env['GITHUB_RUN_ATTEMPT']}` | ||
: '', | ||
}; | ||
} | ||
return buildInfo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters