You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/explanation/traffic-authorization.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,10 @@ class DetailsK8sCharm(CharmBase):
59
59
60
60
This means that, when related to a Beacon charm via the `service_mesh` relation, `bookinfo-details-k8s` will request traffic authorization for every application related to its `details` integration. Specifically, it will request that those related applications can `GET` the `/health` and `/details/*` endpoints on a given port. It is then the responsibility of the related beacon charm to create the policies necessary for this communication in the given service mesh.
61
61
62
+
```{note}
63
+
By default peer units of the charm are not allowed to access each other. This behavior can be changed if required. Check this [How-to](../how-to/add-mesh-support-to-your-charm.md) guide for more details.
64
+
```
65
+
62
66
## Authorization Management in Charmed Istio
63
67
64
68
Istio's [Authorization](https://istio.io/latest/docs/concepts/security/#authorization) model centers around the [`AuthorizationPolicy`](https://istio.io/latest/docs/reference/config/security/authorization-policy/). This object is how service-to-service communication is opened in an Istio service mesh. The [istio-beacon-k8s](https://charmhub.io/istio-beacon-k8s) charm manages `AuthorizationPolicies` for Charmed Istio. It automatically creates policies for charms related to it via the [`service_mesh`](https://charmhub.io/istio-beacon-k8s/integrations) interface.
Copy file name to clipboardExpand all lines: docs/how-to/add-mesh-support-to-your-charm.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,40 @@ class MyCharm(CharmBase):
91
91
92
92
Exactly what should be defined for your `Endpoint`s depends on the application you've charmed. Generally, you can look at your applications API reference or typical usage and include exactly what is needed, exposing only the necessary attack surface.
93
93
94
+
When a charm that is on the mesh is scaled to have more than one unit, by default all the units of the charm are not allowed to communicate with each other. To allow communication between the peers, you must explicitly add another `UnitPolicy` for the peers relation endpoint allowing access to the required ports.
95
+
96
+
For example:
97
+
98
+
```python
99
+
classMyCharm(CharmBase):
100
+
def__init__(self, *args):
101
+
super().__init__(*args)
102
+
self._mesh = ServiceMeshConsumer(
103
+
self,
104
+
policies=[
105
+
AppPolicy(
106
+
relation="database", # On the database relation
107
+
endpoints=[ # allow a related application to access...
108
+
Endpoint(
109
+
paths=["/db"], # these specific paths
110
+
ports=[DB_PORT], # on these specific ports
111
+
methods=[Method.get, Method.Post], # using only these methods
112
+
),
113
+
],
114
+
),
115
+
UnitPolicy(
116
+
relation="metrics-endpoint", # On the metrics-endpoint relations
117
+
ports=[HTTP_PORT], # allow a related application to access this charm's individual units on these specific ports
118
+
),
119
+
UnitPolicy(
120
+
relation="charm-peers", # On the peers relation. FYI: use the name of the peers endpoint used in your charm.
121
+
ports=[HTTP_PORT], # allow the peer units to access each other on the HTTP_PORT
122
+
)
123
+
],
124
+
)
125
+
```
126
+
127
+
94
128
## Cross-model Integrations (Optional)
95
129
96
130
If your Charm provides integrations that can be used cross-model, the `ServiceMeshConsumer` library offers the additional `provide-cmr-mesh` and `require-cmr-mesh` integrations to ensure these generate policies properly. These additional integrations are required because Juju cross-model relations do not natively provide all the information needed for a service mesh authorization policy to be generated.
0 commit comments