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

fast-dinner-32080

04/06/2020, 6:41 PM
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

gorgeous-egg-16927

04/06/2020, 8:25 PM
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

fast-dinner-32080

04/06/2020, 8:27 PM
Hmm this isn't a chart though.
but does seem related
g

gorgeous-egg-16927

04/06/2020, 8:28 PM
Yeah, the problem is with
ComponentResource
classes in pulumi, which is what Chart uses
f

fast-dinner-32080

04/06/2020, 8:28 PM
Ah makes sense
g

gorgeous-egg-16927

04/06/2020, 8:29 PM
The workaround is to depend on the subresource from the
ComponentResource
f

fast-dinner-32080

04/06/2020, 9:52 PM
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

gorgeous-egg-16927

04/06/2020, 10:07 PM
@tall-librarian-49374 might know. I’m not familiar with the .NET SDK
t

tall-librarian-49374

04/07/2020, 5:55 AM
[Output] public ImmutableArray<Resource> Resources {get;set;}
should work
Hmm, well, it might indeed fail for
Resource
. Which error are you getting?
s

some-kitchen-64615

04/07/2020, 7:39 AM
Do you have any ETA for mentioned issue? Looks like it is something really difficult, lasts from October…
f

fast-dinner-32080

04/07/2020, 3:00 PM
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

tall-librarian-49374

04/08/2020, 6:01 AM
However, have you tried making it a non-output? Just a property that you assign without marking as
[Output]
?
f

fast-dinner-32080

04/08/2020, 10:18 PM
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.