pulumi / pulumi-eks

A Pulumi component for easily creating and managing an Amazon EKS Cluster
https://www.pulumi.com/registry/packages/eks/
Apache License 2.0
171 stars 80 forks source link

Parameterize all endpoint/namespace values so that all AWS regions work properly #571

Open lblackstone opened 3 years ago

lblackstone commented 3 years ago

Hello!

The EKS package currently hardcodes a number of values specific to the default US regions, which breaks usage in other regions (aws-global/aws-cn/aws-us-gov). While it is possible to work around the issue using transformations, the package logic should be parameterized to handle different regions appropriately.

The following issues are related: https://github.com/pulumi/pulumi-eks/issues/570 https://github.com/pulumi/pulumi-eks/issues/534 https://github.com/pulumi/pulumi-eks/issues/386

arunsisodiya commented 2 years ago

@lblackstone - Any update on this? When this can be solved and pulumi-eks provides support for China?

I am also stuck with this now and cannot create cluster in China region.

lblackstone commented 2 years ago

Can you check if the transformations workaround works for you?

I don't have an update on scheduling for this issue, but you can upvote issues to help us determine priority.

arunsisodiya commented 2 years ago

@lblackstone - I was trying the transformation workaround but can you please tell me how that can be used? I am quite new to typescript so don't know that.

Do I have to put that snippet in index.ts as it is or do I need to create some method etc?

Can you share with me a working .ts file?

geNAZt commented 2 years ago

We currently have this problem with private link on eu-central-1 ECR. If done so the default EKS setup doesn't work anymore since it wants to pull images from us-west-1. Being able to set the region or letting pulumi auto detect the correct ECR region for system images would be good.

worldzhy commented 2 years ago

@lblackstone - I was trying the transformation workaround but can you please tell me how that can be used? I am quite new to typescript so don't know that.

Do I have to put that snippet in index.ts as it is or do I need to create some method etc?

Can you share with me a working .ts file?

const cluster = new eks.Cluster(
      this.clusterName,
      {
        instanceType: this.instanceType,
        desiredCapacity: this.desiredNodeNumber,
        minSize: this.minNodeNumber,
        maxSize: this.maxNodeNumber,
        enabledClusterLogTypes: [
          'api',
          'audit',
          'authenticator',
          'controllerManager',
          'scheduler',
        ],
      },
      {
        transformations: [
          // Update all RolePolicyAttachment resources to use aws-cn ARNs.
          args => {
            if (
              args.type === 'aws:iam/rolePolicyAttachment:RolePolicyAttachment'
            ) {
              const arn: string | undefined = args.props['policyArn'];
              if (arn && arn.startsWith('arn:aws:iam')) {
                args.props['policyArn'] = arn.replace(
                  'arn:aws:iam',
                  'arn:aws-cn:iam'
                );
              }
              return {
                props: args.props,
                opts: args.opts,
              };
            }
            return undefined;
          },
        ],
      }
    );
tonybutt commented 2 years ago

@lblackstone Can I get an example of this exact transformation in golang, for govcloud?

tonybutt commented 2 years ago

@lblackstone https://github.com/pulumi/pulumi-eks/pull/785

I am just using the already imported pulumi classic to fetch the Partition during the run.