Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutating immutable resources #12

Open
sadlerap opened this issue Dec 15, 2021 · 2 comments
Open

Mutating immutable resources #12

sadlerap opened this issue Dec 15, 2021 · 2 comments

Comments

@sadlerap
Copy link
Contributor

From the spec:

Values referenced by JSONPaths in both the MappingTemplate and MappingContainers MUST be mutated by a ServiceBinding reconciler as if they were defined directly by a PodTemplateSpec.

How then should we treat immutable resources, such as Jobs? Similarly, how do we treat containers with restartPolicy: Never, where mutating the resource won’t change the underlying Pod? Explicitly stating that mutation occurs might limit our functionality, since wording this effectively prevents us from supporting Jobs and other immutable resources.

@scothis
Copy link
Contributor

scothis commented Dec 20, 2021

How then should we treat immutable resources, such as Jobs?

The VMware implementation has a sample that uses a batch/v1 Job for the workload. Since Jobs becomes immutable upon creation, the easiest way to bind a service within a cluster is to intercept the request with a mutating admission webhook. The service binding controller dynamically configures the MutatingWebhookConfiguration to intercept requests to create/update the workload types.

The above is likely too much detail to put into the spec. An implementation may choose to not support immutable resources. We could say something like an implementation should act in good faith to bind a service to a workload, but may not succeed based on extant circumstances in the cluster. Non conformance should be reflected the ServiceBinding's conditions.

Similarly, how do we treat containers with restartPolicy: Never, where mutating the resource won’t change the underlying Pod?

The container restart policy is irrelevant to us. When we bind into a workload, the controller for that workload should trigger the rollout of new Pods based on its own implementation.

@nebhale nebhale transferred this issue from servicebinding/spec Jan 6, 2022
@nebhale
Copy link
Member

nebhale commented Jan 6, 2022

Content should be included in an Implementors Guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants