Skip to content
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

BadRequest: the name of the object (admin based on URL) was undeterminable: name must be provided #1214

Closed
bhadreshpanchal88 opened this issue Feb 23, 2023 · 9 comments

Comments

@bhadreshpanchal88
Copy link

bhadreshpanchal88 commented Feb 23, 2023

Describe the bug
I am getting BadRequest response while updating the deployment.
It was working fine with older version. I recently upgraded k8s client to 10.0.1

Kubernetes C# SDK Client Version
10.0.1

Server Kubernetes Version
1.25.6

Dotnet Runtime Version
net6

To Reproduce
Steps to reproduce the behavior:
Try updating the deployment,
PatchNamespacedDeployment(V1Patch, Name, NamespaceName)

Error
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the name of the object (admin based on URL) was undeterminable: name must be provided",
"reason": "BadRequest",
"code": 400
}

Expected behavior
A clear and concise description of what you expected to happen.

KubeConfig
If applicable, add a KubeConfig file with secrets redacted.

Where do you run your app with Kubernetes SDK (please complete the following information):

  • OS: Linux
  • Environment: container
  • Cloud: Azure

Additional context
I am able to update the deployment image, but not the entire deployment with full json data.

@tg123
Copy link
Member

tg123 commented Feb 23, 2023

could you please share the patch code?
likely something wrong with it

@bhadreshpanchal88
Copy link
Author

@tg123 Here is the json data I am sending for deployment update.
[
{
"value": {
"MinReadySeconds": null,
"Paused": null,
"ProgressDeadlineSeconds": null,
"Replicas": 1,
"RevisionHistoryLimit": null,
"Selector": {
"MatchExpressions": null,
"MatchLabels": {
"app": "admin"
}
},
"Strategy": null,
"Template": {
"Metadata": {
"Annotations": null,
"CreationTimestamp": null,
"DeletionGracePeriodSeconds": null,
"DeletionTimestamp": null,
"Finalizers": null,
"GenerateName": null,
"Generation": null,
"Labels": {
"app": "admin"
},
"ManagedFields": null,
"Name": null,
"NamespaceProperty": null,
"OwnerReferences": null,
"ResourceVersion": null,
"SelfLink": null,
"Uid": null
},
"Spec": {
"ActiveDeadlineSeconds": null,
"Affinity": {
"NodeAffinity": {
"PreferredDuringSchedulingIgnoredDuringExecution": [
{
"Preference": {
"MatchExpressions": [
{
"Key": "role",
"OperatorProperty": "In",
"Values": [
"general"
]
}
],
"MatchFields": null
},
"Weight": 1
}
],
"RequiredDuringSchedulingIgnoredDuringExecution": null
},
"PodAffinity": null,
"PodAntiAffinity": null
},
"AutomountServiceAccountToken": null,
"Containers": [
{
"Args": null,
"Command": null,
"Env": [
{
"Name": "
_ADMINWEBSITE",
"Value": "****",
"ValueFrom": null
}
],
"EnvFrom": [
{
"ConfigMapRef": {
"Name": "
-config",
"Optional": null
},
"Prefix": null,
"SecretRef": null
}
],
"Image": "
.azurecr.io/
/admin:2022.12.631.89872-release-windows2019",
"ImagePullPolicy": null,
"Lifecycle": null,
"LivenessProbe": {
"Exec": null,
"FailureThreshold": 4,
"Grpc": null,
"HttpGet": {
"Host": null,
"HttpHeaders": null,
"Path": "/blank.html",
"Port": {
"Value": "80"
},
"Scheme": null
},
"InitialDelaySeconds": 60,
"PeriodSeconds": 30,
"SuccessThreshold": 1,
"TcpSocket": null,
"TerminationGracePeriodSeconds": null,
"TimeoutSeconds": 30
},
"Name": "admin",
"Ports": [
{
"ContainerPort": 80,
"HostIP": null,
"HostPort": null,
"Name": null,
"Protocol": null
}
],
"ReadinessProbe": {
"Exec": null,
"FailureThreshold": 10,
"Grpc": null,
"HttpGet": {
"Host": null,
"HttpHeaders": null,
"Path": "/healthcheck.axd?type=readiness&from=admin",
"Port": {
"Value": "80"
},
"Scheme": null
},
"InitialDelaySeconds": 60,
"PeriodSeconds": 30,
"SuccessThreshold": 1,
"TcpSocket": null,
"TerminationGracePeriodSeconds": null,
"TimeoutSeconds": 30
},
"Resources": {
"Claims": null,
"Limits": {
"memory": {
"Format": 1,
"Value": "1024Mi"
},
"cpu": {
"Format": 2,
"Value": "1024m"
}
},
"Requests": {
"memory": {
"Format": 1,
"Value": "25Mi"
},
"cpu": {
"Format": 2,
"Value": "10m"
}
}
},
"SecurityContext": null,
"StartupProbe": null,
"Stdin": null,
"StdinOnce": null,
"TerminationMessagePath": null,
"TerminationMessagePolicy": null,
"Tty": null,
"VolumeDevices": null,
"VolumeMounts": [
{
"MountPath": "C:/data",
"MountPropagation": null,
"Name": "volume",
"ReadOnlyProperty": null,
"SubPath": null,
"SubPathExpr": null
},
{
"MountPath": "C:/scansource",
"MountPropagation": null,
"Name": "scanvolume",
"ReadOnlyProperty": null,
"SubPath": null,
"SubPathExpr": null
},
{
"MountPath": "C:/exchange",
"MountPropagation": null,
"Name": "exchangevolume",
"ReadOnlyProperty": null,
"SubPath": null,
"SubPathExpr": null
}
],
"WorkingDir": null
}
],
"DnsConfig": null,
"DnsPolicy": null,
"EnableServiceLinks": null,
"EphemeralContainers": null,
"HostAliases": null,
"HostIPC": null,
"HostNetwork": null,
"HostPID": null,
"HostUsers": null,
"Hostname": null,
"ImagePullSecrets": null,
"InitContainers": null,
"NodeName": null,
"NodeSelector": {
"tier": "tier2",
"product": "
"
},
"Os": null,
"Overhead": null,
"PreemptionPolicy": null,
"Priority": null,
"PriorityClassName": null,
"ReadinessGates": null,
"ResourceClaims": null,
"RestartPolicy": null,
"RuntimeClassName": null,
"SchedulerName": null,
"SchedulingGates": null,
"SecurityContext": null,
"ServiceAccount": null,
"ServiceAccountName": null,
"SetHostnameAsFQDN": null,
"ShareProcessNamespace": null,
"Subdomain": null,
"TerminationGracePeriodSeconds": null,
"Tolerations": null,
"TopologySpreadConstraints": null,
"Volumes": [
{
"AwsElasticBlockStore": null,
"AzureDisk": null,
"AzureFile": null,
"Cephfs": null,
"Cinder": null,
"ConfigMap": null,
"Csi": null,
"DownwardAPI": null,
"EmptyDir": null,
"Ephemeral": null,
"Fc": null,
"FlexVolume": null,
"Flocker": null,
"GcePersistentDisk": null,
"GitRepo": null,
"Glusterfs": null,
"HostPath": null,
"Iscsi": null,
"Name": "volume",
"Nfs": null,
"PersistentVolumeClaim": {
"ClaimName": "data-pvc",
"ReadOnlyProperty": null
},
"PhotonPersistentDisk": null,
"PortworxVolume": null,
"Projected": null,
"Quobyte": null,
"Rbd": null,
"ScaleIO": null,
"Secret": null,
"Storageos": null,
"VsphereVolume": null
},
{
"AwsElasticBlockStore": null,
"AzureDisk": null,
"AzureFile": null,
"Cephfs": null,
"Cinder": null,
"ConfigMap": null,
"Csi": null,
"DownwardAPI": null,
"EmptyDir": null,
"Ephemeral": null,
"Fc": null,
"FlexVolume": null,
"Flocker": null,
"GcePersistentDisk": null,
"GitRepo": null,
"Glusterfs": null,
"HostPath": null,
"Iscsi": null,
"Name": "scanvolume",
"Nfs": null,
"PersistentVolumeClaim": {
"ClaimName": "scansource-pvc",
"ReadOnlyProperty": null
},
"PhotonPersistentDisk": null,
"PortworxVolume": null,
"Projected": null,
"Quobyte": null,
"Rbd": null,
"ScaleIO": null,
"Secret": null,
"Storageos": null,
"VsphereVolume": null
},
{
"AwsElasticBlockStore": null,
"AzureDisk": null,
"AzureFile": null,
"Cephfs": null,
"Cinder": null,
"ConfigMap": null,
"Csi": null,
"DownwardAPI": null,
"EmptyDir": null,
"Ephemeral": null,
"Fc": null,
"FlexVolume": null,
"Flocker": null,
"GcePersistentDisk": null,
"GitRepo": null,
"Glusterfs": null,
"HostPath": null,
"Iscsi": null,
"Name": "exchangevolume",
"Nfs": null,
"PersistentVolumeClaim": {
"ClaimName": "exchange-pvc",
"ReadOnlyProperty": null
},
"PhotonPersistentDisk": null,
"PortworxVolume": null,
"Projected": null,
"Quobyte": null,
"Rbd": null,
"ScaleIO": null,
"Secret": null,
"Storageos": null,
"VsphereVolume": null
}
]
}
}
},
"path": "/spec",
"op": "replace"
},
{
"value": {
"Annotations": null,
"CreationTimestamp": null,
"DeletionGracePeriodSeconds": null,
"DeletionTimestamp": null,
"Finalizers": null,
"GenerateName": null,
"Generation": null,
"Labels": null,
"ManagedFields": null,
"Name": "admin",
"NamespaceProperty": "
-
",
"OwnerReferences": null,
"ResourceVersion": null,
"SelfLink": null,
"Uid": null
},
"path": "/metadata",
"op": "replace"
}
]

image

@tg123
Copy link
Member

tg123 commented Feb 24, 2023

"Name": null,?

@bhadreshpanchal88
Copy link
Author

"Name": null,?

I tried with setting the Name value as well. It still gives the same error. Any other solution you can help with ?

@tg123
Copy link
Member

tg123 commented Feb 27, 2023

not sure how you create your patch obj, the err means you did not provide name of the obj correctly

// errEmptyName is returned when API requests do not fill the name section of the path.
var errEmptyName = errors.NewBadRequest("name must be provided")

@bhadreshpanchal88
Copy link
Author

@tg123 Here is the updated patch obj where I assigned all the name values which were null previously. But I am still facing the same issue.
PS: It was working fine before the K8s Client update and server update.
Previous version for K8s Client was 6.0.26 and Server was 1.24

[
{
"value": {
"MinReadySeconds": null,
"Paused": null,
"ProgressDeadlineSeconds": null,
"Replicas": 1,
"RevisionHistoryLimit": null,
"Selector": {
"MatchExpressions": null,
"MatchLabels": {
"app": "admin"
}
},
"Strategy": null,
"Template": {
"Metadata": {
"Annotations": null,
"CreationTimestamp": null,
"DeletionGracePeriodSeconds": null,
"DeletionTimestamp": null,
"Finalizers": null,
"GenerateName": null,
"Generation": null,
"Labels": {
"app": "admin"
},
"ManagedFields": null,
"Name": "admin",
"NamespaceProperty": null,
"OwnerReferences": null,
"ResourceVersion": null,
"SelfLink": null,
"Uid": null
},
"Spec": {
"ActiveDeadlineSeconds": null,
"Affinity": {
"NodeAffinity": {
"PreferredDuringSchedulingIgnoredDuringExecution": [
{
"Preference": {
"MatchExpressions": [
{
"Key": "role",
"OperatorProperty": "In",
"Values": [
"general"
]
}
],
"MatchFields": null
},
"Weight": 1
}
],
"RequiredDuringSchedulingIgnoredDuringExecution": null
},
"PodAffinity": null,
"PodAntiAffinity": null
},
"AutomountServiceAccountToken": null,
"Containers": [
{
"Args": null,
"Command": null,
"Env": [
{
"Name": "
_ADMINWEBSITE",
"Value": "https://admin---dev.asp.com",
"ValueFrom": null
}
],
"EnvFrom": [
{
"ConfigMapRef": {
"Name": "
-config",
"Optional": null
},
"Prefix": null,
"SecretRef": null
}
],
"Image": "pd.azurecr.io//admin:2022.12.631.90560-release-windows2019",
"ImagePullPolicy": null,
"Lifecycle": null,
"LivenessProbe": {
"Exec": null,
"FailureThreshold": 4,
"Grpc": null,
"HttpGet": {
"Host": null,
"HttpHeaders": null,
"Path": "/blank.html",
"Port": {
"Value": "80"
},
"Scheme": null
},
"InitialDelaySeconds": 60,
"PeriodSeconds": 30,
"SuccessThreshold": 1,
"TcpSocket": null,
"TerminationGracePeriodSeconds": null,
"TimeoutSeconds": 30
},
"Name": "admin",
"Ports": [
{
"ContainerPort": 80,
"HostIP": null,
"HostPort": null,
"Name": "admin",
"Protocol": null
}
],
"ReadinessProbe": {
"Exec": null,
"FailureThreshold": 10,
"Grpc": null,
"HttpGet": {
"Host": null,
"HttpHeaders": null,
"Path": "/healthcheck.axd?type=readiness&from=admin",
"Port": {
"Value": "80"
},
"Scheme": null
},
"InitialDelaySeconds": 60,
"PeriodSeconds": 30,
"SuccessThreshold": 1,
"TcpSocket": null,
"TerminationGracePeriodSeconds": null,
"TimeoutSeconds": 30
},
"Resources": {
"Claims": null,
"Limits": {
"memory": {
"Format": 1,
"Value": "1024Mi"
},
"cpu": {
"Format": 2,
"Value": "1024m"
}
},
"Requests": {
"memory": {
"Format": 1,
"Value": "25Mi"
},
"cpu": {
"Format": 2,
"Value": "10m"
}
}
},
"SecurityContext": null,
"StartupProbe": null,
"Stdin": null,
"StdinOnce": null,
"TerminationMessagePath": null,
"TerminationMessagePolicy": null,
"Tty": null,
"VolumeDevices": null,
"VolumeMounts": [
{
"MountPath": "C:/data",
"MountPropagation": null,
"Name": "volume",
"ReadOnlyProperty": null,
"SubPath": null,
"SubPathExpr": null
},
{
"MountPath": "C:/scansource",
"MountPropagation": null,
"Name": "scanvolume",
"ReadOnlyProperty": null,
"SubPath": null,
"SubPathExpr": null
},
{
"MountPath": "C:/exchange",
"MountPropagation": null,
"Name": "exchangevolume",
"ReadOnlyProperty": null,
"SubPath": null,
"SubPathExpr": null
}
],
"WorkingDir": null
}
],
"DnsConfig": null,
"DnsPolicy": null,
"EnableServiceLinks": null,
"EphemeralContainers": null,
"HostAliases": null,
"HostIPC": null,
"HostNetwork": null,
"HostPID": null,
"HostUsers": null,
"Hostname": null,
"ImagePullSecrets": null,
"InitContainers": null,
"NodeName": null,
"NodeSelector": {
"tier": "tier2",
"product": "
"
},
"Os": null,
"Overhead": null,
"PreemptionPolicy": null,
"Priority": null,
"PriorityClassName": null,
"ReadinessGates": null,
"ResourceClaims": null,
"RestartPolicy": null,
"RuntimeClassName": null,
"SchedulerName": null,
"SchedulingGates": null,
"SecurityContext": null,
"ServiceAccount": null,
"ServiceAccountName": null,
"SetHostnameAsFQDN": null,
"ShareProcessNamespace": null,
"Subdomain": null,
"TerminationGracePeriodSeconds": null,
"Tolerations": null,
"TopologySpreadConstraints": null,
"Volumes": [
{
"AwsElasticBlockStore": null,
"AzureDisk": null,
"AzureFile": null,
"Cephfs": null,
"Cinder": null,
"ConfigMap": null,
"Csi": null,
"DownwardAPI": null,
"EmptyDir": null,
"Ephemeral": null,
"Fc": null,
"FlexVolume": null,
"Flocker": null,
"GcePersistentDisk": null,
"GitRepo": null,
"Glusterfs": null,
"HostPath": null,
"Iscsi": null,
"Name": "volume",
"Nfs": null,
"PersistentVolumeClaim": {
"ClaimName": "data-pvc",
"ReadOnlyProperty": null
},
"PhotonPersistentDisk": null,
"PortworxVolume": null,
"Projected": null,
"Quobyte": null,
"Rbd": null,
"ScaleIO": null,
"Secret": null,
"Storageos": null,
"VsphereVolume": null
},
{
"AwsElasticBlockStore": null,
"AzureDisk": null,
"AzureFile": null,
"Cephfs": null,
"Cinder": null,
"ConfigMap": null,
"Csi": null,
"DownwardAPI": null,
"EmptyDir": null,
"Ephemeral": null,
"Fc": null,
"FlexVolume": null,
"Flocker": null,
"GcePersistentDisk": null,
"GitRepo": null,
"Glusterfs": null,
"HostPath": null,
"Iscsi": null,
"Name": "scanvolume",
"Nfs": null,
"PersistentVolumeClaim": {
"ClaimName": "scansource-pvc",
"ReadOnlyProperty": null
},
"PhotonPersistentDisk": null,
"PortworxVolume": null,
"Projected": null,
"Quobyte": null,
"Rbd": null,
"ScaleIO": null,
"Secret": null,
"Storageos": null,
"VsphereVolume": null
},
{
"AwsElasticBlockStore": null,
"AzureDisk": null,
"AzureFile": null,
"Cephfs": null,
"Cinder": null,
"ConfigMap": null,
"Csi": null,
"DownwardAPI": null,
"EmptyDir": null,
"Ephemeral": null,
"Fc": null,
"FlexVolume": null,
"Flocker": null,
"GcePersistentDisk": null,
"GitRepo": null,
"Glusterfs": null,
"HostPath": null,
"Iscsi": null,
"Name": "exchangevolume",
"Nfs": null,
"PersistentVolumeClaim": {
"ClaimName": "exchange-pvc",
"ReadOnlyProperty": null
},
"PhotonPersistentDisk": null,
"PortworxVolume": null,
"Projected": null,
"Quobyte": null,
"Rbd": null,
"ScaleIO": null,
"Secret": null,
"Storageos": null,
"VsphereVolume": null
}
]
}
}
},
"path": "/spec",
"op": "replace"
},
{
"value": {
"Annotations": null,
"CreationTimestamp": null,
"DeletionGracePeriodSeconds": null,
"DeletionTimestamp": null,
"Finalizers": null,
"GenerateName": null,
"Generation": null,
"Labels": null,
"ManagedFields": null,
"Name": "admin",
"NamespaceProperty": "
-
",
"OwnerReferences": null,
"ResourceVersion": null,
"SelfLink": null,
"Uid": null
},
"path": "/metadata",
"op": "replace"
}
]

@tg123
Copy link
Member

tg123 commented Feb 27, 2023

if your patch object is generated by asp.net json patch, please migrate to https://www.nuget.org/packages/JsonPatch.Net

see #772

@bhadreshpanchal88
Copy link
Author

bhadreshpanchal88 commented Feb 27, 2023

I am using Newtonsoft.Json, Version=13.0.0.0 And Microsoft.AspNetCore.JsonPatch, Version=7.0.2.0

image

@tg123
Copy link
Member

tg123 commented Feb 27, 2023

see #772 (comment)

@tg123 tg123 closed this as completed Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants