question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Delete Namespace response json deserialization exception

See original GitHub issue

I am trying to delete a namespace using

StatusV1 delStatus = await client.NamespacesV1().Delete(nsName);

The api call actually works and k8s does what it needs to do. It is the deserialization of the response that fails. Some specifically the Status property.

Here is the JSON response from k8s:

{“kind”:“Namespace”,“apiVersion”:“v1”,“metadata”:{“name”:“xxxxxxxxxx”,“selfLink”:“/api/v1/namespaces/xxxxxxxxxx”,“uid”:“0499e242-1a87-11e9-9f35-000d3a44ebb6”,“resourceVersion”:“1130958”,“creationTimestamp”:“2019-01-17T18:38:01Z”,“deletionTimestamp”:“2019-01-17T18:40:39Z”,“labels”:{“name”:“xxxxxxxxxx”},“annotations”:{“kubectl.kubernetes.io/last-applied-configuration”:“{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"labels":{"name":"xxxxxxxxxx"},"name":"xxxxxxxxxx"}}\n”}},“spec”:{“finalizers”:[“kubernetes”]},“status”:{“phase”:“Terminating”}}

Notice at the very end "status":{"phase":"Terminating"}}

The current model StatusV1 has type string in the property Status: StatusV1.cs#L47

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
tintoycommented, Jan 17, 2019

See https://github.com/tintoy/dotnet-kube-client/commit/9d11ac1e7f3f376f810797e2e3d26deaf787ec02 for details of what was fixed. I’ll push out a new version shortly.

1reaction
tintoycommented, Jan 17, 2019

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - handling name space changes during deserialization ...
1 Answer 1 · Rename your CLR namespaces to match those of the sending system, or · Subclass the DefaultSerializationBinder and use it...
Read more >
Delete namespace does not return proper v1.Status object
I tried to delete a namespace via https://github.com/kubernetes-client/java and was hit by a gnarly error when the lib tried to deserialize ...
Read more >
How to serialize and deserialize JSON using C# - .NET
Learn how to use the System.Text.Json namespace to serialize to and deserialize from JSON in .NET. Includes sample code.
Read more >
Deserializing a "null" json response
This causes a NullReferenceException when trying to find a matching property name a few lines inside the Map method: var actualName = name....
Read more >
CA2329: Do not deserialize with JsonSerializer using an ...
This rule fires when both of the following conditions are true for a Newtonsoft.Json.JsonSerializer instance that's passed to a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found