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

[release-1.14] Fix EOF errors when using SASL_SSL PLAIN #4125

Merged
Show file tree
Hide file tree
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
17 changes: 6 additions & 11 deletions control-plane/pkg/reconciler/consumergroup/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,27 @@ import (
)

func (r *Reconciler) newAuthSecret(ctx context.Context, cg *kafkainternals.ConsumerGroup) (*corev1.Secret, error) {
var secret *corev1.Secret

if hasSecretSpecConfig(cg.Spec.Template.Spec.Auth) {
secret, err := security.Secret(ctx, &SecretSpecSecretLocator{cg}, security.DefaultSecretProviderFunc(r.SecretLister, r.KubeClient))
if err != nil {
return nil, err
}
return secret, nil
}

authContext, err := security.ResolveAuthContextFromLegacySecret(secret)
if err != nil {
return nil, err
}
return authContext.VirtualSecret, nil

} else if hasNetSpecAuthConfig(cg.Spec.Template.Spec.Auth) {
if hasNetSpecAuthConfig(cg.Spec.Template.Spec.Auth) {
auth, err := security.ResolveAuthContextFromNetSpec(r.SecretLister, cg.GetNamespace(), *cg.Spec.Template.Spec.Auth.NetSpec)
if err != nil {
return nil, err
}
secret, err = security.Secret(ctx, &NetSpecSecretLocator{cg}, security.NetSpecSecretProviderFunc(auth))
secret, err := security.Secret(ctx, &NetSpecSecretLocator{cg}, security.NetSpecSecretProviderFunc(auth))
if err != nil {
return nil, fmt.Errorf("failed to get secret: %w", err)
}
return secret, nil
}

return secret, nil
return nil, nil
}

type NetSpecSecretLocator struct {
Expand Down
4 changes: 2 additions & 2 deletions control-plane/pkg/reconciler/consumergroup/consumergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@ func (r *Reconciler) reconcileStatusSelector(cg *kafkainternals.ConsumerGroup) {
}

func (r *Reconciler) deleteConsumerGroupMetadata(ctx context.Context, cg *kafkainternals.ConsumerGroup) error {
kafakSecret, err := r.newAuthSecret(ctx, cg)
kafkaSecret, err := r.newAuthSecret(ctx, cg)
if err != nil {
return fmt.Errorf("failed to get secret for Kafka cluster auth: %w", err)
}

bootstrapServers := kafka.BootstrapServersArray(cg.Spec.Template.Spec.Configs.Configs["bootstrap.servers"])

kafkaClusterAdminClient, err := r.GetKafkaClusterAdmin(ctx, bootstrapServers, kafakSecret)
kafkaClusterAdminClient, err := r.GetKafkaClusterAdmin(ctx, bootstrapServers, kafkaSecret)
if err != nil {
return fmt.Errorf("cannot obtain Kafka cluster admin, %w", err)
}
Expand Down
Loading