-
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
[aws-eks] ServiceAccount property references do not result in dependencies #9910
Comments
Added edit above:
|
@otterley Thats an interesting issue. Implicit dependencies between resources are created when one resource uses an attribute of another resource, in the form of a token. In this case, while it looks like one, const appMeshController = cluster.addChart("appmesh-controller", {
chart: "appmesh-controller",
repository: "https://aws.github.io/eks-charts",
namespace: "appmesh-system",
createNamespace: false,
release: "appmesh-controller",
values: {
region: this.region,
serviceAccount: {
create: false,
// Expectation is that the following creates an implicit dependency
name: 'appmesh-controller',
},
},
wait: true,
}); And in fact there is no real reference between the controller and the service account. Having said that, I do agree its confusing, and needed. One solution to this would be to actually have This would force the retrieval of I'm going to mark this as a feature request rather than a bug. In the meantime, one can declare an explicit dependency: appMeshController.node.addDependency(appMeshControllerServiceAccount) |
Correction As mentioned by @otterley, even declaring this dependency directly will not work because of #8884. The service account manifest resource itself is not added as a child of the Verified that this PR will fix that as well. As a workaround for now, you can locate the inner resource and add it as a dependency as well: const appMeshControllerServiceAccountManifestResource = appMeshControllerServiceAccount.node.findChild('manifest-AppMeshServiceAccountResource');
appMeshController.node.addDependency(appMeshControllerServiceAccount);
appMeshController.node.addDependency(appMeshControllerServiceAccountManifestResource); |
I disagree that it's unnecessary. While it may be unnecessary for stack creation, it is quite often needed for stack destruction to work properly. Any K8S CRD controller that relies on a service account to work properly must not have its service account destroyed before the controller itself is. Otherwise it will be impossible to delete the CRDs that are managed by the controller. |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
CDK does not currently establish any sort of dependency--implicit or otherwise--between a
ServiceAccount
construct and any EKS resources that refer to its properties, such asHelmChart
s andKubernetesManifest
s. This can result in the service account being destroyed before a dependent CRD controller is destroyed. This can cause ordering failures on stack destruction.Consider the following sequence of events:
At root, the issue seems to be that
ServiceAccount
s are not associated with first-class Custom Resources. Thename
andnamespace
parameters are not formal CloudFormation parameters, which can be used as references by other CF Resources. Instead, an ordinaryKubernetesResource
is created, and thename
andnamespace
parameters are interned into the K8S resource JSON.Nor does CDK create any explicit dependencies between a service account and its consumer by way of a
DependsOn
key in the rendered template.❗ In fact, further testing shows that it is not even possible to explicitly declare a dependency between a
ServiceAccount
and a dependent resource. No error results, but no dependency is created, either.Reproduction Steps
Rendered template fragment:
What did you expect to happen?
I expected an implicit dependency to be created on the serviceAccount by the chart.
What actually happened?
No such dependency was created.
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: