brief-vr-24049
06/10/2022, 4:45 AMk8s.Provider
with a kubeconfig
that is an Output<string>
(from a kubernetes cluster dynamic resource). The k8s.Provider
seems to accept a type Input<string>
for kubeconfig
but when I then try to use this provider with a k8s.yaml.ConfigFile
, I get the error: error: TypeError: Cannot read property 'map' of undefined
from @pulumi\yaml\yaml.ts:2993:14
. The problem goes away if I use a string
for kubeconfig
instead, but I can't do that in this case because the cluster isn't created yet.
It looks like I could work around this by putting this all in an .apply
, but then I'm allocating resources in an apply which seems like a bad idea? Is this possible to do/am I doing something wrong?little-cartoon-10569
06/10/2022, 4:49 AMInput<string>
can take `Output<string>`s. Is it not working if you just the kubeconfig directly?brief-vr-24049
06/10/2022, 4:50 AMTypeError: Cannot read property 'map' of undefined
when I try to use the providerlittle-cartoon-10569
06/10/2022, 4:50 AMbrief-vr-24049
06/10/2022, 4:51 AMnew k8s.yaml.ConfigFile("k8s-kubernetes-dashboard-yaml", { file: `${__dirname}/yaml/kubernetes-dashboard.yaml` }, { provider });
string
rather than an Output<string>
, even though it looks like an Output<string>
should be accepted?little-cartoon-10569
06/10/2022, 4:53 AMbrief-vr-24049
06/10/2022, 4:54 AMexport const provider = new k8s.Provider("production", {
cluster: productionCluster.clusterName,
kubeconfig,
});
productionCluster.clusterName
and kubeconfig
are of type Output<string>
, but the cluster
doesn't seem to be the issuekubeconfig
that causes itlittle-cartoon-10569
06/10/2022, 4:55 AMbrief-vr-24049
06/10/2022, 4:56 AMnode_modules\@pulumi\yaml\yaml.ts:2993:14
is referring to? There doesn't seem to be a file in node_modules by that name, so I can't look at that codeThe contents of a kubeconfig file or the path to a kubeconfig file.
little-cartoon-10569
06/10/2022, 5:10 AMbrief-vr-24049
06/10/2022, 5:14 AMlittle-cartoon-10569
06/10/2022, 5:29 AMbrief-vr-24049
06/10/2022, 5:32 AMhappy-raincoat-89168
06/23/2022, 8:06 PM{ provider: cluster.provider }
should make it work, but I’m getting the 'map' of undefined
error too.brief-vr-24049
06/23/2022, 8:07 PMhappy-raincoat-89168
06/23/2022, 8:08 PMConfigFIle
line and do pulumi up
, the cluster comes up successfully. Then if I include the ConfigFile
line again, that manifest successfully deploys. They just don’t like to deploy from 0 to both cluster and manifest deployed on the same pulumi up
. Do you see the same behavior?brief-vr-24049
06/23/2022, 8:09 PMhappy-raincoat-89168
06/23/2022, 8:09 PMbrief-vr-24049
06/23/2022, 8:10 PMPromise<k8s.Provider>
that read the private field isKnown
off of the output. And then where I wanted to use the Provider, I did it with a .then
.billowy-army-68599
06/23/2022, 8:10 PMbrief-vr-24049
06/23/2022, 8:10 PMconst provider = new Promise<k8s.Provider>(res => {
(kubeconfig as unknown as { isKnown: Promise<boolean> }).isKnown.then(known => {
if (known) {
res(kubeProvider);
}
console.log("Kubeconfig is not known, so skipping kubernetes resource preview may be inaccurate!.");
// We don't call rej here because this is not an error we want to fail on. Instead, things waiting for this provider will hang and not be created.
});
});
provider.then(provider => {
new k8s.core.v1.Namespace("some-namespace", { provider });
});
billowy-army-68599
06/23/2022, 8:11 PMbrief-vr-24049
06/23/2022, 8:11 PMhappy-raincoat-89168
06/23/2022, 8:11 PMbrief-vr-24049
06/23/2022, 8:12 PMhappy-raincoat-89168
06/23/2022, 8:14 PMconst namespace = new k8s.core.v1.Namespace(`${ns}-ns`,
{
metadata: {
name: ns,
labels: {
'<http://app.kubernetes.io/name|app.kubernetes.io/name>': 'aws-load-balancer-controller',
}
}
},
{
provider: cluster.provider,
parent: cluster.provider
});
brief-vr-24049
06/23/2022, 8:15 PMhappy-raincoat-89168
06/23/2022, 8:16 PMbrief-vr-24049
06/23/2022, 8:16 PMk8s.yaml.ConfigFile
that was initially causing me issues.happy-raincoat-89168
06/23/2022, 8:16 PMbrief-vr-24049
06/23/2022, 8:16 PMhappy-raincoat-89168
06/23/2022, 8:17 PMkubeProvider
come from in your workaround?brief-vr-24049
06/23/2022, 8:24 PMconst kubeProvider = new k8s.Provider("production", {
cluster: productionKubernetes.clusterName,
kubeconfig,
});
kubeconfig
is an pulumi.Output<string>
happy-raincoat-89168
06/23/2022, 8:45 PM