p

    polite-napkin-90098

    2 months ago
    I'm having fun trying to make my EKS cluster work with ALB. There's some docs here https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html I'm adding in the roles I need for that and installing the controller from the helm chart in the same pulumi typescript script which creates the EKS cluster. When I try to get the name of the cluster to pass into the helm chart using
    cluster.name
    I get a compile error saying:
    TSError: ⨯ Unable to compile TypeScript:
        index.ts(427,24): error TS2339: Property 'name' does not exist on type 'Cluster'.
    but looking in the docshttps://www.pulumi.com/registry/packages/eks/api-docs/cluster/#name_nodejs it has name as an input and all inputs are outputs, so why doesn't that work. To prove it wasn't some other issue, like the cluster var being the wrong type of object or something I tried
    cluster.core.vpcId
    and then the TS compiles fine but obviously the ClusterName is set wrong in the helm chart.
    b

    billowy-army-68599

    2 months ago
    p

    polite-napkin-90098

    2 months ago
    Thanks I'll take a look at that
    b

    billowy-army-68599

    2 months ago
    can you share the code you have? I think you’re looking for cluster.core.name
    p

    polite-napkin-90098

    2 months ago
    // Create an EKS cluster
    const cluster = new eks.Cluster(nam, {
            vpcId: vpcid,
            privateSubnetIds: [ privsub[0], privsub[1] ],
            publicSubnetIds: [ pubsub[0], pubsub[1] ],
            clusterSecurityGroup: sg,
            endpointPrivateAccess: true,
            endpointPublicAccess: false,
            enabledClusterLogTypes: ["api", "audit", "authenticator", "controllerManager", "scheduler"],
            nodeAssociatePublicIpAddress: false,
            instanceType: "t3a.medium",
            maxSize: 10,
            minSize: 2,
            serviceRole: serviceRole,
            createOidcProvider: true,
            useDefaultVpcCni: true,
            roleMappings: [
                    {
                            groups: [ "system:masters" ],
                            roleArn: adminVMrole.arn,
                            username: "admin",
                    },
            ],
    });
    That's the call to the eks.cluster function
    b

    billowy-army-68599

    2 months ago
    and you’re trying to grab the cluster name?
    p

    polite-napkin-90098

    2 months ago
    yeah
    // deploy the helm chart for the ALB Controller
    const albController = new k8s.helm.v3.Release("albController", {
            repositoryOpts: {           
                    repo: "<https://aws.github.io/eks-charts>",
            },                          
            chart: "aws-load-balancer-controller",
            namespace: "kube-system",   
            values: {                   
                    image: {            
                            reposistory: "<http://602401143452.dkr.ecr.us-east-2.amazonaws.com/amazon/aws-load-balancer-controller|602401143452.dkr.ecr.us-east-2.amazonaws.com/amazon/aws-load-balancer-controller>",
                    },                  
                    clusterName: cluster.name,
                    serviceAccount: {   
                            annotations: {
                                    "<http://eks.amazonaws.com/role-arn|eks.amazonaws.com/role-arn>": albControllerRole.arn,
                            },          
                    },                  
            },                          
    }, { provider: cluster.provider });
    that's the helm.Release call
    cluster.name
    b

    billowy-army-68599

    2 months ago
    export const clusterName = cluster.eksCluster.name
    p

    polite-napkin-90098

    2 months ago
    thanks I'll try that
    seems to be compiling
    and has the right name
    thanks @billowy-army-68599
    b

    billowy-army-68599

    2 months ago
    👍