https://pulumi.com logo
#dotnet
Title
# dotnet
b

bored-activity-40468

10/31/2020, 2:50 PM
@worried-city-86458 I've been messing with your ImmutableExtensions and wondering, what
(string)resource["kind"] == kind
does? Thanks.
w

worried-city-86458

10/31/2020, 7:07 PM
It's just a way to easily filter the kind (type) of k8s resource to transform; e.g.:
Copy code
new ConfigFile($"{prefix}-ingress",
    new ConfigFileArgs
    {
        File = "ingress-controller.yml",
        Transformations =
        {
            (obj, opts) => obj.Mutate("Deployment", deployment =>
            {
                var args = (List<object>)deployment.spec.template.spec.containers[0].args;
                args.AddRange(new[] { $"--aws-region={config.AwsRegion}", $"--cluster-name={name}" });
            })
        }
    },
    new ComponentResourceOptions { Provider = Provider });
To transform the k8s deployment resource
While I appreciate the intention of the immutable types, the dev experience sucks. 😞
b

bored-activity-40468

10/31/2020, 8:00 PM
Got it, thanks. Yeah, I agree, your extensions help with that though. 🙂
w

worried-city-86458

11/01/2020, 1:30 AM
I recommend using kube2pulumi instead, which gives much more control, but might not be practicable for large yaml files while tracking upstream changes, depending on how much you tweak the resulting c# to your liking. 😉
👍 1