https://pulumi.com logo
Title
j

jolly-church-88521

11/15/2022, 4:51 PM
I’m getting a list of namespaces for my EKS cluster and for each I’m calling:
namespace, err := corev1.NewNamespace(ctx, name, ...)
	if err != nil {
		return nil, nil
	}
to create them. But there are some exceptions, like
kube-system
, which is already in EKS. Pulumi is failing with:
namespaces "kube-system" already exists
because obviously this namespace is already there. I tried to catch error message like
if err.Error() == "…"
or/and
return nil, nil
. But it’s still the same error message. Is there any way to workaround this?
f

flat-laptop-90489

11/16/2022, 3:41 AM
I usually try to lookup the resource and put a conditional import if I want to go this route. Error handling in a more “idiomatic go” way doesn’t seem to work