I’m getting a list of namespaces for my EKS cluste...
# golang
j
I’m getting a list of namespaces for my EKS cluster and for each I’m calling:
Copy code
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:
Copy code
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
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