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

[DPE-5587] Fix private IP resolution to use juju spaces #122

Merged
merged 23 commits into from
Oct 14, 2024

Conversation

phvalguima
Copy link
Contributor

@phvalguima phvalguima commented Oct 2, 2024

Up to this point OSD was taking the local IP (using the Python socket library) for the application endpoint.

However we need to use the IP published by Juju instead (Model.get_binding()) -- as this is the one that can be contacted externally.

The change has a impact on TLS certificates as well (as we are adjusting the IPs appearing in the certificate request accordingly).

Closes #121

@phvalguima phvalguima changed the title [DPE-5587] Add extra-binding and private IP from juju spaces [DPE-5587] Fix private IP resolution to use juju spaces Oct 2, 2024
@phvalguima
Copy link
Contributor Author

The result of this PR:

Running the socket logic as we are doing currently on the charm indeed returns the wrong 127.0.1.1:

root@juju-865fea-0:/var/lib/juju/agents/unit-opensearch-dashboards-0/charm# python3 
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux                  
Type "help", "copyright", "credits" or "license" for more information.              
>>> import socket                                                                   
>>> socket.gethostbyname(socket.gethostname())                                      
'127.0.1.1'                                                                         
>>>                                                                                 

@phvalguima phvalguima marked this pull request as ready for review October 3, 2024 13:25
Copy link
Contributor

@Mehdi-Bendriss Mehdi-Bendriss left a comment

Choose a reason for hiding this comment

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

Thanks pedro, I have some questions.

src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/literals.py Outdated Show resolved Hide resolved
skourta
skourta previously approved these changes Oct 7, 2024
Copy link
Contributor

@skourta skourta left a comment

Choose a reason for hiding this comment

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

LGTM. Left some minor questions.

src/core/models.py Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
tests/integration/spaces/conftest.py Outdated Show resolved Hide resolved
tests/integration/helpers.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
src/core/cluster.py Outdated Show resolved Hide resolved
src/core/models.py Outdated Show resolved Hide resolved
@juditnovak juditnovak force-pushed the DPE-5587-avoid-socket-gethostname branch 6 times, most recently from 1597e0a to 7af06f5 Compare October 9, 2024 11:15
@juditnovak juditnovak force-pushed the DPE-5587-avoid-socket-gethostname branch from 7af06f5 to 8910a3d Compare October 9, 2024 13:29
@Mehdi-Bendriss Mehdi-Bendriss merged commit 017d5c5 into 2/edge Oct 14, 2024
14 checks passed
@Mehdi-Bendriss Mehdi-Bendriss deleted the DPE-5587-avoid-socket-gethostname branch October 14, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It always listens on 127.0.... and not on the node's IP when deploying to an external.
4 participants