constructor()

in observability/lib/container-insights-stack.ts [10:30]


  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const cluster = importCluster(this, process.env.CLUSTER_NAME)
    const clusterName = cluster.clusterName;

    // SA for Application
    const sa = new eks.ServiceAccount(this, "AmazonCloudwatchSA", {
      cluster,
      name: "cloudwatch-agent",
      namespace: "amazon-cloudwatch",
    });
    sa.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName("CloudWatchAgentServerPolicy"));

    // CW Agent
    manifestUtils.applyManifest(path.resolve("resources/cwagent-rbac.yaml"), cluster);
    const configMap = manifestUtils.applyManifest(path.resolve("resources/cwagent-configmap.yaml"), cluster);
    const daemonSet = manifestUtils.applyManifest(path.resolve("resources/cwagent-daemonset.yaml"), cluster);
    daemonSet.node.addDependency(sa);
    daemonSet.node.addDependency(configMap);
  }