-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
CLI Peering Export Command #14547
Comments
Hi @DanStough, Thanks for writing this up! I have a few follow-up questions.
|
Good questions!
Yes, there should only be one, so we would have to go the check-and-set route as you mentioned. My though would be as we modify existing entries this command is append-only, preferring to leave finer-grained operations for
I think we would either need to have a general
Since this is just writing a config entry, I think this can be implemented in the CLI in OSS and the necessary validation will happen server-side.
No strong opinion! I like to type less, but we can see if we get any community feedback. |
Discussed with Jared outside the PR. We're good to go and starting work on this next week 🛠️ |
@nathancoleman , @20sr20 : something else I just thought of as a possible extension of this task. As I tried writing it out, I realized this was probably a much thornier suggestion than it seemed on the surface, and maybe not worth it at all (much less in the first pass). Let me know what you think. (CC: @DanStough ) Ideally, we'd help users understand that exporting a service isn't sufficient to allow access, intentions are also needed*. Communication from the importing peer to the exported service won't work if there are no intentions allowing traffic from the exported service to anything on the importing side. If there are no intentions* allowing anything on the importing side to actually access the exported services, it might be nice to give the user a heads up. (We'd also need to inform the user if the ACL token in use lacks the permissions to check the intentions.) That said, I'm not sure what to do if someone exports all services using the wildcard (*)... Would we then check for a wildcard intention? *Note that intentions are effectively bypassed unless one of the following is true:
|
If I'm understanding correctly, ...
Services: [
{
Name: "myService"
Namespace: "myNamespace",
Consumers: [
...
]
}
] however, Consul server does not actually return an error when you write a config entry like that from OSS. Am I missing anything @DanStough , or does this indicate that the namespace code does need to live in the enterprise code after all since the server wouldn't return a validation error like we were expecting? |
@nathancoleman : Out of curiosity, what happens if you just add arbitrary key/values to the objects in the My understanding matches yours: that I think the implementation of the |
@nathancoleman I think we're a little inconsistent with where some of the enterprise code lives for CLI commands.
I like the pattern of including everything in OSS CLI commands because it allows some interoperability between the Consul binary as a client (the thing installed on an operator's workstation) and many versions of Consul that they may be managing. IMHO I would say we treat this as case 1., which would be the same thing as if the operator had incorrectly added the field to the file and tried to write the config entry. I think the optimization is that we should be validating this server-side to provide feedback in both cases. As part of this task or a future one, we could add validations to the Config entry struct for |
@DanStough I'm in favor of the approach you described. Since we're using this is a learning/pairing opportunity, I think it would be best to split the server validation of the config entry out into a separate task. |
Update: After much discussion, the team has landed on the following format: $ consul services export -name=my-service -consumer-peers=peer1,peer2 -consumer-partitions=part1 Notably, Consul Enterprise will include support for the standard |
Feature Description
Create a CLI command,
consul peering export
that automates the process of creating config entries to export services from a cluster to a peer. It will create aexported-services
object between the requested service and the peer names in the command.The initial design could be something like the following:
Validation should include checking for the existence of the service and peerings.
Good references for this work include the other peering CLI commands and the
consul connect expose
command, which has a similar flow of modifying config entries.Use Case
A hypothetical example is a service
web
in the current cluster that we would like to export to a peering namedother-cluster
. The peering connection already exists. The following command should allow traffic to route from that cluster by creating the necessaryexported-services
:consul peering export -service=web -peers=other-cluster
The text was updated successfully, but these errors were encountered: