UNPKG

eks-for-prod

Version:

EKS Cluster + EFS Filesystem + Aurora Serverless Cluster

39 lines (38 loc) 1.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AwsLoadBalancerController = void 0; const core_1 = require("@aws-cdk/core"); const aws_load_balancer_driver_policy_1 = require("./service-account-policies/aws-load-balancer-driver-policy"); const service_account_with_policy_1 = require("./service-account-with-policy"); const utils_1 = require("./utils"); class AwsLoadBalancerController extends core_1.Construct { constructor(scope, id, props) { super(scope, id); const serviceAccount = new service_account_with_policy_1.ServiceAccountWithPolicy(this, 'AlbControllerServiceAccount', { cluster: props.cluster, serviceAccountName: 'aws-load-balancer-controller', jsonPolicy: aws_load_balancer_driver_policy_1.awsLoadBalancerDriverPolicy }).serviceAccount; const crds = utils_1.Utils.applyYamlManifest(props.cluster, 'aws-load-balancer-controller-crds'); const helmChart = props.cluster.addHelmChart('AWSLoabBalancerControllerHelmChart', { release: 'aws-load-balancer-controller', chart: 'aws-load-balancer-controller', repository: 'https://aws.github.io/eks-charts', namespace: 'kube-system', values: { clusterName: props.cluster.clusterName, serviceAccount: { create: false, name: serviceAccount.serviceAccountName } } }); /** * Weird workaround - keep an eye on permanent solution. Found on: * https://github.com/aws/aws-cdk/issues/11475#issuecomment-727552723 and * https://github.com/aws/aws-cdk/issues/11475#issuecomment-736384696 */ helmChart.node.addDependency(serviceAccount, serviceAccount.node.findChild('manifest-aws-load-balancer-controllerServiceAccountResource'), crds); } } exports.AwsLoadBalancerController = AwsLoadBalancerController;