kubernetes-cd-plugin icon indicating copy to clipboard operation
kubernetes-cd-plugin copied to clipboard

Unprocessable Entity is not a helpful error message

Open johnjeffers opened this issue 4 years ago • 3 comments

Getting this error when trying to deploy.

Starting Kubernetes deployment
ERROR: ERROR: java.lang.RuntimeException: io.kubernetes.client.ApiException: Unprocessable Entity

We don't see what's wrong with our deployment. Is there any way to have the error message include the line(s) that caused the error?

johnjeffers avatar Aug 28 '19 16:08 johnjeffers

@johnjeffers Could you please provide the sample to reproduce this issue?

gavinfish avatar Aug 29 '19 02:08 gavinfish

We suspect it was malformed YAML. Here's a sample:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  namespace: my-app
  labels:
    app: my-app
    team: ops
    environment: stg
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
       app: my-app
       team: ops
       environment: stg
    spec:
      containers:
      - name: my-app
      ...

Items under spec.template.metadata.labels had the wrong indent. Obviously this is our fault, and the person responsible could have caught this with a YAML linter.

It would be very helpful if the error message indicated the line number at which it encountered the problem, or even something indicating it was malformed YAML. "Unprocessable Entity" is too vague.

Thank you!

johnjeffers avatar Aug 29 '19 03:08 johnjeffers

Can you provide a more complete console log, I think there should be more logs @johnjeffers

runzexia avatar Aug 29 '19 06:08 runzexia