8000 Kubectl dedups API errors and hides bugs · Issue #130656 · kubernetes/kubernetes · GitHub
[go: up one dir, main page]

Skip to content
Kubectl dedups API errors and hides bugs #130656
@thockin

Description

@thockin

Digging around in validation we realized that several resources end up calling duplicate validation logic on updates - they call ValidateFoo() and then ValidateFooUpdate() which calls validateFoo() internally. I'd call this a BUG.

So why have we never seen it? Because kubectl de-dups errors.

$ k --context=diy apply -f /tmp/rc.yaml
The ReplicationController "nginx" is invalid: spec.replicas: Invalid value: -1: must be greater than or equal to 0

$ k -v 9 --context=diy apply -f /tmp/rc.yaml 2>&1 | tail -5 | grep '"kind":"Status"' | jq .
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "ReplicationController \"nginx\" is invalid: spec.replicas: Invalid value: -1: must be greater than or equal to 0",
  "reason": "Invalid",
  "details": {
    "name": "nginx",
    "kind": "ReplicationController",
    "causes": [
      {
        "reason": "FieldValueInvalid",
        "message": "Invalid value: -1: must be greater than or equal to 0",
        "field": "spec.replicas"
      },
      {
        "reason": "FieldValueInvalid",
        "message": "Invalid value: -1: must be greater than or equal to 0",
        "field": "spec.replicas"
      }
    ]
  },
  "code": 422
}

Is this a feature or a bug?

Metadata

Metadata

Assignees

Labels

sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.sig/cliCategorizes an issue or PR as relevant to SIG CLI.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0