Pulumi preview/up --diff for kubernetes resources does not display diffs of properties in the same level of nesting if one references a fully-encrypted resource by its name
See original GitHub issuePulumi preview/up --diff does not display diffs of properties in the same level of nesting if one references a fully-encrypted resource by its name (or likely any other of its properties).
Expected behavior
If I change a deployment image I expect to see:
~ spec: {
~ template: {
~ spec: {
~ containers: [
~ [0]: {
~ image: "oldimagename" => "newimagename"
}
]
}
}
}
Current behavior
If I change a deployment image I actually see:
~ kubernetes:apps/v1:Deployment: (update)
~ spec: {
~ template: {
~ spec: {
~ containers: [
~ [0]: {
}
]
}
}
}
Steps to reproduce
Create these resources
const secret = new Secret("secret", {
stringData: {
LALALA: pulumi.secret("lalalala"),
},
})
const deployment = new Deployment("nginx", {
metadata: {
name: "nginx",
},
spec: {
replicas: 1,
selector: {
matchLabels: { app: "nginx" },
},
template: {
metadata: {
labels: { app: "nginx" },
},
spec: {
containers: [
{
envFrom: [
{
secretRef: { name: secret.metadata.name },
},
],
env: [
{
name: "LOLOLO",
value: "lolololo",
},
],
name: "nginx",
image: "nginx",
},
],
},
},
},
})
Then change "lolololo"
to any other string. See that the preview diff does not contain useful info.
Then remove secretRef: { name: secret.metadata.name },
. Apply the change. Then change the env var in the deployment again and see that the diff now displays correctly
Workaround
Wrap the “false” secrets in unsecret()
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Troubleshooting Guide - Pulumi
This guide covers common troubleshooting techniques when using Pulumi, such as tracing, manually editing deployments, and resolving common errors.
Read more >PodPatch - Pulumi
Patch resources are used to modify existing Kubernetes resources by using Server-Side Apply updates. The name of the resource must be specified, ...
Read more >Managing Resources with Server-Side Apply - Pulumi
It is now possible to “Upsert” resources; create the resource if it does not exist, or apply the configuration to an existing resource....
Read more >Create DeploymentList Resource - Pulumi
Documentation for the kubernetes.apps/v1.DeploymentList resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >CustomResourceDefinitionList - Pulumi
Documentation for the kubernetes.apiextensions.k8s.io/v1beta1. ... name This property is required. string: The unique name of the resource. args This ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the delay. This is still high on the priority list, and I expect to continue work on it soon.
@aaronlevy It’s still in progress, but my understanding is that you can use the
unsecret()
function around any.metadata.name
reference to work around in the meantime.The reason this is happening is fairly involved:
last-applied-configuration
annotation (issue #1659)last-applied-configuration
annotation contains a secret value, then all of the other metadata is also marked as secret. This includes the.metadata.name
property..metadata.name
property, then it transitively becomes secret as well. This unfortunately leads to the poor diff behavior you’re seeing since every field in the spec map becomes a “secret”.