vmware-archive / operator-builder

A Kubebuilder plugin to accelerate the development of Kubernetes operators
MIT License
41 stars 6 forks source link

feat: inline resources #292

Open scottd018 opened 2 years ago

scottd018 commented 2 years ago

Add the ability to specify resources inline with the operator-builder workload configuration. This obviously is not to encourage someone to type out an entire deployment in their workload config, rather it would be useful for something like a Namespace resource where one may need to be created, but it is not desirable to manage a separate file for that resource. That would change the spec for resources to:

resources:
  - inline: |
      apiVersion: v1
      kind: Namespace
      metadata:
        name: my-namespace # +operator-builder:field:name=myField,default=my-namespace,type=string
  - file: path/to/another/resource.yaml

We should also maintain backwards compatibility and assume that the absence of a file or inline key would default to it being a file. E.g. this would still be valid:

resources:
  - path/to/legacy/resource.yaml