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

Enable KafkaSource auth support #1403

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions control-plane/pkg/reconciler/source/auth_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,21 @@ func (ks *SecretLocator) SecretName() (string, bool) {
if !hasAuthConfig(ks.KafkaSource) {
return "", false
}
return getName(ks.KafkaSource), hasAuthConfig(ks.KafkaSource)
// KafkaSource uses a secret provider `security.NetSpecSecretProviderFunc` that ignores name and namespace.
// so there is no need to return a name here.
return "", hasAuthConfig(ks.KafkaSource)
}

func (ks *SecretLocator) SecretNamespace() (string, bool) {
return ks.Namespace, hasAuthConfig(ks.KafkaSource)
}

func getName(ks *sources.KafkaSource) string {
return ""
}

func hasAuthConfig(ks *sources.KafkaSource) bool {
// TODO handle secrets
//return (ks.Spec.KafkaAuthSpec.Net.TLS.Enable || ks.Spec.KafkaAuthSpec.Net.SASL.Enable) &&
// (ks.Spec.KafkaAuthSpec.Net.TLS.Cert.SecretKeyRef != nil ||
// ks.Spec.KafkaAuthSpec.Net.SASL.User.SecretKeyRef != nil ||
// ks.Spec.KafkaAuthSpec.Net.SASL.Password.SecretKeyRef != nil ||
// ks.Spec.KafkaAuthSpec.Net.SASL.Type.SecretKeyRef != nil)
return false
return (ks.Spec.KafkaAuthSpec.Net.TLS.Enable || ks.Spec.KafkaAuthSpec.Net.SASL.Enable) &&
(ks.Spec.KafkaAuthSpec.Net.TLS.Cert.SecretKeyRef != nil ||
ks.Spec.KafkaAuthSpec.Net.TLS.CACert.SecretKeyRef != nil ||
ks.Spec.KafkaAuthSpec.Net.TLS.Key.SecretKeyRef != nil ||
ks.Spec.KafkaAuthSpec.Net.SASL.User.SecretKeyRef != nil ||
ks.Spec.KafkaAuthSpec.Net.SASL.Password.SecretKeyRef != nil ||
ks.Spec.KafkaAuthSpec.Net.SASL.Type.SecretKeyRef != nil)
}