Home > Blockchain >  different indention in yaml file
different indention in yaml file

Time:10-07

In differente examples i came across following kind of configuration ...

   ...   
      volumes:
        - name: my-pv
          persistentVolumeClaim:
            claimName: pv-claim
      containers:
      - name: my-web
        image: nginx
   ...

why the difference of the indention? why is the vol node element(- name: my-pv) more indented than the containers node element (- name: my-web)? Has that anything to say? I could not find any explanation for that.

CodePudding user response:

Both blocks

volumes:
  - name: my-pv

and

containers:
- name: my-web

are structurally similar - they represents list of objects. YAML allows that. For sake of consistency, use either of styles, but not both. This is exactly yamllint's indentation rules are for.

  • Related