Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating a configmap's data with enableDryRun fails with "configsmap already exists" #1560

Closed
ghost opened this issue May 3, 2021 · 6 comments · Fixed by #1870
Closed

Updating a configmap's data with enableDryRun fails with "configsmap already exists" #1560

ghost opened this issue May 3, 2021 · 6 comments · Fixed by #1870
Assignees
Labels
dry-run-diff Related to dry run diff behavior kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@ghost
Copy link

ghost commented May 3, 2021

Changing the data on a ConfigMap with enableDryRun: true on EKS 1.19/ K3S v1.20.4 causes the following error:

kubernetes:core/v1:ConfigMap (test2):
    error: resource default/pierlucg-test was not successfully created by the Kubernetes API server : configmaps "pierlucg-test" already exists

Steps to reproduce

Run pulumi up twice with the following code:

const eksProviderDry = new k8s.Provider('eksdry', {
  enableDryRun: true,
  kubeconfig: 'mykubeconfig'
});

const configMapTest = new k8s.core.v1.ConfigMap(
  'this-will-fail',
  {
    data: {foo: `${Date.now()}`},
    metadata: {
      name: `failing-configMap`,
    },
  },
  {provider: eksProviderDry},
);

const eksProvider = new k8s.Provider('eks', {
  kubeconfig: 'mykubeconfig'
});

const configMapWorking = new k8s.core.v1.ConfigMap(
  'this-will-succeed',
  {
    data: {foo: `${Date.now()}`},
    metadata: {
      name: `fonctioning-configMap`,
    },
  },
  {provider: eksProvider},
);

This will be the result the second time:

Previewing update (mystack.dev):
     Type                             Name                                       Plan        Info
     pulumi:pulumi:Stack              myproject-mystack.dev              1 error
 +-  ├─ kubernetes:core/v1:ConfigMap  this-will-succeed                          replace     [diff: ~data]
 +-  └─ kubernetes:core/v1:ConfigMap  this-will-fail                             replace     [diff: ~data]; 1 error
 
Diagnostics:
  pulumi:pulumi:Stack (myproject-mystack.dev):
    error: preview failed
 
  kubernetes:core/v1:ConfigMap (this-will-fail):
    error: Preview failed: resource default/failing was not successfully created by the Kubernetes API server : configmaps "failing" already exists

Context (Environment)

Using Typescript
EKS Server Version: v1.19.8-eks-96780e
Pulumi Version: v3.1.0
"@pulumi/kubernetes" Version: "^3.1.0"

I also tested with a local K3S cluster and the issue still occurs.


Might affect #1556

@ghost ghost added the kind/bug Some behavior is incorrect or out of spec label May 3, 2021
@lukehoban
Copy link
Contributor

Changing the data on a ConfigMap with enableDryRun: true

I assume this does not repro with enableDryRun: false? In which case it sounds like an issue with the server-side diff support. cc #1556 which is tracking making that the default.

@ghost
Copy link
Author

ghost commented May 4, 2021

I tried with enableDryRun: false and the configmap updated was replaced just fine.

@lblackstone lblackstone added dry-run-diff Related to dry run diff behavior kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels May 4, 2021
@ghost
Copy link
Author

ghost commented May 6, 2021

@lblackstone could not using auto-naming be the cause of this issue as well?

@lblackstone
Copy link
Member

lblackstone commented May 6, 2021

@lblackstone could not using auto-naming be the cause of this issue as well?

Yes, quite possibly. Sorry for the troubles here. We may need to rethink the provider's behavior in the case where the resources are not auto-named.

For future reference, the related issue is #1567

@ghost
Copy link
Author

ghost commented May 6, 2021

I'll leave the decision whether to close this issue up to you. With my newly found understanding (thank you), I now know how to avoid this problem. That being said, I agree that there might be a better way to at least provide a more meaningful error.

Thanks again!

@nesl247
Copy link

nesl247 commented Sep 8, 2021

Just ran into this myself. It really needs to support updating (instead of replacing) ConfigMaps if the name is not autonamed.

For example, I can't update the gitlab-runner helm chart now because of this. Not sure if something changed, but I don't recall having this issue before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dry-run-diff Related to dry run diff behavior kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants