-
Notifications
You must be signed in to change notification settings - Fork 35
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
update the egress rules to allow loadBalancer IP on consumer side #289
base: main
Are you sure you want to change the base?
Conversation
86a7c3c
to
17147b9
Compare
if r.DeploymentType == consumerDeploymentType { | ||
|
||
storageProviderEndpointURL := r.addonParams[storageProviderEndpointKey] | ||
storageProviderEndpointHost := strings.Split(storageProviderEndpointURL, ":")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might panic if the split is yielding an empty array in the case of a malformed URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a condition to return a error if the split is yielding an empty string
if r.DeploymentType == consumerDeploymentType { | ||
|
||
storageProviderEndpointURL := r.addonParams[storageProviderEndpointKey] | ||
storageProviderEndpointHost := strings.Split(storageProviderEndpointURL, ":")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might panic if the split is yielding an empty array in the case of a malformed URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a condition to return a error if the split is yielding an empty string
controllers/managedocs_controller.go
Outdated
ip := net.ParseIP(storageProviderEndpointHost) | ||
|
||
if ip == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you wanted !=
and not ==
.
Also, let's not pollute the func scope if we don't have to.
ip := net.ParseIP(storageProviderEndpointHost) | |
if ip == nil { | |
if ip := net.ParseIP(storageProviderEndpointHost); ip == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to check if the provided storageProviderEndpointHost is a nodeIP or a hostName, we want to allow the loadBalancer Endpoint HostName, we can ignore if we have nodeIP as it is already reachable.
controllers/managedocs_controller.go
Outdated
|
||
ip := net.ParseIP(storageProviderEndpointHost) | ||
|
||
if ip == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you wanted !=
and not ==
.
Also, let's not pollute the func scope if we don't have to.
if ip == nil { | |
if ip := net.ParseIP(storageProviderEndpointHost); ip == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to check if the provided storageProviderEndpointHost is a nodeIP or a hostName, we want to allow the loadBalancer Endpoint HostName, we can ignore if we have nodeIP as it is already reachable.
Signed-off-by: Rewant Soni <[email protected]>
The consumer needs to access the loadbalancer IP, hence we need to put the rule in the allow list