-
Notifications
You must be signed in to change notification settings - Fork 115
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
Kubernetes Resource Naming Convention Needs Rethinking #1689
Comments
URNs are defined by the name of the Pulumi resource which doesn't have to match the actual resource name in the provider's target. If you have two K8s clusters in the same stack, you need to give them unique Pulumi names. The same applies to other resource types. Component resources will usually use the parent name to build up the children names. Do you want to share some code where you think it's problematic? |
The problem is deploying the resources. Pulumi doesn't use the provider name or k8s name in the URN of the resources. So if you deploy the same resources to two different k8s clusters, Pulumi generates the same URN. As an example, try using _, err = k8syaml.NewConfigFile(ctx, clusterName+"_aws_secrets_store_provider", &k8syaml.ConfigFileArgs{
File: "aws-provider-installer.yaml",
}, provider)
if err != nil {
return err
} On two different clusterNames and providers configured for two different k8s clusters. Pulumi still thinks it's managing the same resources meanwhile they're on different k8s clusters. |
I ended up just writing everything in that yaml in the equivalent resource code by hand, but that api is pretty broken. Should at least use the logical name given to help make things unique. |
I have the same problem using the Pulumi TypeScript SDK and Azure-native Kubernetes 👍 |
The solution is to use the _, err = k8syaml.NewConfigFile(ctx, "cluster1", &k8syaml.ConfigFileArgs{
File: "aws-provider-installer.yaml",
ResourcePrefix: "cluster1",
}, provider)
_, err = k8syaml.NewConfigFile(ctx, "cluster2", &k8syaml.ConfigFileArgs{
File: "aws-provider-installer.yaml",
ResourcePrefix: "cluster2",
}, provider) Note that the "v2" version of the |
Attempting to spin up two separate k8s clusters within the same stack, both of which run generic services (external-dns, cert-manager, etc) fails due to URN naming convention. It seems that URN should include the cluster name, so as to facilitate this requirement. This problem becomes more pronounced when deploying CRDs, where its not possible to modify the resource/CRD name.
Steps to reproduce
Deploy two K8S clusters within the same stack, both of which are running cert-manager. Pulumi will fail due to lack of unique URNs.
The text was updated successfully, but these errors were encountered: