Skip to content

Commit

Permalink
docs: reduce the amount of detail in the open/close port methods (can…
Browse files Browse the repository at this point in the history
…onical#1006)

Reduce the amount of detail in the open/close port methods, linking to the Juju docs for more.
  • Loading branch information
tonyandrewmeyer authored Sep 21, 2023
1 parent 1517bde commit 7f71d6e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,11 @@ def open_port(self, protocol: typing.Literal['tcp', 'udp', 'icmp'],
port: Optional[int] = None):
"""Open a port with the given protocol for this unit.
Calling this registers intent with Juju that the application should be
accessed on the given port, but the port isn't actually opened
externally until the admin runs "juju expose".
On Kubernetes sidecar charms, the ports opened are not strictly
per-unit: Juju will open the union of ports from all units.
However, normally charms should make the same open_port() call from
every unit.
Some behaviour, such as whether the port is opened externally without
using "juju expose" and whether the opened ports are per-unit, differs
between Kubernetes and machine charms. See the
`Juju documentation <https://juju.is/docs/sdk/hook-tool#heading--open-port>`__
for more detail.
Args:
protocol: String representing the protocol; must be one of
Expand All @@ -619,10 +616,11 @@ def close_port(self, protocol: typing.Literal['tcp', 'udp', 'icmp'],
port: Optional[int] = None):
"""Close a port with the given protocol for this unit.
On Kubernetes sidecar charms, Juju will only close the port once the
last unit that opened that port has closed it. However, this is
usually not an issue; normally charms should make the same
close_port() call from every unit.
Some behaviour, such as whether the port is closed externally without
using "juju unexpose", differs between Kubernetes and machine charms.
See the
`Juju documentation <https://juju.is/docs/sdk/hook-tool#heading--close-port>`__
for more detail.
Args:
protocol: String representing the protocol; must be one of
Expand Down

0 comments on commit 7f71d6e

Please sign in to comment.