Reference implementation of the ServiceBinding.io 1.1 spec, along with 1.0. The full specification is implemented, please open an issue for any discrepancies.
You’ll need a Kubernetes cluster to run against. You can use kind to get a local cluster for testing, or run against a remote cluster.
After the controller is deployed, try out the samples.
The easiest way to get started is by deploying the latest release. Alternatively, you can build the runtime from source.
Define where to publish images:
export KO_DOCKER_REPO=<a-repository-you-can-write-to>
For kind, a registry is not required:
export KO_DOCKER_REPO=kind.local
Build and deploy the controller to the cluster:
Note: The cluster must have the cert-manager deployed. There is a make deploy-cert-manager target to deploy the cert-manager.
make deploy
Undeploy the controller to the cluster:
make undeploy
Samples are located in the samples directory, including:
Kubernetes defines no provisioned services by default, however, Secrets may be directly referenced.
Additional services can be supported dynamically by defining a ClusterRole.
Support for the built-in k8s workload resource is pre-configured including:
DaemonSetDeploymentReplicaSetStatefulSetCronJob (also includes a ClusterResourceMapping)Job (since Jobs are immutable, the ServiceBinding must be defined and service resolved before the job is created)ReplicationControllerAdditional workloads can be supported dynamically by defining a ClusterRole and if not PodSpecable, a ClusterWorkloadResourceMapping.
The Service Binding for Kubernetes Specification defines the shape of Provisioned Services, and how the Secret is projected into a workload. The spec says less (intentionally) about how this happens.
Both a controller and mutating admission webhook are used to project a Secret defined by the service referenced by the ServiceBinding resource into the workloads referenced. The controller is used to process ServiceBindings by resolving services, projecting workloads and updating the status. The webhook is used to prevent removal of the workload projection, projecting workload on create, and a notification trigger for ServiceBindings the controller should process.
The apis, resolver and projector packages are defined by the reference implementation and reused here with slight modifications. The bulk of the work to bind a service to a workload is encapsulated with these packages. The output from the projector is deterministic and idempotent. The order that service bindings are applied to, or removed from, a workload does not matter. If a workload is bound and then unbound, the only trace will be the SERVICE_BINDING_ROOT environment variable.
There are a limited number of resources that maintain an informer cache within the manager:
ServiceBindingClusterWorkloadResourceMappingMutatingWebhookConfigurationValidatingWebhookConfigurationWhen a ServiceBinding is created, updated or deleted the controller processes the resource. It will:
.spec.binding.name for the name of the Secret to bindSecret name onto the ServiceBinding's .status.binding.nameServiceAvailable condition is updated on the ServiceBindingClusterWorkloadResourceMapping is resolved for the apiVersion/kind of the workload (or a default value for a PodSpecable workload is used)Secret name is projected into the workloadReady condition is updated on the ServiceBindingIn addition to that main flow, a MutatingWebhookConfiguration and ValidatingWebhookConfiguration are updated:
ServiceBindings in the cluster are resolvedMutatingWebhookConfiguration are updated based on the set of all workload group-kinds referencedValidatingWebhookConfiguration are updated based on the set of all workload and service group-kinds referencedThe MutatingWebhookConfiguration is used to intercept create and update requests for workloads:
ServiceBindings targeting the workload are resolvedClusterWorkloadResourceMapping is resolved for the apiVersion/kind of the workload (or a default value for a PodSpecable workload is used)ServiceBinding the resolved Secret name is projected into the workloadThe ValidatingWebhookConfiguration is used as an alternative to watching the API Server directly for these types and keeping an informer cache. When a webhook request is received, the ServiceBindings that reference that resource as a workload or service are resolved and enqueued for the controller to process.
No blocking work is performed within the webhooks.
Run the unit tests:
make test
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
make manifests
NOTE: Run make help for more information on all potential make targets
More information can be found via the Kubebuilder Documentation
The Service Binding Controller project is a community lead effort. A bi-weekly working group call is open to the public. Discussions occur here on GitHub and on the #bindings-discuss channel in the Kubernetes Slack.
If you catch an error in the implementation, please let us know by opening an issue at our GitHub repository.
Participation in the Service Binding community is governed by the Contributor Covenant.
Go
99.0%
Reference implementation of the ServiceBinding.io 1.1 spec, along with 1.0. The full specification is implemented, please open an issue for any discrepancies.
You’ll need a Kubernetes cluster to run against. You can use kind to get a local cluster for testing, or run against a remote cluster.
After the controller is deployed, try out the samples.
The easiest way to get started is by deploying the latest release. Alternatively, you can build the runtime from source.
Define where to publish images:
export KO_DOCKER_REPO=<a-repository-you-can-write-to>
For kind, a registry is not required:
export KO_DOCKER_REPO=kind.local
Build and deploy the controller to the cluster:
Note: The cluster must have the cert-manager deployed. There is a make deploy-cert-manager target to deploy the cert-manager.
make deploy
Undeploy the controller to the cluster:
make undeploy
Samples are located in the samples directory, including:
Kubernetes defines no provisioned services by default, however, Secrets may be directly referenced.
Additional services can be supported dynamically by defining a ClusterRole.
Support for the built-in k8s workload resource is pre-configured including:
DaemonSetDeploymentReplicaSetStatefulSetCronJob (also includes a ClusterResourceMapping)Job (since Jobs are immutable, the ServiceBinding must be defined and service resolved before the job is created)ReplicationControllerAdditional workloads can be supported dynamically by defining a ClusterRole and if not PodSpecable, a ClusterWorkloadResourceMapping.
The Service Binding for Kubernetes Specification defines the shape of Provisioned Services, and how the Secret is projected into a workload. The spec says less (intentionally) about how this happens.
Both a controller and mutating admission webhook are used to project a Secret defined by the service referenced by the ServiceBinding resource into the workloads referenced. The controller is used to process ServiceBindings by resolving services, projecting workloads and updating the status. The webhook is used to prevent removal of the workload projection, projecting workload on create, and a notification trigger for ServiceBindings the controller should process.
The apis, resolver and projector packages are defined by the reference implementation and reused here with slight modifications. The bulk of the work to bind a service to a workload is encapsulated with these packages. The output from the projector is deterministic and idempotent. The order that service bindings are applied to, or removed from, a workload does not matter. If a workload is bound and then unbound, the only trace will be the SERVICE_BINDING_ROOT environment variable.
There are a limited number of resources that maintain an informer cache within the manager:
ServiceBindingClusterWorkloadResourceMappingMutatingWebhookConfigurationValidatingWebhookConfigurationWhen a ServiceBinding is created, updated or deleted the controller processes the resource. It will:
.spec.binding.name for the name of the Secret to bindSecret name onto the ServiceBinding's .status.binding.nameServiceAvailable condition is updated on the ServiceBindingClusterWorkloadResourceMapping is resolved for the apiVersion/kind of the workload (or a default value for a PodSpecable workload is used)Secret name is projected into the workloadReady condition is updated on the ServiceBindingIn addition to that main flow, a MutatingWebhookConfiguration and ValidatingWebhookConfiguration are updated:
ServiceBindings in the cluster are resolvedMutatingWebhookConfiguration are updated based on the set of all workload group-kinds referencedValidatingWebhookConfiguration are updated based on the set of all workload and service group-kinds referencedThe MutatingWebhookConfiguration is used to intercept create and update requests for workloads:
ServiceBindings targeting the workload are resolvedClusterWorkloadResourceMapping is resolved for the apiVersion/kind of the workload (or a default value for a PodSpecable workload is used)ServiceBinding the resolved Secret name is projected into the workloadThe ValidatingWebhookConfiguration is used as an alternative to watching the API Server directly for these types and keeping an informer cache. When a webhook request is received, the ServiceBindings that reference that resource as a workload or service are resolved and enqueued for the controller to process.
No blocking work is performed within the webhooks.
Run the unit tests:
make test
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
make manifests
NOTE: Run make help for more information on all potential make targets
More information can be found via the Kubebuilder Documentation
The Service Binding Controller project is a community lead effort. A bi-weekly working group call is open to the public. Discussions occur here on GitHub and on the #bindings-discuss channel in the Kubernetes Slack.
If you catch an error in the implementation, please let us know by opening an issue at our GitHub repository.
Participation in the Service Binding community is governed by the Contributor Covenant.
Go
99.0%