I am trying to replicate what the `pulumi-eks` pa...
# kubernetes
f
I am trying to replicate what the
pulumi-eks
package does in golang but I appear to get an error. I'm trying to update the configmap for
aws-auth
. In the nodejs/eks version it does this
Copy code
const eksNodeAccess = new k8s.core.v1.ConfigMap(`${name}-nodeAccess`, {
        apiVersion: "v1",
        metadata: {
            name: `aws-auth`,
            namespace: "kube-system",
        },
        data: nodeAccessData,
    }, { parent, provider: k8sProvider });
Which appears to work by actually altering the configmap. However in golang when I try do the same I get an error
Copy code
_, err = corev1.NewConfigMap(ctx, "aws-auth", &corev1.ConfigMapArgs{
			Metadata: &metav1.ObjectMetaArgs{
				Name: pulumi.String("aws-auth"),
				Namespace: pulumi.String("kube-system"),
			},
			Data:       pulumi.StringMap{
				"mapRoles": roleConfig,
			},
		}, pulumi.Provider(kubeProvider))
The error is
Copy code
resource kube-system/aws-auth was not successfully created by the Kubernetes API server : configmaps "aws-auth" already exists
I think I may have a hunch this is due to me creating a managed node group before the configmap
Which then AWS under the hood creates that configmap for me. Whilst the
pulumi-eks
creates the configmap before the managed node groups. Going to test that logic out
o
That rationale tracks, the issue is likely the name conflict, not the language SDK.
☝️ 1
f
Ok so that is exactly what happened. you need to create the configmap before any managed node groups else it creates it automatically