https://pulumi.com logo
#general
Title
# general
w

worried-city-86458

09/25/2019, 5:41 AM
Not sure how to make sure the namespace is created first and not get this warning
r

rhythmic-finland-36256

09/25/2019, 12:43 PM
I think the issue is that you are referencing the output of the namespace resource as a value which is required during templating. What about using a variable containing the namespace name and passing that to the namespace resource AND to the helm chart instead of using the output
monitoringNamespace.metadata.name
? This is how it works fine for me. I assume that templating is already done for preview and in that case it is missing the resolved output value.
Like so:
Copy code
const monitoringNamespaceName = "monitoring";
const monitoringNamespace = new k8s.core.v1.Namespace("monitoring", { metadata: { name: monitoringNamespaceName } }, { provider : provider });

const prometheusOperatorChart = new k8s.helm.v2.Chart("po", {
    repo: "stable",
    chart: "prometheus-operator",
    namespace: monitoringNamespaceName,
    values: {
        alertmanager: { persistentVolume: { storageClass: "gp2" } },
        server: { persistentVolume: { storageClass: "gp2" } }
    }
}, { provider: provider });
w

worried-city-86458

09/25/2019, 6:40 PM
Maybe I'm confused but I thought referring to the namespace resource output would resolve
Yes, I could refer to the same constant, but say the namespace generated the name (if I didn't specify it explicitly), then I'd need to refer to it like I'm trying to.
r

rhythmic-finland-36256

09/25/2019, 10:51 PM
I get your point and think this should not be a limitation to take (not using generated names). Maybe it’s just a matter of being in the preview phase when the final name does not exist yet? Is that an error or just a warning during preview? I also ran into some cases where preview was too cautious and assumed a replacement where an in-place-update would have worked but this information was not available during preview.
w

worried-city-86458

09/25/2019, 11:48 PM
Not sure but I think it's a warning:
Copy code
root@ebea11107491:/workspaces/workspace/k8s-infra# p up --suppress-outputs 
Previewing update (org/dev):

     Type                          Name           Plan       Info
     pulumi:pulumi:Stack           k8s-infra-dev             
 +   ├─ kubernetes:helm.sh:Chart   po             create     1 message
 +   └─ kubernetes:core:Namespace  monitoring     create     
 
Diagnostics:
  kubernetes:helm.sh:Chart (po):
    [Can't preview] all chart values must be known ahead of time to generate an accurate preview.
 
Resources:
    + 2 to create
    15 unchanged
In other cases, I thought I remember seeing the preview showed a placeholder for any yet to be derived outputs?
The preview is kinda essential when dealing with these big helm templates
Interesting issue that shows an example using
namespace: myns.metadata.name
, which is how I expected to be able to refer to the namespace name, with the output being lifted.
s

stocky-island-3676

11/08/2019, 3:28 PM
For reference (this is the first search result on “helm namespace preview”): The underlying issue is discussed in more detail (with Pulumi devs) here: https://pulumi-community.slack.com/archives/C84L4E3N1/p1571341575266900?thread_ts=1571341575.266900
2 Views