-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(eks): connect all custom resources to the cluster VPC #10200
Changes from 12 commits
18716b0
e118ff0
9b59197
90bcfec
6689a47
fed2509
07bc09e
b9840c6
0c93866
cd3dc87
d40f718
68a625d
9407f5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -428,6 +428,13 @@ export interface ClusterOptions extends CommonClusterOptions { | |||||
*/ | ||||||
readonly kubectlEnvironment?: { [key: string]: string }; | ||||||
|
||||||
/** | ||||||
* Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle. | ||||||
* | ||||||
* @default - No environment variables. | ||||||
*/ | ||||||
readonly clusterHandlerEnvironment?: { [key: string]: string }; | ||||||
|
||||||
/** | ||||||
* An AWS Lambda Layer which includes `kubectl`, Helm and the AWS CLI. | ||||||
* | ||||||
|
@@ -468,6 +475,14 @@ export interface ClusterOptions extends CommonClusterOptions { | |||||
* @default true | ||||||
*/ | ||||||
readonly prune?: boolean; | ||||||
|
||||||
/** | ||||||
* If set to true, the cluster handler functions will be placed in the private subnets | ||||||
* of the cluster vpc, subject to the `vpcSubnets` selection strategy. | ||||||
* | ||||||
* @default false | ||||||
*/ | ||||||
readonly placeClusterHandlerInVpc?: boolean; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would make sense to use a similar prefix:
Suggested change
|
||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -859,7 +874,6 @@ export class Cluster extends ClusterBase { | |||||
|
||||||
/** | ||||||
* Custom environment variables when running `kubectl` against this cluster. | ||||||
* @default - no additional environment variables | ||||||
*/ | ||||||
public readonly kubectlEnvironment?: { [key: string]: string }; | ||||||
|
||||||
|
@@ -1020,8 +1034,15 @@ export class Cluster extends ClusterBase { | |||||
throw new Error('Vpc must contain private subnets when public endpoint access is restricted'); | ||||||
} | ||||||
|
||||||
const placeClusterHandlerInVpc = props.placeClusterHandlerInVpc ?? false; | ||||||
|
||||||
if (placeClusterHandlerInVpc && privateSubents.length === 0) { | ||||||
throw new Error('Cannot place cluster handler in the VPC since no private subnets could be selected'); | ||||||
} | ||||||
|
||||||
const resource = this._clusterResource = new ClusterResource(this, 'Resource', { | ||||||
name: this.physicalName, | ||||||
environment: props.clusterHandlerEnvironment, | ||||||
roleArn: this.role.roleArn, | ||||||
version: props.version.version, | ||||||
resourcesVpcConfig: { | ||||||
|
@@ -1041,6 +1062,7 @@ export class Cluster extends ClusterBase { | |||||
publicAccessCidrs: this.endpointAccess._config.publicCidrs, | ||||||
secretsEncryptionKey: props.secretsEncryptionKey, | ||||||
vpc: this.vpc, | ||||||
subnets: placeClusterHandlerInVpc ? privateSubents : undefined, | ||||||
}); | ||||||
|
||||||
if (this.endpointAccess._config.privateAccess && privateSubents.length !== 0) { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,8 @@ export class KubectlProvider extends NestedStack { | |
|
||
const provider = new cr.Provider(this, 'Provider', { | ||
onEventHandler: handler, | ||
vpc: cluster.kubectlPrivateSubnets ? cluster.vpc : undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't related to the |
||
vpcSubnets: cluster.kubectlPrivateSubnets ? { subnets: cluster.kubectlPrivateSubnets } : undefined, | ||
}); | ||
|
||
this.serviceToken = provider.serviceToken; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the kubectl handler?