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

an error with submit a pod by Yaml.loadAs(values, V1Pod.class); #3285

Closed
xiaoyu1095 opened this issue Apr 5, 2024 · 3 comments
Closed

an error with submit a pod by Yaml.loadAs(values, V1Pod.class); #3285

xiaoyu1095 opened this issue Apr 5, 2024 · 3 comments

Comments

@xiaoyu1095
Copy link

Describe the bug
Pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: mypod
labels:
app: myapp
spec:
containers:
- name: mycontainer
image: nginx:latest
ports:
- containerPort: 80

code:

V1Pod v1Pod = Yaml.loadAs(values, V1Pod.class);
coreV1Api.createNamespacedPod(namespace, v1Pod).execute();

Error:

HTTP response code: 403
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"pods "mypod" is forbidden: pod rejected: Pod Overhead set without corresponding RuntimeClass defined Overhead","reason":"Forbidden","details":{"name":"mypod","kind":"pods"},"code":403}

Maybe V1Pod.overhead is empty map not null ?

class V1Pod {
apiVersion: v1
kind: Pod
metadata: class V1ObjectMeta {
annotations: {}
creationTimestamp: null
deletionGracePeriodSeconds: null
deletionTimestamp: null
finalizers: null
generateName: null
generation: null
labels: {app=myapp}
managedFields: null
name: mypod
namespace: null
ownerReferences: [class V1OwnerReference {
apiVersion: thup.com/v1
blockOwnerDeletion: false
controller: true
kind: Dooke
name: release-name-sut
uid: 8e243650-5ed8-4895-8ba0-9d14d9ea8d09
}]
resourceVersion: null
selfLink: null
uid: null
}
spec: class V1PodSpec {
activeDeadlineSeconds: null
affinity: null
automountServiceAccountToken: null
containers: [class V1Container {
args: null
command: null
env: null
envFrom: null
image: nginx:latest
imagePullPolicy: null
lifecycle: null
livenessProbe: null
name: mycontainer
ports: [class V1ContainerPort {
containerPort: 80
hostIP: null
hostPort: null
name: null
protocol: null
}]
readinessProbe: null
resizePolicy: null
resources: null
restartPolicy: null
securityContext: null
startupProbe: null
stdin: null
stdinOnce: null
terminationMessagePath: null
terminationMessagePolicy: null
tty: null
volumeDevices: null
volumeMounts: 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: {}
os: null
overhead: {}
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: null
}
status: null
}

Client Version
20.0.1

Kubernetes Version
1.23.6

Java Version
Java 8

@xiaoyu1095
Copy link
Author

same bug in V1CustomResourceDefinition.V1JSONSchemaProps . When I replaced empty map with null, the submission was successful."
schemaProps.setDependencies(null);
// 清理 definitions 字段
schemaProps.setDefinitions(null);
// 清理 patternProperties 字段
schemaProps.setPatternProperties(null);

@xiaoyu1095
Copy link
Author

Perhaps I used the wrong version? Which version should I use?

api.updateStatus(application, (app) -> app.getStatus());

class V1Status {
apiVersion: v1
code: 415
details: null
kind: Status
message: the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
metadata: class V1ListMeta {
_continue: null
remainingItemCount: null
resourceVersion: null
selfLink: null
}
reason: UnsupportedMediaType
status: Failure
}

@brendandburns
Copy link
Contributor

This is a duplicate of this bug:

#3076

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