Repository navigation
fix: prevent nil pointer panic when spec.clusterConfig is omitted - #107
Merged
Merged
Conversation
spec.clusterConfig is optional in the CRD, but the FE ConfigMap reconciler dereferenced it unconditionally for the authentication spec, crashing the reconcile loop for any minimal DorisCluster CR. Guard the dereference in NewFEConfigMapReconciler and the latent one in generateVectorYAML, and add a regression test building the FE ConfigMap from a CR without clusterConfig. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
spec.clusterConfigis optional in the DorisCluster CRD, butNewFEConfigMapReconcilerdereferencesdorisCluster.Spec.ClusterConfig.Authenticationunconditionally (internal/controller/fe/configmap.go). Any minimal CR that defines only frontend/backend/broker crashes the operator with a nil pointer dereference on every reconcile, putting it in a crash loop. Reproduced live in a kind cluster (stack:fe.NewFEConfigMapReconciler→fe/role.go→common/role.go).Fix
ClusterConfigdereference inNewFEConfigMapReconciler: whenclusterConfigis nil the authentication spec stays empty and LDAP is treated as disabled, whichIsLDAPAuthalready handles.generateVectorYAML(internal/controller/common/vector.go).Spec.ClusterConfigdereferences underinternal/controller—doriscluster_controller.go,scale/replicas.go, andcommon/configmap.goalready nil-check, and the BE/broker ConfigMap builders only access it through the nil-safeGetVectorConfigMapName.Verification
internal/controller/fe/configmap_test.go) that builds the FE ConfigMap from a DorisCluster withoutclusterConfig(and withclusterConfigbut no authentication). It panics on the unfixed code and passes with the fix.make lint(0 issues) andmake test(full unit suite) pass.🤖 Generated with Claude Code