Skip to content

Commit

Permalink
add instance external name to credentials secret (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
kerenlahav authored Mar 16, 2023
1 parent a3f26b9 commit 8efd50e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions controllers/servicebinding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ func (r *ServiceBindingReconciler) addInstanceInfo(ctx context.Context, binding
}

credentialsMap["instance_name"] = []byte(binding.Spec.ServiceInstanceName)
credentialsMap["instance_external_name"] = []byte(instance.Spec.ExternalName)
credentialsMap["instance_guid"] = []byte(instance.Status.InstanceID)
credentialsMap["plan"] = []byte(instance.Spec.ServicePlanName)
credentialsMap["label"] = []byte(instance.Spec.ServiceOfferingName)
Expand Down
4 changes: 3 additions & 1 deletion controllers/servicebinding_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var _ = Describe("ServiceBinding controller", func() {
}

JustBeforeEach(func() {
createdInstance = createInstance(context.Background(), instanceName, bindingTestNamespace, "")
createdInstance = createInstance(context.Background(), instanceName, bindingTestNamespace, instanceName+"-external")
})

BeforeEach(func() {
Expand Down Expand Up @@ -379,6 +379,8 @@ var _ = Describe("ServiceBinding controller", func() {
bindingSecret := getSecret(ctx, createdBinding.Spec.SecretName, createdBinding.Namespace, true)
validateSecretData(bindingSecret, "secret_key", "secret_value")
validateSecretData(bindingSecret, "escaped", `{"escaped_key":"escaped_val"}`)
validateSecretData(bindingSecret, "instance_external_name", createdInstance.Spec.ExternalName)
validateSecretData(bindingSecret, "instance_name", createdInstance.Name)
validateInstanceInfo(bindingSecret)
credentialProperties := []SecretMetadataProperty{
{
Expand Down

0 comments on commit 8efd50e

Please sign in to comment.