Closed tcdowney closed 2 years ago
How I accepted this:
I started with the same app that the Service Bindings reconciler codebase uses to test.
---
applications:
- env:
SPRING_PROFILES_ACTIVE: "mysql"
kubectl -n $(cf space s --guid) apply -f https://raw.githubusercontent.com/vmware-tanzu/servicebinding/4248dce6f9f7617662a098a3f2ef37f0c706e32c/samples/spring-petclinic/service.yaml
to deploy a MySQL db I could usecf cups mysql -p '{"type":"mysql","provider":"mariadb","host":"spring-petclinic-db","port":"3306","database":"default","username":"user","password":"pass"}'`
cf push spring-petclinic --no-start
cf bind-service spring-petclinic mysql
cf push spring-petclinic
(it failed due to there being competing maven and gradle config present https://github.com/paketo-buildpacks/java/issues/423)
pom.xml
from the repoERROR: failed to launch: determine start command: when there is no default process a command is required
pom.xml
and deleted the gradle files insteadThis is what my spring-petclinic
working dir looked like after what I did to it:
✔ ~/workspace/spring-petclinic [main|✚ 6…1]
16:53 $ gst
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: build.gradle
deleted: gradle/wrapper/gradle-wrapper.jar
deleted: gradle/wrapper/gradle-wrapper.properties
deleted: gradlew
deleted: gradlew.bat
deleted: settings.gradle
Untracked files:
(use "git add <file>..." to include in what will be committed)
manifest.yml
Blockers/Dependencies
Background
Cloud Native Buildpacks and some app frameworks (such as Spring Cloud Bindings) are adopting the K8s ServiceBinding spec model of volume mounted secrets. We currently are providing apps access to these via the
VCAP_SERVICES
environment variable (see this issue) for backwards compatibility reasons, but want to support these newer developments in the ecosystem as well.We don't need to implement this ourselves. Theoretically any reconciler that adopts the spec can update Pod-specable workloads to do this. Let's look into using this Service Binding reconciler to do this and install it in our dev envs (Kind) and hack installation scripts. If we set up the
spec.workload
correctly in https://github.com/cloudfoundry/cf-k8s-controllers/issues/506 this reconciler should be able to modify theStatefulSets
that Eirini Controller is producing†. Then we can document that if developers/operators want this behavior they can use that reconciler or install a comparable one. If that all works well then it means we can avoid having to develop a partial implementation of the projection spec in our own controllers.As an App Developer I want service binding credentials to be projected into my running workloads via volume mounts So that I my K8s Service Binding-aware apps can find service binding credentials in the way they expect
† Let's confirm there is no contention between this reconciler and Eirini Controller
Acceptance Criteria
Documentation
GIVEN I have a cluster available WHEN I Follow our installation documentation THEN I Can install a Service Binding reconciler and see the K8s
ServiceBindings
associated with ourCFServiceBindings
get reconciled by itFunctionality
GIVEN I have installed cf-k8s-controllers and have included a Service Binding reconciler WHEN I bind a user-provided service instance to my app (
cf bind-service MY_APP MY_INSTANCE
) THEN I see that eventually there exists a K8sServiceBinding
(done in https://github.com/cloudfoundry/cf-k8s-controllers/issues/506) AND I see that the credentials for that binding are volume mounted into thePods
for my appDev Notes