I have a stack in dotnet that is using components....
# general
f
I have a stack in dotnet that is using components. The component depends on a resource which I then put that dependson in the components options. When I run up and it gives me a preview of the resources which the storage class is always at the bottom which makes since, since it depends on something up the graph. Unfortunately when I apply it the resource it created way at the beginning and fails since the demandant resource hasn't been created yet. Is there an issue with a component resource depending on another resource? It almost seems it is ignoring it. Preview
Copy code
Type                                                        Name                                      Plan       
     pulumi:pulumi:Stack                                         k8s-courageous-cluster-asc-dev-k8s-c02               
 +   ├─ rancher2:index:NodePool                                  workerNodePool1:asc-dev-k8s-c02-w1        create     
 +   ├─ rancher2:index:NodePool                                  workerNodePool3:asc-dev-k8s-c02-w3        create     
 +   ├─ rancher2:index:NodePool                                  masterNodePool:asc-dev-k8s-c02-m          create     
 +   ├─ rancher2:index:NodePool                                  workerNodePool2:asc-dev-k8s-c02-w2        create     
 +   ├─ rancher2:index:ClusterSync                               rancherClusterSync                        create     
 +   ├─ ascendlearning:rancher:SystemAddOnProject                systemAddOnsProject                       create     
 +   ├─ rancher2:index:Project                                   systemAddOnsProject:systemAddOnsProject   create     
 +   ├─ rancher2:index:Namespace                                 systemAddOnsProject:systemAddOnNamespace  create     
 +   ├─ kubernetes:core:ServiceAccount                           descheduler:ServiceAccount                create     
 +   ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRole|rbac.authorization.k8s.io:ClusterRole>         descheduler:ClusterRole                   create     
 +   ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRoleBinding|rbac.authorization.k8s.io:ClusterRoleBinding>  descheduler:ClusterRoleBinding            create     
 +   ├─ kubernetes:core:ConfigMap                                descheduler:ConfigMap                     create     
 +   ├─ kubernetes:batch:CronJob                                 descheduler:CronJob                       create     
 +   └─ kubernetes:<http://storage.k8s.io:StorageClass|storage.k8s.io:StorageClass>                   storageClass:vsphereStorageClass          create
Apply
Copy code
Type                                       Name                                    Status                  Info
     pulumi:pulumi:Stack                        k8s-courageous-cluster-asc-dev-k8s-c02  **failed**              1 error
 +   ├─ rancher2:index:NodePool                 workerNodePool2:asc-dev-k8s-c02-w2      created                 
 +   ├─ rancher2:index:NodePool                 workerNodePool1:asc-dev-k8s-c02-w1      created                 
 +   ├─ rancher2:index:NodePool                 masterNodePool:asc-dev-k8s-c02-m        created                 
 +   ├─ rancher2:index:NodePool                 workerNodePool3:asc-dev-k8s-c02-w3      created                 
 +   └─ kubernetes:<http://storage.k8s.io:StorageClass|storage.k8s.io:StorageClass>  storageClass:vsphereStorageClass        **creating failed**     1 error
You can see the storage class is created before it shows it would in the preview.
g
Yep, it looks like you already found the related issue: https://github.com/pulumi/pulumi-kubernetes/issues/861 I’ll respond there with a workaround you can use until we’ve fixed the root cause.
f
Hmm this isn't a chart though.
but does seem related
g
Yeah, the problem is with
ComponentResource
classes in pulumi, which is what Chart uses
f
Ah makes sense
g
The workaround is to depend on the subresource from the
ComponentResource
f
So how can I return the list of resources from the component so that another resource can depend on it? It does not let me return Outputs that are not " String, Boolean, Int32, Double, Nullable<...>, ImmutableArray<...> and ImmutableDictionary<string, ...> or a class explicitly marked with the [OutputTypeAttribute]" from ComponentResource classes.
I tried to return a ImmutableArray<Resource> as an Output but that also gave me the error.
g
@tall-librarian-49374 might know. I’m not familiar with the .NET SDK
t
[Output] public ImmutableArray<Resource> Resources {get;set;}
should work
Hmm, well, it might indeed fail for
Resource
. Which error are you getting?
s
Do you have any ETA for mentioned issue? Looks like it is something really difficult, lasts from October…
f
When I tried Resource I got the same error saying I could not pass it.
Copy code
[Output]
public Output<ImmutableArray<Resource>> Resources { get; set; }
this.Resources = Output.Create(new ImmutableArray<Resource> {(Resource)systemAddOnsProject, (Resource)systemAddOnNamespace});

 contains invalid type Pulumi.Resource. Allowed types are:
        String, Boolean, Int32, Double,
        Nullable<...>, ImmutableArray<...> and ImmutableDictionary<string, ...> or
        a class explicitly marked with the [OutputTypeAttribute].
@tall-librarian-49374 Should I log an issue for this where the output cannot return a Resource or a ImmutableArray of Resource?
t
However, have you tried making it a non-output? Just a property that you assign without marking as
[Output]
?
f
That worked.
Maybe I shouldn't be using [Outputs] for most of my components outputs anyways since they don't need to be retrieved outside the stack.