Hello everyone :wave: here's the TL;DR I want to ...
# general
h
Hello everyone đź‘‹ here's the TL;DR I want to reuse existing kubernetes objects, instead of creating new ones, when applying pulumi More Detailed description of my Problem: I've got a little problem with the
import
of existing kuberenetes objects. What I thought It does: Now you can apply a new configuration over the very same kubernetes object What it does: It doesn't work, when there is a minor difference between the new and the existing configuration. Pulumi states that:
warning: inputs to import do not match the existing resource; importing this resource will fail
and fails with
Copy code
error: inputs to import do not match the existing resource
error: update failed
What am I doing wrong here? I just want to update/reuse existing kubernetes ressources
s
To which resource(s) does it happen? Do you know which fields may be different? It seems that the diff doesn’t show that, yet: https://pulumi-community.slack.com/archives/C84L4E3N1/p1574274572026200
In order to
successfully import a resource, its desired configuration (i.e. its
inputs) must not differ from its actual configuration (i.e. its state)
as calculated by the resource’s provider.
https://github.com/pulumi/pulumi/pull/2893#issue-293527337
That’s intended as a gate to not accidentally overwrite it with `pulumi up --yes`: https://github.com/pulumi/pulumi/pull/2893#issuecomment-509771727
h
I tested this with
Service
and
Deployment
Objects so far. I can see precisely which fields differ, pulumi offers a great view into this. It looks like this:
Copy code
warning: inputs to import do not match the existing resource; importing this resource will fail
    = kubernetes:core/v1:Service: (import)
        [id=microservice-example-ihrhjljj]
        [urn=urn:pulumi:dev::pulumi::kubernetes:core/v1:Service::microservice-example]
        [provider=urn:pulumi:dev::pulumi::pulumi:providers:kubernetes::default_1_3_1::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
      ~ spec: {
          ~ selector: {
              ~ tier: "backend" => "frontend"
            }
        }
s
So, when you change the
selector
to
tier: backend
in your code, then the import should work, or?
h
Yes, it very much does work then.