Closed baijum closed 3 years ago
I came across this issue while trying to implement this feature for KubePreset. For the convenience of testing, I have created a custom resource: https://github.com/kubepreset/custompod/blob/main/api/v1beta1/custompod_types.go (I am calling it as Non-PodSpec-able Custom Pod)
This didn't make it into the spec (not sure why), but at the time my suggestion was to say that only the first path in the containers list should support index based binding; all entries support binding by container name. This issue could also be side stepped if we revisit #146
This issue could also be side stepped if we revisit #146
If we could remove the container matching by index, differentiating containers and init containers are not required. This way, we could retain the text of application resource mapping.
From today's meeting:
- Need to research uniqueness of name across both init-containers and ephemeral containers
The ephemeral containers is an alpha feature and not in the scope of of the spec. The spec deals with nomal containers and init containers. However, the name of all containers (normal, init, and ephemeral) is unique. Few references:
This didn't make it into the spec (not sure why), but at the time my suggestion was to say that only the first path in the containers list should support index based binding;
I just noticed that its there in the spec (It was in the Reconciler Implementation section, and I missed it):
If a
ServiceBinding
specifies a.spec.applications.containers
value, and the value contains anInt
-based index, that index MUST be used to filter the first entry in the.containers
list and all other entries in those lists are ineligible for mapping.
We discussed three options (adding separate init container field, removing match by-index, restricting first entry for match by-index) and decided to go for removing match by-index, I hope we can still proceed with that decision. I think that would be better choice considering the spec already recommend to avoid by-index due to its fragile nature.
Based on the discussion, I have created a pull request: #171
Service Binding section treats containers and init containers differently.
For example, consider this normative text:
The Application Resource Mapping doesn't differentiate between containers and init containers. As a result, it is hard to follow the different rules for both containers and init containers.
I would propose to add an
initContainers
field to avoid ambiguity.