Skip to content

Skip router ConfigMap entries when TLS credential secrets are missing#2449

Open
AryanP123 wants to merge 3 commits into
skupperproject:mainfrom
AryanP123:secret-router-access
Open

Skip router ConfigMap entries when TLS credential secrets are missing#2449
AryanP123 wants to merge 3 commits into
skupperproject:mainfrom
AryanP123:secret-router-access

Conversation

@AryanP123
Copy link
Copy Markdown
Contributor

Fixes #2433

@AryanP123 AryanP123 force-pushed the secret-router-access branch 7 times, most recently from 990bf32 to 30510e0 Compare May 15, 2026 20:34
@AryanP123 AryanP123 marked this pull request as draft May 19, 2026 13:17
@AryanP123 AryanP123 force-pushed the secret-router-access branch from 30510e0 to f0a59d1 Compare May 26, 2026 14:41
@AryanP123 AryanP123 marked this pull request as ready for review May 26, 2026 17:15
Comment thread internal/site/routeraccess.go Outdated
Comment on lines +68 to +78
func (m RouterAccessMap) DesiredConfigAllowingTlsSecrets(targetGroups []string, profilePath string, tlsSecretAllowed func(string) bool) *RouterAccessConfig {
source := m
if tlsSecretAllowed != nil {
source = make(RouterAccessMap, len(m))
for k, ra := range m {
if ra.Spec.TlsCredentials != "" && !tlsSecretAllowed(ra.Spec.TlsCredentials) {
continue
}
source[k] = ra
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if this function is skipping RouterAccess entries with tlsCredentials configured but not included in the profile watcher cache; I would suggest some naming changes:

  • tlsSecretAllowed --> isCredentialInCache or credentialExists
  • DesiredConfigAllowingTlsSecrets --> DesiredConfigWithAvailableCredentials

Comment thread internal/site/bindings.go Outdated
listeners map[string]*skupperv2alpha1.Listener
multiKeyListeners map[string]*skupperv2alpha1.MultiKeyListener
handler BindingEventHandler
tlsSecretAllowed func(secretName string) bool
Copy link
Copy Markdown
Member

@nluaces nluaces May 27, 2026

Choose a reason for hiding this comment

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

maybe it could be renamed to isTlsSecretAvailable or isTlsSecretPresent ?

Comment thread internal/site/bindings.go Outdated
b.SiteId = siteId
}

func (b *Bindings) SetTlsSecretAllowed(f func(string) bool) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe it could be renamed to SetIsTlsSecretPresent or to SetSecretChecker for better readability, what do you think?

@AryanP123 AryanP123 force-pushed the secret-router-access branch from 5d69ec0 to dddb71a Compare May 27, 2026 18:42
@AryanP123 AryanP123 requested a review from nluaces May 27, 2026 19:04
Copy link
Copy Markdown
Member

@fgiorgetti fgiorgetti left a comment

Choose a reason for hiding this comment

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

It worked well for me.

I have been able to create links and accesses resources without providing a secret and that did not prevent other resources from being reconciled and configured.

Restarting the skupper-router deployment worked fine without blocking the config-init container.

One comment, though, was the Listeners and Connectors that refer to tlsCredentials that do not exist, are processed without warning or errors on the CR status. It would be nice to get a similar behavior to what we have with Links and RouterAccesses.

Comment thread internal/kube/site/extended_bindings.go Outdated
func (b *ExtendedBindings) AddSslProfiles(config *qdr.RouterConfig, definitions map[string]*skupperv2alpha1.AttachedConnector) bool {
profiles := map[string]qdr.SslProfile{}
for _, c := range definitions {
if c.Spec.TlsCredentials != "" && !b.bindings.TlsCredentialIncluded(c.Spec.TlsCredentials) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. Minor (optional), but we could move the 2nd condition here under the if statement below.
  2. Maybe log a message saying attached connector is being skipped?

@AryanP123 AryanP123 requested a review from fgiorgetti May 28, 2026 15:44
}
for _, secretName := range profileSecrets(credentialName) {
secret, err := w.Cache.Get(w.keyfunc(secretName))
if err == nil && secret != nil && secret.Type == corev1.SecretTypeTLS {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have we committed anywhere else that the Secret must have type kubernetes.io/tls? IIRC I've used opaque before just out of kubectl convenience and it works out fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Was matching existing code. ProfilesWatcher and kube-adaptor secrets.Sync already only handle kubernetes.io/tls secrets, and doc/tls/README.md documents that layout. It states Skupper expects TLS credentials in standard kubernetes.io/tls format with tls.crt, tls.key, and optionally ca.crt. I kept the same check here so we don’t treat a secret as “ready” if the adaptor won’t sync it. Let me know if you prefer to change it.

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.

Kube-adaptor is not syncing resources when a secret is missing

4 participants