-
Notifications
You must be signed in to change notification settings - Fork 113
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
Import for complex existing applications: importing this resource will fail #886
Comments
Can you copy/paste your |
I am now dynamically creating it in a transform: const annotations = {
"app.kubernetes.io/deploy-date": config.deployDate,
"app.kubernetes.io/deployer": config.deployer,
"app.kubernetes.io/branch": app.gitBranch,
"app.kubernetes.io/version": app.gitRef,
"kubernetes.io/change-cause": config.changeCause,
};
// [...]
{
ignoreChanges: (args.opts.ignoreChanges || []).concat(["metadata", ...Object.keys(annotations).map(v => `metadata.annotations["${v}"]`)]),
} Before that I tried using just |
At a glance, it looks like the Kubernetes provider is not respecting the For context, cc @lblackstone |
Does the approach you're taking now work, @hermanbanken ? |
Nope, it does not. We just tried those different properties for |
Given that we have our existing YAML templates |
It was accurate when that PR landed - but this was changed in follow-up work that @pgavlin did to provider diffing. He should be able to point you at details of the required contract. |
FYI: I'm working around this issue with a custom provider for Kubernetes that will just Not being able to construct fresh state files (using imports) is a blocker for us, because we are still very much experimenting with Pulumi and the state files are not guaranteed to be compatible between host computers. That's why we're not sharing the state files between computers, and need to construct fresh state files often. |
Any movement on this? Terraform easily adopts a resource, and pays no attention to this type of discrepancy. I am not sure why Pulumi cannot do the same during an import phase. Perhaps there is something beyond what I'm understanding, but if I adopt a resource into Pulumi, I'm technically "ok" with those changes occuring. With a proper preview, I would know exactly what's going to happen once it's adopted into a fresh state and then subsequently modified to.... Even a flag to pass to apply would be great? |
@lblackstone IIUC, the issue might be that However, I am curious that why the runtime does not process |
I believe support for this was added in pulumi/pulumi#5976 |
Fixed in pulumi/pulumi#5976 |
Problem description
We manage a GKE cluster with 26 microservices, which all consist of multiple resources (deployment, service, etc). Recently we decided to go with Pulumi to start codifying the infrastructure & apps. We are having troubles however to import our current clusters into Pulumi.
The
import
statement correctly detects our existing resources, but will always cause"importing this resource will fail"
due to our dynamic annotations:Ideally, import would respect the
ignoreChanges
option, so that importing does not fail.We also tried to remove the annotations (e.g. so that they are imported in full), but this
does not seem to work, because then the diff algorithm thinks we want the annotations to
be removed and the import fails too. If we do not specify any property (removing spec, metadata,
kind, etc) so that import can import everything also fails.
Errors & Logs
Affected product version(s)
Reproducing the issue
import
field.pulumi up
Suggestions for a fix
import
should respect theignoreChanges
option of resources.The text was updated successfully, but these errors were encountered: