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

charm: open port NATS is listening on #15

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

morphis
Copy link
Collaborator

@morphis morphis commented Oct 23, 2020

The operator framework currently doesn't not support opening or closing
ports the charm exposes. Due to this we have to manually invoke the
open-port and close-port hook tools. The implementation also keeps track
of changing ports.

@morphis morphis force-pushed the open-close-ports branch 4 times, most recently from abfcbc0 to 0312523 Compare October 26, 2020 13:03
src/charm.py Outdated
self.client.expose_nats(auth_token=self.state.auth_token)

port = '{}/tcp'.format(self.model.config['client-port'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this risk an Exception if client-port is unset in the configuration ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be always set, shouldn't it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% sure how the operator framework handles this, but what would be the behavior if we run juju config nats client-port= ? Also we should probably check that the port is a valid one before trying to open some nonsense port like None/tcp or the likes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A juju config client-port= should still not remove the config key from the map. Checking for an empty string or a none value is indeed something we should do.

The operator framework currently doesn't not support opening or closing
ports the charm exposes. Due to this we have to manually invoke the
open-port and close-port hook tools. The implementation also keeps track
of changing ports.
Copy link
Contributor

@aguadoenzo aguadoenzo left a comment

Choose a reason for hiding this comment

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

LTGM

@morphis morphis merged commit 121bf2c into canonical:master Oct 26, 2020
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.

2 participants