Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfouquet committed Oct 11, 2023
1 parent f905657 commit b4583b1
Show file tree
Hide file tree
Showing 5 changed files with 4,213 additions and 969 deletions.
14 changes: 14 additions & 0 deletions config/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { App } from 'cdk8s';


const app = new App();

async function main(): Promise<void> {
// const ns = new NamespaceChart(app, 'namespace', { namespace: 'argo' });

// const fluentBit = new FluentBit(app, 'fluentBit', {});
// fluentBit.addDependency(ns);
// app.synth();
// }

main();
11 changes: 11 additions & 0 deletions config/charts/argo.semaphores.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Chart} from 'cdk8s'

Check failure on line 1 in config/charts/argo.semaphores.ts

View workflow job for this annotation

GitHub Actions / Format & Deploy(master)

Replace `Chart}·from·'cdk8s'` with `·Chart·}·from·'cdk8s';`

export class ArgoSemaphore extends Chart {
constructor(

Check failure on line 4 in config/charts/argo.semaphores.ts

View workflow job for this annotation

GitHub Actions / Format & Deploy(master)

Replace `··constructor(⏎········scope:·Construct,⏎····id:·string,⏎····props:·ChartProps,⏎··){⏎⏎··` with `constructor(scope:·Construct,·id:·string,·props:·ChartProps)·{`
scope: Construct,

Check failure on line 5 in config/charts/argo.semaphores.ts

View workflow job for this annotation

GitHub Actions / Format & Deploy(master)

'scope' is defined but never used
id: string,

Check failure on line 6 in config/charts/argo.semaphores.ts

View workflow job for this annotation

GitHub Actions / Format & Deploy(master)

'id' is defined but never used
props: ChartProps,

Check failure on line 7 in config/charts/argo.semaphores.ts

View workflow job for this annotation

GitHub Actions / Format & Deploy(master)

'props' is defined but never used
){

}
}

Check failure on line 11 in config/charts/argo.semaphores.ts

View workflow job for this annotation

GitHub Actions / Format & Deploy(master)

Insert `⏎`
54 changes: 54 additions & 0 deletions config/labels/labels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
mport { getGitBuildInfo } from "./build";


/**
* Generate a collection of standard labels for all components
* @param name The name of the application
* @param version The current version of the application
* @param component The component within the architecture
* @param partOf The name of a higher level application this one is part of
* @returns labels in the form of `app.kubernetes.io/name`
*/
export function defaultLabels(
name: string,
version: string,
component: string,
partOf: string,
): Record<string, string> {
return {
'app.kubernetes.io/name': name,
// Force a `v` prefix so the yaml doesn't consider it a number
'app.kubernetes.io/version': version.startsWith('v') ? version : `v${version}`,
'app.kubernetes.io/component': component,
'app.kubernetes.io/part-of': partOf,
'app.kubernetes.io/managed-by': 'cdk8s',
'app.kubernetes.io/git-hash': getGitBuildInfo().hash,
'app.kubernetes.io/git-version': getGitBuildInfo().version,
'app.kubernetes.io/build-id': getGitBuildInfo().buildId,
};
}

/**
* Generate and apply a collection of standard labels for all components
* @param name The name of the application
* @param version The current version of the application
* @param component The component within the architecture
* @param partOf The name of a higher level application this one is part of
*
* @returns labels in the form of `app.kubernetes.io/name`
*/
export function applyDefaultLabels<T extends { labels?: Record<string, string> }>(
props: T,
name: string,
version: string,
component: string,
partOf: string,
): T {
return {
...props,
labels: {
...props.labels,
...defaultLabels(name, version, component, partOf),
},
};
}
Loading

0 comments on commit b4583b1

Please sign in to comment.