kubernetes: Kubectl 1.4 does not trim --- seperator

Kubernetes version (use kubectl version):

Client: 1.4.0
Server: 1.4.0

Environment:

  • Cloud provider or hardware configuration: Any
  • OS (e.g. from /etc/os-release): Any
  • Kernel (e.g. uname -a): Any
  • Install tools: Any

What happened: If I use a template with the --- seperator, and if the line with the separator has trailing whitespace characters, then kubectl considers that to be the EOF instead of reading further.

e.g. template

apiVersion: v1
kind: ReplicationController
metadata:
  name: testnginx
spec:
  replicas: 2
  selector:
    name: testnginx
  template:
    metadata:
      labels:
        name: testnginx
    spec:
      containers:
        - name: testnginx
          image: nginx
          ports:
            - containerPort: 80

---    

apiVersion: v1
kind: Service
metadata:
  name: testnginx
  labels:
    name: testnginx
    type: ui
spec:
  ports:
  - port: 8000
    targetPort: 80
  selector:
    name: testnginx

What you expected to happen:

It should not stop reading if there are trailing whitespace characters, it should just trim the separator line and ignore the whitespaces after the ---.

This is how it worked until v1.3.0 kubectl version.

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

Just use the template from above and you’ll notice that it won’t create the Service, but it’ll create the Replication controller.

Anything else do we need to know: This is on kubectl version 1.4.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (13 by maintainers)

Commits related to this issue

Most upvoted comments

@alena1108 I will double check this regression, and open a cherry-pick PR.