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

fix: kafka controller does not panic on invalid kafka client config #3938

Merged

Conversation

Cali0707
Copy link
Member

Fixes #3935

Proposed Changes

  • Only defer closing the cluster admin if it is not nil
  • Check that the configs map exists before accessing a value in it

Release Note

The kafka controller does not panic on invalid kafka client configmaps anymore

Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow knative-prow bot added area/control-plane size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 20, 2024
@Cali0707
Copy link
Member Author

/cherry-pick release-1.14

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2024
@knative-prow-robot
Copy link
Contributor

@Cali0707: once the present PR merges, I will cherry-pick it on top of release-1.14 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow bot requested review from creydr and Leo6Leo June 20, 2024 20:07
@Cali0707
Copy link
Member Author

/cherry-pick release-1.13

@knative-prow-robot
Copy link
Contributor

@Cali0707: once the present PR merges, I will cherry-pick it on top of release-1.13 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.13

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Cali0707
Copy link
Member Author

/cc @creydr @pierDipi

@knative-prow knative-prow bot requested a review from pierDipi June 20, 2024 20:07
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.24%. Comparing base (046eb4b) to head (ffd5126).
Report is 35 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3938   +/-   ##
=======================================
  Coverage   48.24%   48.24%           
=======================================
  Files         246      246           
  Lines       14500    14502    +2     
=======================================
+ Hits         6995     6997    +2     
  Misses       6799     6799           
  Partials      706      706           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 603 to 605
if cg.Spec.Template.Spec.Configs.Configs == nil {
return fmt.Errorf("no consumer config supplied, unable to get bootstrap.servers")
}
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be better suited for Validate so that it gets rejected from the beginning ?

Comment on lines 304 to 306
if cg.Spec.Template.Spec.Configs.Configs == nil {
return fmt.Errorf("no consumer config supplied, unable to get bootstrap.servers")
}
Copy link
Member

Choose a reason for hiding this comment

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

Same for this one?

Signed-off-by: Calum Murray <cmurray@redhat.com>
@Cali0707
Copy link
Member Author

/cc @matzew

@knative-prow knative-prow bot requested a review from matzew July 12, 2024 14:13
Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2024
Copy link

knative-prow bot commented Jul 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -57,6 +57,9 @@ func (cts *ConsumerTemplateSpec) Validate(ctx context.Context) *apis.FieldError
cts.Spec.Delivery.Validate(specCtx).ViaField("delivery"),
cts.Spec.Subscriber.Validate(specCtx).ViaField("subscriber"),
)
if cts.Spec.Configs.Configs == nil {
err = err.Also(apis.ErrMissingField("spec.configs"))
Copy link
Contributor

Choose a reason for hiding this comment

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

can we test the missing config ?

@pierDipi
Copy link
Member

/test upgrade-tests

1 similar comment
@Cali0707
Copy link
Member Author

/test upgrade-tests

@Cali0707
Copy link
Member Author

/retest-required

@Cali0707
Copy link
Member Author

/test upgrade-tests

@knative-prow knative-prow bot merged commit 3d45d70 into knative-extensions:main Jul 23, 2024
37 checks passed
@knative-prow-robot
Copy link
Contributor

@Cali0707: new pull request created: #4002

In response to this:

/cherry-pick release-1.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow-robot
Copy link
Contributor

@Cali0707: #3938 failed to apply on top of branch "release-1.13":

Applying: fix: kafka controller does not panic on invalid kafka client config
Using index info to reconstruct a base tree...
M	control-plane/pkg/reconciler/consumergroup/consumergroup.go
Falling back to patching base and 3-way merge...
Auto-merging control-plane/pkg/reconciler/consumergroup/consumergroup.go
CONFLICT (content): Merge conflict in control-plane/pkg/reconciler/consumergroup/consumergroup.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix: kafka controller does not panic on invalid kafka client config
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.13

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Cali0707
Copy link
Member Author

@pierDipi is it worth backporting to 1.13 with the 1.15 release going out this week?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/control-plane lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong kafka source configuration results in SIGSEGV instead of useful error message
4 participants