servicebinding / spec

Specification for binding services to k8s workloads
https://servicebinding.io
Apache License 2.0
92 stars 35 forks source link

Cluster Application Resource Mapping #141

Closed nebhale closed 3 years ago

nebhale commented 3 years ago

This change adds an extension specification for a cluster-wide mapping of non-Podspec-able resource types acting as applications.

nebhale commented 3 years ago

Wildcards for versions?

nebhale commented 3 years ago

@arturdzm Can you please write up an example for RuntimeComponent?

nebhale commented 3 years ago

@arthurdm Wildcard added and ready for review.

arturdzm commented 3 years ago

Example for RuntimeComponent

apiVersion: service.binding/v1alpha2
kind: ClusterApplicationResourceMapping
metadata:
 name:  app.stacks.runtimecomponent
spec:
  versions:
  - version: v1beta1
    env:
    - .spec.env
    - .spec.initContainers[*].env
    volumeMounts:
    - .spec.volumeMounts
    - .spec.initContainers[*].volumeMounts
    volumes: .spec.volumes

We do not have containers[] in the spec, but RuntimeComponent has spec.initContainers We do have spec.sidecarContainers[] that is appended to main application container as is

scothis commented 3 years ago

@arturdzm should the sidecar containers be bindable as well? Something like:

  versions:
  - version: v1beta1
    env:
    - .spec.env
    - .spec.sidecarContainers[*].env
    - .spec.initContainers[*].env
    volumeMounts:
    - .spec.volumeMounts
    - .spec.sidecarContainers[*].volumeMounts
    - .spec.initContainers[*].volumeMounts
    volumes: .spec.volumes
nebhale commented 3 years ago

@scothis Well, we no longer have any examples with a hard-coded version at all, nor do we have any that show the "fallback to wildcard" behavior where some versions can be specified but not all. On the other hand, there are no in-the-wild examples of either of those, so trying to force them in seems like a mistake.