kubernetes-client / kubernetes-client/java

It's not possible to create a Pod, because of the default overhead value (empty map) in v20.0.0

Abierto
#3,076 32 comentarios 1 reacción 0 asignados Ver en GitHub
lifecycle/frozen
Lenguaje dominante
Java
Estrellas
4k
Forks
2.1k
Merge medio
2 d 9 h
PR fusionados (30 d)
16

Descripción

**Describe the bug**

The default `overhead` value of Pod spec in version 20.0.0 is empty map which is causing the following error:
```java
java.lang.RuntimeException: io.kubernetes.client.openapi.ApiException: Message:
HTTP response code: 403
HTTP response body: {"kind":"Status","apiVersion":"((redacted))","metadata":{},"status":"Failure","message":"pods \"foo\" is forbidden: pod rejected: Pod Overhead set without corresponding RuntimeClass defined Overhead","reason":"Forbidden","details":{"name":"foo","kind":"pods"},"code":403}
```
As a workaround, one can set the `overhead` explicitly to null:
```java
V1Pod pod = new V1Pod()
.metadata(new V1ObjectMeta().name("foo"))
.spec(new V1PodSpec()
.overhead(null) // HERE: setting the overhead value to null, to avoid above error.
.addContainersItem(new V1ContainerBuilder()
// omitted
```

**Client Version**
e.g. `20.0.0`

**Kubernetes Version**
any version

**Java Version**
any version

**To Reproduce**
Create a simple Pod, without specifying anything for `overhead`:
```java
V1Pod pod = new V1Pod()
.metadata(new V1ObjectMeta().name("foo"))
.spec(new V1PodSpec()
.addContainersItem(new V1ContainerBuilder()
.withImage("any-image")
.withName("foo-image").build()));

coreV1Api.createNamespacedPod("default", pod).execute();
```
**Expected behavior**
Pod creation should be successful but it fails due to `overhead: {}` being present in the request payload.

I think, either the default value of `overhead` should be `null` or when serialising the request, the empty values should be omitted.
**KubeConfig**
N/A

**Server (please complete the following information):**
Any

**Additional context**
N/A

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with V1PodSpec and the request path used by CoreV1Api.createNamespacedPod; reproduce the example and inspect how an unset overhead is serialized. Compare the generated payload with the expected request, then verify that creating a Pod without specifying overhead no longer sends an empty map and succeeds.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, kubernetes
Área
api, backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.