Skip to content

Commit

Permalink
Added Function for Cluster Logging (#867)
Browse files Browse the repository at this point in the history
* Added control plane logging as a default in the observability builder

* Moved cluster logging to its own method

* Added documentation for the new method

* Fixed a broken link in new-relic's documentation
  • Loading branch information
5herlocked authored Oct 30, 2023
1 parent 9582a82 commit d826223
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/addons/newrelic.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ After installing the New Relic add-on, you can validate a successful installatio
| pixieApiKey | string | | Pixie Api Key can be obtained in New Relic's Guided Install for Kubernetes (plaintext). Use `awsSecretName` instead for AWS Secrets Manager support and added security. |
| pixieDeployKey | string | | Pixie Deploy Key can be obtained in New Relic's Guided Install for Kubernetes - (plaintext). Use `awsSecretName` instead for AWS Secrets Manager support and added security. |
| namespace | string | | The namespace where New Relic components will be installed. Defaults to `newrelic`. |
| lowDataMode | boolean | | Default `true`. Set to `false` to disable `lowDataMode` . For more details, visit the [Reducing Data Ingest Docs](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/install-kubernetes-integration-using-helm/#reducedataingest) |
| lowDataMode | boolean | | Default `true`. Set to `false` to disable `lowDataMode` . For more details, visit the [Reducing Data Ingest Docs](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/reduce-ingest/) |
| installInfrastructure | boolean | | Default `true` . Set to `false` to disable installation of the New Relic Infrastructure Daemonset. |
| installKSM | boolean | | Default `true` . Set to `false` to disable installation of Kube State Metrics. An instance of KSM is required in the cluster for the New Relic Infrastructure Daemonset to function properly. |
| installKubeEvents | boolean | | Default `true` . Set to `false` to disable installation of the New Relic Kubernetes Events integration. |
Expand Down
3 changes: 3 additions & 0 deletions docs/builders/observability-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The `ObservabilityBuilder` allows you to get started with a builder class to con
- `enableNativePatternAddOns`: This method helps you prepare a blueprint for setting up observability with AWS native services
- `enableMixedPatternAddOns`: This method helps you prepare a blueprint for setting up observability with AWS managed open source services
- `enableOpenSourcePatternAddOns`: This method helps you prepare a blueprint for setting up observability with a combination of AWS native and AWS managed open source services
- `enableControlPlaneLogging`: This method activates all the control plane logging features for EKS Clusters and feeds them into CloudWatch

## Usage

Expand Down Expand Up @@ -43,6 +44,7 @@ export default class SingleNewEksConstruct {
.account(account)
.region(region)
.enableNativePatternAddOns()
.enableControlPlaneLogging()
.addOns(...addOns)
.build(scope, stackId);
}
Expand Down Expand Up @@ -112,6 +114,7 @@ export default class ExistingEksMixedobservabilityConstruct {
.account(account)
.region(region)
.enableMixedPatternAddOns()
.enableControlPlaneLogging()
.clusterProvider(importClusterProvider)
.resourceProvider(blueprints.GlobalResources.Vpc, new blueprints.VpcProvider(vpcId))
.addOns(...addOns)
Expand Down
27 changes: 22 additions & 5 deletions lib/builders/observability-builder.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BlueprintBuilder } from '../stacks';
import {BlueprintBuilder, ControlPlaneLogType} from '../stacks';
import * as addons from '../addons';
import * as utils from "../utils";
import {cloneDeep} from "../utils";
import * as spi from '../spi';
import { NestedStack, NestedStackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { cloneDeep } from '../utils';
import {NestedStack, NestedStackProps} from 'aws-cdk-lib';
import {Construct} from 'constructs';

export class ObservabilityBuilder extends BlueprintBuilder {

Expand Down Expand Up @@ -88,6 +88,21 @@ export class ObservabilityBuilder extends BlueprintBuilder {
new addons.PrometheusNodeExporterAddOn(this.prometheusNodeExporterProps));
}

/**
* Enables control plane logging.
*
* @returns {ObservabilityBuilder} - The ObservabilityBuilder instance with control plane logging enabled.
*/
public enableControlPlaneLogging(): ObservabilityBuilder {
return this.enableControlPlaneLogTypes(
ControlPlaneLogType.API,
ControlPlaneLogType.AUDIT,
ControlPlaneLogType.AUTHENTICATOR,
ControlPlaneLogType.CONTROLLER_MANAGER,
ControlPlaneLogType.SCHEDULER
);
}

public withAwsLoadBalancerControllerProps(props: addons.AwsLoadBalancerControllerProps) : this {
this.awsLoadbalancerProps = { ...this.awsLoadbalancerProps, ...cloneDeep(props) };
return this;
Expand Down Expand Up @@ -147,6 +162,7 @@ export class ObservabilityBuilder extends BlueprintBuilder {
this.ampProps = { ...this.ampProps, ...cloneDeep(props) };
return this;
}

/**
* This method helps you prepare a blueprint for setting up observability with
* usage tracking addon
Expand All @@ -157,7 +173,8 @@ export class ObservabilityBuilder extends BlueprintBuilder {
new addons.NestedStackAddOn({
id: "usage-tracking-addon",
builder: UsageTrackingAddOn.builder(),
}));
})
);
return builder;
}
}
Expand Down

0 comments on commit d826223

Please sign in to comment.