Wednesday, 2 January 2019

What do YAML and COBOL have in common ?

They're both really really pedantic about columnar positioning ....

Whilst trying to create a Persistent Volume in my IBM Cloud Private (ICP) 3.1.1 cluster, using the following YAML: -

apiVersion: v1
kind: PersistentVolume
metadata:
  name: cam-mongo-pv
spec:
  capacity:
    storage: 15Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: dmhicp-boot.fyre.ibm.com
path: "/export/CAM_db"

the command: -


kubectl apply -f createCAM_PV1.yaml 

failed spectacularly with: -

error: error validating "createCAM_PV1.yaml": error validating data: [ValidationError(PersistentVolume): unknown field "path" in io.k8s.api.core.v1.PersistentVolume, ValidationError(PersistentVolume.spec.nfs): missing required field "path" in io.k8s.api.core.v1.NFSVolumeSource]; if you choose to ignore these errors, turn validation off with --validate=false

The solution was, of course, obvious .....

Yes, the path wasn't in line with the server element of the nfs section.

Bring back XML, all is forgiven !

Once I fixed my YAML: -

apiVersion: v1
kind: PersistentVolume
metadata:
  name: cam-mongo-pv
spec:
  capacity:
    storage: 15Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: dmhicp-boot.fyre.ibm.com
    path: "/export/CAM_db"

all was good :-)

kubectl apply -f createCAM_PV1.yaml 

persistentvolume/cam-mongo-pv created


2 comments:

Ben Langhinrichs said...

I am not sure I could handle that anymore. Columnar positioning really should have stayed a relic of the last millennium.

Dave Hay said...

I know, right !

Mind you, it's been an, as ever, enjoyable voyage of discovery

Interestingly, the IBM Cloud Private (ICP) GUI does generate the JSON representation of any action, but that's JSON ( akin to XML ) rather than YAML.

Sigh, so many formats, so little time ....

:-)