Handle missing secret/secret key for custom certificates #12274
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Select the type of your PR
Description
This PR adds a logic to copy the secrets for custom broker certificates provided by users into the per broker secret generated by the operator. This secret will now contain internal TLS listener certificates generated by the operator as well as the custom broker certificate user has provided in the Kafka CR. The internal TLS certificates is stored with podname as the key for example,
my-cluster-b-abcms-0.crt. The custom broker certificates will be stored with the listener name and port as the key for example,external-9104.crt, so the listener name and port will be used to configure the listeners when brokers get restarted.This way if the custom broker certificate secret or secret key is deleted/changed and brokers got restarted for some reason, they would not go into Pending or CrashLoopBackOff as the per broker secrets would still have the copy of the secret data. However, the operator will fail the reconciliation when trying to reconcile the per broker secrets since the custom broker certificate secret/secret key to copy is missing. This would notify user to fix the issue without risking the cluster availability.
Closes #12000
Checklist
Please go through this checklist and make sure all applicable tasks have been done