From 9cfeefedd01e843605b5cd95a354e9256f4cf2a5 Mon Sep 17 00:00:00 2001 From: Paul Fouquet Date: Fri, 13 Oct 2023 15:44:36 +1300 Subject: [PATCH 01/34] docs: Helm Chart construct code generation with CDK8s --- config/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/README.md b/config/README.md index 41a451c40..155e1c690 100644 --- a/config/README.md +++ b/config/README.md @@ -42,6 +42,19 @@ However, some of the component Helm charts do not have a `values.schema.json`. F - aws-for-fluent-bit () - Karpenter +### Working with Helm charts + +#### Generate code + +It is possible to generate a specific Helm construct for the component if their chart includes a `value.schema.json`. This is useful to provide typing hints when specifying their configuration () + +To generate the Helm Construct for a specific Chart, follow the instructions [here](https://github.com/cdk8s-team/cdk8s/blob/master/docs/cli/import.md#values-schema) + +However, some of the component Helm charts do not have a `values.schema.json`. For those we won't generate any code and use the default `Helm` construct: + +- aws-for-fluent-bit + + ## Usage (for test) Ensure all dependencies are installed From f67eb9c5331a17bcde8081742b4c12d26424de3a Mon Sep 17 00:00:00 2001 From: Paul Fouquet Date: Fri, 13 Oct 2023 15:45:32 +1300 Subject: [PATCH 02/34] docs: link to fluent-bit gh issue --- config/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/README.md b/config/README.md index 155e1c690..93df4ab8e 100644 --- a/config/README.md +++ b/config/README.md @@ -52,7 +52,7 @@ To generate the Helm Construct for a specific Chart, follow the instructions [he However, some of the component Helm charts do not have a `values.schema.json`. For those we won't generate any code and use the default `Helm` construct: -- aws-for-fluent-bit +- aws-for-fluent-bit () ## Usage (for test) From 6c596c35026e804f3c360bbc425deb5fb82ec9de Mon Sep 17 00:00:00 2001 From: Megan Davidson Date: Fri, 13 Oct 2023 16:09:08 +1300 Subject: [PATCH 03/34] WIP: fluentbit TODO: update name --- config/app.ts | 15 +++++++++++++++ config/charts/fluentbit.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 config/app.ts create mode 100644 config/charts/fluentbit.ts diff --git a/config/app.ts b/config/app.ts new file mode 100644 index 000000000..02c7bdfb4 --- /dev/null +++ b/config/app.ts @@ -0,0 +1,15 @@ +import { App } from 'cdk8s'; + +import { ArgoSemaphore } from './charts/argo.semaphores'; +import { FluentBit } from './charts/fluentbit'; + +const app = new App(); + +async function main(): Promise { + new ArgoSemaphore(app, 'semaphore', {}); + new FluentBit(app, 'fluentbit', {}); + + app.synth(); +} + +main(); diff --git a/config/charts/fluentbit.ts b/config/charts/fluentbit.ts new file mode 100644 index 000000000..f0d6bf745 --- /dev/null +++ b/config/charts/fluentbit.ts @@ -0,0 +1,37 @@ +import { Chart, ChartProps, Helm } from 'cdk8s'; +import { Construct } from 'constructs'; + +import { applyDefaultLabels } from '../util/labels.js'; + +export class FluentBit extends Chart { + constructor(scope: Construct, id: string, props: ChartProps) { + super(scope, id, applyDefaultLabels(props, 'aws-for-fluent-bit', '2.31.11', 'logs', 'workflows')); + + const FluentParserName = 'containerd'; + // This needs to be properly formatted, and it was stolen directly from https://github.com/microsoft/fluentbit-containerd-cri-o-json-log + // The key part is the message must be parsed as "log" otherwise it wont be parsed as JSON + const FluentContainerParser = `[PARSER] + Name ${FluentParserName} + Format regex + Regex ^(?