Why do these Tekton resources need to be in separate YAML files?

Hi :wave:

Does anyone know why putting these resources into a single file does not work, but having them in separate files work perfectly fine?

Running oc apply -f big_file.yaml on this does not work:

apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerBinding
  name: http-get-translater
  - name: placeholder
    value: nothing

apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
  name: http-get-listener
  serviceAccountName: pipeline
    - name: http-get-trigger 
      - ref: http-get-translater
        ref: http-get-dispatcher

apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
  name: http-get-dispatcher
  - apiVersion: tekton.dev/v1beta1
    kind: PipelineRun
      generateName: http-get-run-by-listener
        name: http-get

But running oc apply -f folder_with_resources_in_separate_files/ works.

I’ve tried changing the order of the resources within the file to see if it’s like a dependency issue, but could not get things working. Any ideas?

Thank you for your time :pray:

Put this line between logical documents in a single file:


Thanks for the tip. I gave it a try and it didn’t work.

I’m stumped why the separator --- would make a difference in the way the YAML files or processed…just out of curiosity.

Please let me know if there are other things I can try.

I must be missing something fundamental because I can’t reason out why separate files would matter and why --- would matter when defining the resources.

Thank you again for your time :pray:

Sorry, I goof’d. It did work!

But why? and how come?

why does defining resources in separate files or separated documents matter to kubernetes/openshift?

hmmm :thinking:…is each file intended to describe just one resource/object?
is it wrong to think of each file as a list of resources/objects?
I thought I’ve had YAML files that list multiple resources/objects, but maybe my memory is wrong…
is this a Kubernetes convention or a YAML convention?

ah…I think I understand now.
the latter keys in the YAML file overwrite the earlier keys
Kubernetes could have supported multiple resources in a single document if the root of the document starts off as a list
so I guess this is one of those by design things?
sorry for the barrage of messages and newbie mistake
thank you for pointing me in the right direction and pointing out a basic detail I had skipped over for the longest time :pray:

USUALLY a single file is a single YAML document, meaning a single kube API resource.

The --- syntax is the “document separator” in YAML, which allows one file to hold multiple documents.

1 Like

Thank you for confirming :bow:
I’m curious when are the times that this is not the case?

When <what specifically> is not the case?

I said “usually” because that’s how many people manage their files - 1 resource == 1 file. But YAML has this syntax and we do support it, so users are free to do it 1:1 or N:1 as they see fit.

okay, good to know. thanks again for your help :pray: