Prevent cross-cluster LB hijack via duplicate do-loadbalancer-name - #917
Open
lazydiv wants to merge 1 commit into
Open
Prevent cross-cluster LB hijack via duplicate do-loadbalancer-name#917lazydiv wants to merge 1 commit into
lazydiv wants to merge 1 commit into
Conversation
When two clusters use the same do-loadbalancer-name annotation, the CCM finds and claims the existing LB by name without verifying ownership. This can destroy the original LB and permanently lose its IP when the clusters are in different regions. Add a cluster tag check to findLoadBalancerByName so that a LB is only matched when it carries the current cluster's k8s tag. If the tag is missing, the LB is skipped and the CCM falls through to create a new one, which will fail with a proper name-conflict or quota error from the API. Fixes digitalocean#916 Related digitalocean#556
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.
Summary
Fixes #916 | Related #556
When two DOKS clusters use the same
service.beta.kubernetes.io/do-loadbalancer-nameannotation,findLoadBalancerByName()matches any LB on the account with that name — regardless of which cluster owns it. The second cluster silently claims and overwrites the first cluster's LB. When the clusters are in different regions, this destroys the original LB and permanently loses its IP.Changes
clusterIDparameter tofindLoadBalancerByName()andfindLoadBalancerID()k8s:<clusterID>tagTest plan
go build ./...andgo test ./cloud-controller-manager/do/...