Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging fix Fargate OSS pattern #145

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
171444a
Adding fargate compatibility and new patterns
Howlla Aug 15, 2023
c45b41a
create new type to limit parameter into builder
Howlla Aug 15, 2023
309475d
Merge branch 'aws-observability:main' into main
Howlla Aug 15, 2023
da3e785
Prepare for pr
Howlla Aug 22, 2023
ecbae71
remove parameter computeType for existing clusters
Howlla Aug 22, 2023
076b498
lint fix
Howlla Aug 22, 2023
cdce95a
remove existing aws fargate code
Howlla Aug 22, 2023
a96a1aa
lint fix
Howlla Aug 22, 2023
b4ab8dd
Merge branch 'aws-observability:main' into main
Howlla Aug 24, 2023
244b64d
Added documentation and reset observability builder code
Howlla Aug 25, 2023
65a89e4
Correct addons for fargate and add namespace for opentelemetry
Howlla Aug 28, 2023
aa6f252
Merge branch 'aws-observability:main' into main
Howlla Aug 28, 2023
e86be21
Merge remote-tracking branch 'upstream/main'
Howlla Aug 29, 2023
e11a7e9
Merge branch 'aws-observability:main' into main
Howlla Sep 11, 2023
37f068d
Explicitly define addons for fargate pattern
Howlla Sep 11, 2023
ba4451c
pass coredns props
Howlla Sep 11, 2023
f7d30fc
Tested with updated observability builder props PR
Howlla Sep 15, 2023
5258401
Tested with updated observability builder props PR
Howlla Sep 15, 2023
dfff787
Merge branch 'aws-observability:main' into main
Howlla Sep 22, 2023
2fcb561
Merge branch 'aws-observability:main' into main
Howlla Sep 29, 2023
144186e
Merge branch 'aws-observability:main' into main
Howlla Oct 7, 2023
c368a73
update version and minor props fix for addons
Howlla Oct 7, 2023
1fd56ca
kubeproxy auto instead of explicit
Howlla Oct 7, 2023
633850b
Merge branch 'main' into main
Howlla Oct 8, 2023
8290fc2
updated docs
Howlla Oct 8, 2023
edc2f92
Merge branch 'main' of https://github.com/Howlla/cdk-aws-observabilit…
Howlla Oct 8, 2023
545fa3b
Merge branch 'aws-observability:main' into main
Howlla Oct 9, 2023
dcbddd7
update image location
Howlla Oct 9, 2023
701ca57
auto coredns version
Howlla Oct 9, 2023
cad2ca6
Merge branch 'aws-observability:main' into main
Howlla Oct 12, 2023
460b6f7
fargate holly monitoring
Howlla Oct 16, 2023
502acce
updated docs
Howlla Oct 16, 2023
9af21ca
added deployment steps in docs
Howlla Oct 16, 2023
b778c8c
clean delete except coredns
Howlla Oct 17, 2023
46b3cd0
Cat command for manifest
Howlla Oct 17, 2023
b4fcf26
Merge branch 'aws-observability:main' into main
Howlla Oct 24, 2023
83f6cd9
Merge branch 'aws-observability:main' into main
Howlla Oct 30, 2023
a4870f9
Merge branch 'aws-observability:main' into main
Howlla Jan 2, 2024
a055347
version bump to kube 1.28
Howlla Jan 3, 2024
8419614
version bump to kube 1.28
Howlla Jan 3, 2024
e26039c
Fargate OSS blog logs from ADOT
Howlla Jan 31, 2024
1cf9062
logs working with configmap
Howlla Feb 3, 2024
bf4925a
Merge branch 'aws-observability:main' into logs-fix
Howlla Feb 3, 2024
6d1393c
refactor fargateprofiles
Howlla Feb 3, 2024
7a27b45
enable control plane logging
Howlla Feb 3, 2024
c85110a
fix
Howlla Feb 3, 2024
e3a664a
fix
Howlla Feb 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class SingleNewEksAWSNativeFargateobservabilityConstruct {
// Define fargate cluster provider and pass the profile options
const fargateClusterProvider : blueprints.FargateClusterProvider = new blueprints.FargateClusterProvider({
fargateProfiles,
version: eks.KubernetesVersion.of("1.27")
version: eks.KubernetesVersion.of("1.28")
});

const certManagerAddOnProps : blueprints.CertManagerAddOnProps = {
Expand All @@ -50,7 +50,7 @@ export default class SingleNewEksAWSNativeFargateobservabilityConstruct {
};

const coreDnsAddOnProps : blueprints.CoreDnsAddOnProps = {
version:"v1.10.1-eksbuild.1",
version:"v1.10.1-eksbuild.6",
configurationValues:{
computeType: "Fargate"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
kind: Namespace
apiVersion: v1
metadata:
name: aws-observability
labels:
aws-observability: enabled
---
kind: ConfigMap
apiVersion: v1
metadata:
name: aws-logging
namespace: aws-observability
data:
flb_log_cw: "true" # Set to true to ship Fluent Bit process logs to CloudWatch.
filters.conf: |
[FILTER]
Name parser
Match *
Key_name log
Parser crio
[FILTER]
Name kubernetes
Match kube.*
Merge_Log On
Keep_Log Off
Buffer_Size 0
Kube_Meta_Cache_TTL 300s
output.conf: |
[OUTPUT]
Name cloudwatch_logs
Match kube.*
region us-east-1
log_group_name fargate-observability
log_stream_prefix from-fluent-bit-
auto_create_group true
parsers.conf: |
[PARSER]
Name crio
Format Regex
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>P|F) (?<log>.*)$
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'source-map-support/register';
import * as blueprints from '@aws-quickstart/eks-blueprints';
import * as eks from "aws-cdk-lib/aws-eks";
import { Construct } from 'constructs';
import { loadYaml, readYamlDocument } from '@aws-quickstart/eks-blueprints/dist/utils';

export class FluentBitConfigMap implements blueprints.ClusterAddOn {
id?: string | undefined;
deploy(clusterInfo: blueprints.ClusterInfo): void | Promise<Construct> {
const cluster = clusterInfo.cluster;

const doc = readYamlDocument(__dirname + '/fluentbitconfig.yml');
const manifest = doc.split("---").map(e => loadYaml(e));

const configMap = new eks.KubernetesManifest(cluster.stack, "aws-observability", {
cluster,
manifest,
overwrite: true
});

return Promise.resolve(configMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { Construct } from 'constructs';
import { utils } from '@aws-quickstart/eks-blueprints';
import * as blueprints from '@aws-quickstart/eks-blueprints';
import { GrafanaOperatorSecretAddon } from '../single-new-eks-opensource-observability-pattern/grafanaoperatorsecretaddon';
import { FluentBitConfigMap } from './fluentbitconfigmap';
import * as amp from 'aws-cdk-lib/aws-aps';
import { ObservabilityBuilder } from '@aws-quickstart/eks-blueprints';
import * as eks from 'aws-cdk-lib/aws-eks';
import * as fs from 'fs';
import { ManagedPolicy,Role,ServicePrincipal } from "aws-cdk-lib/aws-iam";

export default class SingleNewEksFargateOpenSourceObservabilityConstruct {
constructor(scope: Construct, id: string) {
Expand Down Expand Up @@ -115,7 +117,7 @@ export default class SingleNewEksFargateOpenSourceObservabilityConstruct {
const addOns: Array<blueprints.ClusterAddOn> = [
new blueprints.addons.VpcCniAddOn(),
new blueprints.addons.CoreDnsAddOn({
version: "v1.10.1-eksbuild.1",
version: "v1.10.1-eksbuild.6",
configurationValues: { computeType: "Fargate" }
}),
new blueprints.addons.KubeProxyAddOn(),
Expand All @@ -128,10 +130,6 @@ export default class SingleNewEksFargateOpenSourceObservabilityConstruct {
}),
new blueprints.addons.KubeStateMetricsAddOn(),
new blueprints.addons.MetricsServerAddOn(),
new blueprints.addons.CloudWatchLogsAddon({
logGroupPrefix: `/aws/eks/${stackId}`,
logRetentionDays: 30
}),
new blueprints.addons.ExternalsSecretsAddOn({
namespace: "external-secrets",
values: { webhook: { port: 9443 } }
Expand All @@ -141,9 +139,17 @@ export default class SingleNewEksFargateOpenSourceObservabilityConstruct {
new GrafanaOperatorSecretAddon(),
new blueprints.addons.AdotCollectorAddOn(),
new blueprints.addons.XrayAdotAddOn(),
new blueprints.addons.AmpAddOn(ampAddOnProps)
new blueprints.addons.AmpAddOn(ampAddOnProps),
new FluentBitConfigMap()
];

const nodeRole = new blueprints.CreateRoleProvider("blueprint-fargate-pod-role", new ServicePrincipal("eks-fargate-pods.amazonaws.com"),
[
ManagedPolicy.fromAwsManagedPolicyName("AmazonEKSFargatePodExecutionRolePolicy"),
ManagedPolicy.fromAwsManagedPolicyName("CloudWatchAgentServerPolicy"),
]);

const podExecutionRole = blueprints.getNamedResource("blueprint-fargate-pod-role") as Role;

const fargateProfiles: Map<string, eks.FargateProfileOptions> = new Map([
["MyProfile", {
Expand All @@ -153,22 +159,24 @@ export default class SingleNewEksFargateOpenSourceObservabilityConstruct {
{ namespace: "external-secrets" },
{ namespace: "grafana-operator" },
{ namespace: "flux-system" }
]
}]
], podExecutionRole : podExecutionRole
}],
]);

// Define fargate cluster provider and pass the profile options
const fargateClusterProvider: blueprints.FargateClusterProvider = new blueprints.FargateClusterProvider({
fargateProfiles,
version: eks.KubernetesVersion.of("1.27")
version: eks.KubernetesVersion.of("1.28"),
});


ObservabilityBuilder.builder()
.account(account)
.region(region)
.clusterProvider(fargateClusterProvider)
.resourceProvider("blueprint-fargate-pod-role", nodeRole)
.resourceProvider(ampWorkspaceName, new blueprints.CreateAmpProvider(ampWorkspaceName, ampWorkspaceName))
.addOns(...addOns)
.build(scope, stackId);
}
}
}
Loading