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

Reconcile all secret with label konghq.com/credential #5398

Closed
1 task done
piotrwielgolaski-tomtom opened this issue Jan 4, 2024 · 4 comments · Fixed by #5816
Closed
1 task done

Reconcile all secret with label konghq.com/credential #5398

piotrwielgolaski-tomtom opened this issue Jan 4, 2024 · 4 comments · Fixed by #5816
Assignees
Milestone

Comments

@piotrwielgolaski-tomtom
Copy link

piotrwielgolaski-tomtom commented Jan 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem Statement

When configuration is build controller ignores all secret until it find reference in any consumer
which leads to invalid/incomplete configuration (it must wait for another reconcile cycle - default 2min)

Proposed Solution

Additional information

This will populate store with all secret that may be used by consumers

Idea in code

func (r *CoreV1SecretReconciler) shouldReconcileSecret(obj client.Object) bool {
	secret, ok := obj.(*corev1.Secret)
	if !ok {
		return false
	}

	labels := secret.Labels
	if labels != nil && labels[CACertLabelKey] == "true" {
		return true
	}

	if _, ok = labels["konghq.com/credential"]; ok {
		return true
	}

	referred, err := r.ReferenceIndexers.ObjectReferred(secret)
	if err != nil {
		r.Log.Error(err, "Failed to check whether secret referred",
			"namespace", secret.Namespace, "name", secret.Name)
		return false
	}

	return referred
}

Acceptance Criteria

No response

@piotrwielgolaski-tomtom
Copy link
Author

piotrwielgolaski-tomtom commented Jan 4, 2024

it should help also for #5175

@pmalek pmalek self-assigned this Apr 4, 2024
@pmalek pmalek added this to the KIC v3.2.x milestone Apr 4, 2024
@pmalek
Copy link
Member

pmalek commented Apr 4, 2024

Hi @piotrwielgolaski-tomtom,

Thanks for reporting this issue. #5816 should fix this.

@rainest
Copy link
Contributor

rainest commented Apr 4, 2024

@piotrwielgolaski-tomtom do you know what's actually causing the reconcile by reference to fail and require a second pass? Offhand I'd expect that approach should work, since we shouldn't need Secrets with no references.

tl;dr from #5816 (review) do you observe this specifically when creating a KongConsumer and its Secret at the same time (so we aren't necessarily aware of the reference at Secret creation time), or does it happen consistently regardless?

I think we'll probably just go with the simpler approach of ingesting all credentials unless we find we need tighter bound, but it'd be useful to understand the exact nature of this problem should we need to re-introduce reference-based ingest in the future.

@pmalek
Copy link
Member

pmalek commented Apr 5, 2024

#5819 was created to track the enhancement of not storing all the Secrets with the credential label.

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 a pull request may close this issue.

3 participants