Skip to content

kubectl / kubernetes not 100% compatible with YAML 1.2 #34146

Open
@chrishiestand

Description

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): is:issue yaml in:title version


Is this a BUG REPORT or FEATURE REQUEST? (choose one): Bug Report

Kubernetes version (use kubectl version): v1.3.7 (seems to be the same on master)

What happened: I tried to apply a yaml file with kubectl --context=minikube apply -f ./etc/deployment.yaml and got a validation error. However the yaml is valid 1.2.

The error is:
error validating "./etc/deployment.yaml": error validating data: expected type string, for field spec.template.spec.containers[2].command[6], got bool; if you choose to ignore these errors, turn validation off with --validate=false

What you expected to happen: kubectl should apply the deployment file

How to reproduce it (as minimally and precisely as possible):

Try to apply this object file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      name: redis
  template:
    metadata:
      labels:
        name: redis
    spec:
      containers:
        -
          name: redis
          image: 'redis:3.2'
          command:
            - redis-server
            - '--appendonly'
            - no

Anything else do we need to know:

The "no" is the source of confusion for the program. In previous YAML versions this should be translated to be a boolean value, but in the current, 1.2, it should be a string "no". kubectl is using the older standard and translating this as a bool.

It is not so simple for me as to quote the "no" value like 'no' - this object file is the output of another library which uses the 1.2 standard. We need to be aware that of course people will use various libraries to consume and produce yaml.

I believe the problem can be traced from this https://github.com/ghodss/yaml to this source library here: https://github.com/cloudfoundry-incubator/candiedyaml/blob/master/resolver.go#L42

Should kubernetes only support YAML 1.2? It seems to me that we'd want to deprecate previous yaml support since YAML is not backwards compatible. YAML spec versions at: http://yaml.org/ - I have noticed that several of the online yaml validators also seem to get this "wrong".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/kubectllifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.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

    Backlog
  • Status

    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions