jenkinsci / kubernetes-cd-plugin

A Jenkins plugin to deploy to Kubernetes cluster
MIT License
140 stars 72 forks source link

Unprocessable Entity is not a helpful error message #102

Open johnjeffers opened 5 years ago

johnjeffers commented 5 years ago

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?

gavinfish commented 5 years ago

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

johnjeffers commented 5 years ago

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!

runzexia commented 5 years ago

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