0

I'm working in a project which process another application source and adds the kubernetes yaml file into that source from within it's browser UI. So for constructing the yaml I've written some code, that will generate the configmap.yaml file into project source. But in that case the generated yaml has some whitespaces before some properties.

sample code

apiVersion: v1
kind: Pod
metadata:
  name: dapi-test-pod
spec:
  containers:
    - name: test-container
      image: k8s.gcr.io/busybox
      command: [ "/bin/sh","-c","cat /etc/config/keys" ]
      volumeMounts:
      - name: config-volume
        mountPath: /etc/config

From the above code the line

containers:
  - name: test-container

has the property "name" which is indented by 4 values and the indicator "-" is indented by 2 values. but on the runtime generation of the yml by the application produces the file as below

containers:
- name: test-container

Here the "name" property has 2 indentation and the indicator "-" has 0 indentation. will the code with 2 indentation generated on run time work? or it needs the indentation as 4 as above.

moreover the below sample code differs totally form the above asked scenario.

volumeMounts:
- name: config-volume

what is the difference between this one and the above. Thanks in advance.

ram vinoth
  • 472
  • 4
  • 14

0 Answers0