-
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
Kubernetes NamespacePatch - Removing label does not work anymore #2909
Comments
@Phil1972, I apologize for the delayed response and the inconvenience caused by the issues you've encountered with our documentation. I can confirm that these pages require updating. To clarify, we have never supported setting null or undefined objects for labels and annotations. This was an oversight on our part during the documentation drafting process. For your specific use case, you can safely remove the An updated, fully functional example would thus be as follows: using System.Collections.Generic;
using Pulumi;
using Kubernetes = Pulumi.Kubernetes;
return await Deployment.RunAsync(() =>
{
var uuid = "ee0d1b94-e749-4de4-ae8a-e4319a7f3ef2"; // Arbitrary UUID
var provider = new Kubernetes.Provider("provider", new()
{
EnableServerSideApply = true,
});
var patch1 = new Kubernetes.Core.V1.NamespacePatch("patch1", new()
{
Metadata = new Kubernetes.Types.Inputs.Meta.V1.ObjectMetaPatchArgs
{
Name = "foo",
Annotations =
{
{ "pulumi.com/patchForce", "true" },
{ "pulumi.com/patchFieldManager", uuid },
},
Labels =
{
{ "foo", "" },
},
},
}, new CustomResourceOptions
{
Provider = provider,
});
var patch2 = new Kubernetes.Core.V1.NamespacePatch("patch2", new()
{
Metadata = new Kubernetes.Types.Inputs.Meta.V1.ObjectMetaPatchArgs
{
Name = "foo",
Annotations =
{
{ "pulumi.com/patchForce", "true" },
{ "pulumi.com/patchFieldManager", uuid },
},
Labels =
{
// Not declaring the label here will cause it to be deleted after the manager has taken control of the field.
},
},
}, new CustomResourceOptions
{
Provider = provider,
DependsOn = new[]
{
patch1,
},
});
}); I will keep this issue open as a tracker item for us to revise our documentation. Thanks for reporting this! |
Thanks for your time on this. So there is no way to perform this in a single step I guess? Because I fear that pulumi might not like the fact that the label is already there at first. AKS puts that label automaticly on namespaces and we have to remove that label so that istio injection can work properly. ie: is there a way to run that kubectl command directly using pulumi?
|
What happened?
Hi,
Using the latest kubernetes module as well as the latest azure-native.
Code that used to work does not anymore and the documentation does not seem up to date (at least for the c# version) because it crashes with an exception (System.NullReferenceException: Object reference not set to an instance of an object.).
Example
This does not work anymore (see the marking). There is a warning/error that prevents to build. To remove the warning either put a pragma directive or put a 'null!' instead but it still fails with an exception:
any help into resolving this would be appreciated.
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: