-
Notifications
You must be signed in to change notification settings - Fork 589
[WIP] Introducing alpha API for ServiceExportPolicy #1870
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
Conversation
36670d8 to
ad885a7
Compare
This attempts to provide finer-grained control over how a services are exported across the mesh. Allows setting both mesh-wide and namespace defaults as well as overriding defaults with policies for individual services.
ad885a7 to
fc69645
Compare
|
@nmittler: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
FYI @JeremyOT |
|
My initial gut reaction is that this feels too complicated. I was imagining something a bit simpler, just controlling generation of ServiceExport resources. Basically just a service selector to indicate which services in a namespace should be exported, and control over whether they are exported or not. Then if that is in the system namespace it would set default for the cluster. The simple match-current-istio behavior would be no selector, auto_export true, placed in the mesh system namespace. |
| // | ||
| // ServiceExportPolicy supports a variety of use cases that require partitioning the mesh | ||
| // and providing customized views of service endpoints to each workload. For example, | ||
| // it may be desirable that workloads in a given cluster use only the service endpoints |
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.
Isn't this already handled quite simply in Istio? When/why would/should one use ServiceExportPolicy vs. locality LB, to restrict calls to the same cluster?
I think I agree with @smawson's comment, this seems like it might be overkill. Do we really need all the flexibility?
Also, I assume we would want to use ServiceExportPolicy to control the generating of MCS ServiceExports. If that's correct, it seems like the "to" part can't be honoured, since MCS doesn't support exporting to a subset of the workloads, or even subset of clusters.
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.
Isn't this already handled quite simply in Istio? When/why would/should one use ServiceExportPolicy vs. locality LB, to restrict calls to the same cluster?
Locality LB can only restrict calls to region, zone, subzone. It doesn't address cluster at all. The only API for cluster-local today is in mesh config, which isn't really accessible for service owners.
Also, I assume we would want to use ServiceExportPolicy to control the generating of MCS ServiceExports. If that's correct, it seems like the "to" part can't be honoured, since MCS doesn't support exporting to a subset of the workloads, or even subset of clusters.
I was more focused on thinking about what we think the Istio API should be, rather than being strictly restricted to the current set of capabilities afforded by the MCS API. If we decide we'd like more control, we could help drive additional requirements for MCS.
@smawson I don't entirely disagree. There were a few things that I was trying to fit into this, however:
The only way to do 2 AFIAK is with workload selectors on both the service endpoints and client workloads. The way I chose to do 1 was to allow |
|
@nmittler is there a RFP for this API change and how does this interact with |
|
We should discuss (2), I don't see why it requires the workload selectors on to and from. We don't have that today for cluster-local right? With MCS model cluster-local is the default and services need to be explicitly supported, so I think we're OK with just a boolean on the mesh level, namespace level and service level, with inheritance. |
|
One thing we are looking into for the service-apis implementation is how to handle service/config import/export. Its possible we would want to define a separate policy in Istio or the k8s api, which seems plausible to have significant overlap with this. I could see us defining a policy that deals with exporting to other namespaces and exporting to other clusters. This discussion is still pretty early though, but we may want to sync up on this when we understand the problem more (should be soon) |
I should have also added this as a goal:
A boolean is enough to capture cluster-local vs global, but it's not sufficient to cover exporting to selected namespaces or a subset of services. Selecting a destination host (with wildcards) gets you the ability to select the services and namespaces to export to. But then you start to run up against the question "what does export really mean"? If we limit exporting to cluster-local vs mesh-wide, allowing namespace/service selection starts to break this down quickly. I believe the general solution to all of this is exporting selected service endpoints to selected workloads. This allows us fine-grained control of service exporting across the mesh, and frees us from having to think about cluster entirely (cluster is just a label we can select on). It also has implications WRT potentially simplifying some of the service exposure-related issues with mesh federation. |
Yeah sounds very similar. Let's sync when you're at a good point. |
| // it may be desirable that workloads in a given cluster use only the service endpoints | ||
| // residing within the same cluster. | ||
| // | ||
| // By default (if no ServiceExportPolicy is specified), all services are exported to all |
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.
would prefer to remove by default... it is possible vendor may choose to have a service export policy in place as the default.
| // workloads in the mesh. This means that any workload can call any service endpoint. | ||
| // | ||
| // The mesh-wide default can be overridden by applying a ServiceExportPolicy to the | ||
| // Istio system namespace, using the service wildcard. For example, the following will |
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.
or a root namespace
| // spec: | ||
| // from: | ||
| // service: * # Using wildcard applies to all services. | ||
| // # No "to" is specified, so services will not export by default. |
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 this example is somewhat confusing. what if I remove this? Does it also mean everything is not exported?
// from:
// service: * # Using wildcard applies to all services.
Do you think it would be useful to have a config in the API to indicate it is globally auto exported vs not? like our mtls strict or none api...
| // name: auto-export-off | ||
| // namespace: example-ns | ||
| // spec: | ||
| // from: |
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 the from and to in the export service policy is very confusing. I had envisioned this to be service export policy at a cluster level. Within the cluster, we already have sidecar API where you could specify ingress and egress. How is this different?
|
Hey @nmittler - I am going to echo some of the points raised by others earlier. I would like to see a former proposal on this to introduce the problems we are trying to solve on top of what we already have (exportTo & sidecar API) and also understand how this relates to the k8s MCS API. |
| // kind: ServiceExportPolicy | ||
| // metadata: | ||
| // name: myservice-cluster1-to-cluster1-cluster2 | ||
| // namespace: example-ns | ||
| // spec: | ||
| // from: | ||
| // service: MyService | ||
| // selector: | ||
| // "topology.istio.io/cluster": cluster1 | ||
| // to: | ||
| // hosts: | ||
| // - * | ||
| // selector: | ||
| // "topology.istio.io/cluster": cluster1 |
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 seems like a strange example. Isn't this just configuring what would be the default if there was no export at all?
I don't know if I agree that supporting existing exportTo capabilities should be goal. To me this should be focused solely on controlling ServiceExport resources and nothing more. This controls whether a set of endpoints for a service are exported to the mesh-wide service or not. Otherwise if we try to bring in the exportTo stuff it will get really complicated really quickly. What if different clusters say different things about exportTo? Do those only count in that cluster? Or do they affect all consumers of that service? You're bringing in new requirements that make solving this correctly much harder, because the number of cases explodes. If we limit ourselves instead to just the question of when to create a ServiceExport and when not to, the design is much simpler and straightforward. It also gives us a nice composable piece we can build things like exportTo on top of. |
|
🚧 This issue or pull request has been closed due to not having had activity from an Istio team member since 2021-02-04. If you feel this issue or pull request deserves attention, please reopen the issue. Please see this wiki page for more information. Thank you for your contributions. Created by the issue and PR lifecycle manager. |
This attempts to provide finer-grained control over how a services are exported across the mesh.
Allows setting both mesh-wide and namespace defaults as well as overriding defaults with policies for individual services.