Skip to content
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

fix(eks): unable to create KubernetesResources in another stack #7322

Merged
merged 3 commits into from
Apr 13, 2020

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Apr 12, 2020

Commit Message

fix(eks): unable to create KubernetesResources in another stack (#7322)

kubectl resources such as KubernetesResource and HelmCharts require a custom resource provider. We used to create the resource provider in the stack in which the k8s resource was defined but this resulted in a cyclic reference since the eks.Cluster needs to reference the resource provider and the k8s resource needs to reference the cluster.

The solution is that the kubectl resource provider is always created in the stack in which the cluster is defined. This makes sure that references always go in one direction (and also makes much more sense).

Fixes #7231

End Commit Message


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

kubectl resources such as KubernetesResource and HelmCharts require a custom resource provider. We used to create the resource provider in the stack in which the k8s resource was defined but this resulted in a cyclic reference since the eks.Cluster needs to reference the resource provider and the k8s resource needs to reference the cluster.

The solution is that the kubectl resource provider is always created in the stack in which the cluster is defined. This makes sure that references always go in one direction (and also makes much more sense).

Fixes #7231
@eladb eladb requested a review from a team April 12, 2020 11:43
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 12, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 397752c
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

packages/@aws-cdk/aws-eks/test/test.cluster.ts Outdated Show resolved Hide resolved
Comment on lines +688 to +690
if (!this._clusterResource) {
throw new Error('Unable to perform this operation since kubectl is not enabled for this cluster');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there already an existing unit test that covers this?

minor: also maybe simplify error message. since it's internal I think it reads easier as kubectl is not enabled for this cluster. <how to reconcile if possible to fix error>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a test that covers this use case. The error indicates that kubectl is not enabled and that's the possible fix.

@eladb eladb requested a review from shivlaks April 13, 2020 04:09
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 9f0ea2b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Apr 13, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 587232d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Apr 13, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 54129c8 into master Apr 13, 2020
@mergify mergify bot deleted the benisrae/fix/eks-k8s-in-different-stack branch April 13, 2020 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
3 participants