wonderful-pillow-93632
10/09/2024, 10:10 AMdependsOn
to specify which cluster to create it in. I tried to use:
const cluster = containerservice.getManagedClusterOutput({
resourceGroupName: clusterRgName,
resourceName: clusterName
})
const namespace = new kubernetes.core.v1.Namespace(
"Create namespace",
{
metadata: { name: "my-namespace" },
}, {
dependsOn: [cluster] // Type 'GetManagedClusterResult' is missing the following properties from type 'Resource': urn, getProvider
}
);
But this returns a GetManagedClusterResult
not a pulumi.Resource
. How would I go about fetching the actual resource in a different stack, is it possible?adventurous-butcher-54166
10/10/2024, 11:23 AMdependsOn
is for defining dependencies within a single stack deployment. To configure pulumi-kubernetes operations to run against your cluster you'd
• Use listManagedClusterUserCredentialsOutput to get the kubeconfig
output for the cluster:
• Define a pulumi Kubernetes Provider using the fetched kubeconfig
• And for all your pulumi-kubernetes
operations to use that provider set the CustomResourceOptions
provider
parameter to the provider instance you defined
Have a look at this example for how to define the provider:
https://github.com/pulumi/examples/blob/master/azure-ts-aks-helm/cluster.ts#L56-L66
And here you can see an example of how it's used:
https://github.com/pulumi/examples/blob/master/azure-ts-aks-helm/index.ts#L12-L22salmon-guitar-84472
10/14/2024, 6:34 AMvar clusterStack = new StackReference("clusterproject/cluster1");
var clusterRgName = clusterStack.RequireOutput("clusterRgName").Apply(s => s?.ToString() ?? string.Empty);
var clusterName = clusterStack.RequireOutput("clusterName").Apply(s => s?.ToString() ?? string.Empty);
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by