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

Create serviceBinding.io secret with type app only #3763

Conversation

ddraganovv
Copy link
Contributor

Is there a related GitHub Issue?

GitHub Issue

What is this change about?

When the type of the credential binding is 'key' creating a servicebinding.io secret is redundant. This PR's goal is changing the way the controller creates sbio secrets so it is only created when the type is 'app'

Does this PR introduce a breaking change?

No

Acceptance Steps

The servicebinding.io secret should not be created when the type of the credential binding is 'app'

@ddraganovv ddraganovv force-pushed the Bugfix_sbio_secret_created_for_key_bindings branch from 6ef4e3c to 911bb51 Compare January 27, 2025 22:51
log := logr.FromContextOrDiscard(ctx)

secretLookupKey := types.NamespacedName{Name: cfServiceBinding.Name, Namespace: cfServiceBinding.Namespace}
createdSecret := new(corev1.Secret)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest renaming createdSecret to credentialsSecret as the secret here stores the credentials for the binding. This name would convey what that secret is (improves readability)

I would also change the way the secret is being looked up to be align with the way we lookup objects:

credentialsSecret := &corev1.Secret{
	ObjectMeta: metav1.ObjectMeta{
			Name:      cfServiceBinding.Name,
			Namespace: cfServiceBinding.Namespace,
		},
}
if err := r.k8sClient.Get(ctx, client.ObjectKeyFromObject(credentialsSecret), credentialsSecret); err != nil {
	return nil, err
}

@ddraganovv ddraganovv force-pushed the Bugfix_sbio_secret_created_for_key_bindings branch from 911bb51 to b040248 Compare February 5, 2025 22:37
@ddraganovv ddraganovv force-pushed the Bugfix_sbio_secret_created_for_key_bindings branch from b040248 to c6c8e65 Compare February 5, 2025 22:39
@georgethebeatle georgethebeatle merged commit d6ab629 into cloudfoundry:main Feb 6, 2025
10 checks passed
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

Successfully merging this pull request may close these issues.

3 participants