Skip to content

Commit

Permalink
Fixing Graviton Pattern for Istio
Browse files Browse the repository at this point in the history
  • Loading branch information
elamaran11 committed Jan 25, 2024
1 parent 1b81799 commit 213f48a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/common/resources/otel-collector-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1617,8 +1617,8 @@ spec:
target_label: nodename
{{ start enableJavaMonJob }}
- job_name: 'kubernetes-java-jmx'
sample_limit: {{ .Values.javaScrapeSampleLimit }}
metrics_path: {{ .Values.javaPrometheusMetricsEndpoint }}
sample_limit: {{javaScrapeSampleLimit}}
metrics_path: {{javaPrometheusMetricsEndpoint}}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down Expand Up @@ -1650,8 +1650,8 @@ spec:
{{ start enableNginxMonJob }}
- job_name: 'kubernetes-nginx'
sample_limit: {{ .Values.nginxScrapeSampleLimit }}
metrics_path: {{ .Values.nginxPrometheusMetricsEndpoint }}
sample_limit: {{nginxScrapeSampleLimit}}
metrics_path: {{nginxPrometheusMetricsEndpoint}}
kubernetes_sd_configs:
- role: pod
relabel_configs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as eks from 'aws-cdk-lib/aws-eks';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import { ObservabilityBuilder } from '@aws-quickstart/eks-blueprints';
import * as fs from 'fs';
import { IstioIngressGatewayHelmAddon } from './istio/istioIngressGatewayAddon';
import { IstioCniHelmAddon } from './istio/istiocniAddon';

export default class SingleNewEksGravitonOpenSourceObservabilityPattern {
constructor(scope: Construct, id: string) {
Expand Down Expand Up @@ -43,8 +45,26 @@ export default class SingleNewEksGravitonOpenSourceObservabilityPattern {
let doc = utils.readYamlDocument(__dirname + '/../common/resources/otel-collector-config.yml');
doc = utils.changeTextBetweenTokens(
doc,
"{{ if enableAPIserverJob }}",
"{{ end }}",
"{{ start enableJavaMonJob }}",
"{{ stop enableJavaMonJob }}",
jsonStringnew.context["java.pattern.enabled"]
);
doc = utils.changeTextBetweenTokens(
doc,
"{{ start enableNginxMonJob }}",
"{{ stop enableNginxMonJob }}",
jsonStringnew.context["nginx.pattern.enabled"]
);
doc = utils.changeTextBetweenTokens(
doc,
"{{ start enableIstioMonJob }}",
"{{ stop enableIstioMonJob }}",
jsonStringnew.context["istio.pattern.enabled"]
);
doc = utils.changeTextBetweenTokens(
doc,
"{{ start enableAPIserverJob }}",
"{{ stop enableAPIserverJob }}",
jsonStringnew.context["apiserver.pattern.enabled"]
);
doc = utils.changeTextBetweenTokens(
Expand Down Expand Up @@ -83,6 +103,29 @@ export default class SingleNewEksGravitonOpenSourceObservabilityPattern {
);
}

if (utils.valueFromContext(scope, "nginx.pattern.enabled", false)) {
ampAddOnProps.openTelemetryCollector = {
manifestPath: __dirname + '/../common/resources/otel-collector-config-new.yml',
manifestParameterMap: {
nginxScrapeSampleLimit: 1000,
nginxPrometheusMetricsEndpoint: "/metrics"
}
};
ampAddOnProps.ampRules?.ruleFilePaths.push(
__dirname + '/../common/resources/amp-config/nginx/alerting-rules.yml'
);
}

if (utils.valueFromContext(scope, "istio.pattern.enabled", false)) {
ampAddOnProps.openTelemetryCollector = {
manifestPath: __dirname + '/../common/resources/otel-collector-config-new.yml'
};
ampAddOnProps.ampRules?.ruleFilePaths.push(
__dirname + '/../common/resources/amp-config/istio/alerting-rules.yml',
__dirname + '/../common/resources/amp-config/istio/recording-rules.yml'
);
}

Reflect.defineMetadata("ordered", true, blueprints.addons.GrafanaOperatorAddon);
const addOns: Array<blueprints.ClusterAddOn> = [
new blueprints.addons.CloudWatchLogsAddon({
Expand All @@ -94,10 +137,23 @@ export default class SingleNewEksGravitonOpenSourceObservabilityPattern {
new GrafanaOperatorSecretAddon(),
];

if (utils.valueFromContext(scope, "istio.pattern.enabled", false)) {
addOns.push(new blueprints.addons.IstioBaseAddOn({
version: "1.18.2"
}));
addOns.push(new blueprints.addons.IstioControlPlaneAddOn({
version: "1.18.2"
}));
addOns.push(new IstioIngressGatewayHelmAddon);
addOns.push(new IstioCniHelmAddon);
}

const mngProps: blueprints.MngClusterProviderProps = {
version: eks.KubernetesVersion.of("1.27"),
instanceTypes: [new ec2.InstanceType("m7g.large")],
amiType: eks.NodegroupAmiType.AL2_ARM_64,
desiredSize: 2,
maxSize: 3,
};

ObservabilityBuilder.builder()
Expand Down
6 changes: 5 additions & 1 deletion lib/single-new-eks-opensource-observability-pattern/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ export default class SingleNewEksOpenSourceobservabilityPattern {

if (utils.valueFromContext(scope, "nginx.pattern.enabled", false)) {
ampAddOnProps.openTelemetryCollector = {
manifestPath: __dirname + '/../common/resources/otel-collector-config-new.yml'
manifestPath: __dirname + '/../common/resources/otel-collector-config-new.yml',
manifestParameterMap: {
nginxScrapeSampleLimit: 1000,
nginxPrometheusMetricsEndpoint: "/metrics"
}
};
ampAddOnProps.ampRules?.ruleFilePaths.push(
__dirname + '/../common/resources/amp-config/nginx/alerting-rules.yml'
Expand Down

0 comments on commit 213f48a

Please sign in to comment.