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

RFC: selector plugin #17

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

RFC: selector plugin #17

wants to merge 2 commits into from

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Jul 6, 2021

Signed-off-by: YangKeao keao.yang@yahoo.com

Signed-off-by: YangKeao <keao.yang@yahoo.com>

type Selector interface {
Validate(selector RawSelector) field.ErrorList
Default(root map[string]interface{}, selector RawSelector) RawSelector
Copy link
Member

Choose a reason for hiding this comment

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

What is root map[string]interface{}?

Copy link
Member Author

Choose a reason for hiding this comment

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

The root is the whole object. For example, setting default value for the pid selector namespaces need the namespace of root🤦‍♂️


1. Call related selectors to list all selected resources.
2. Call scope limitation to randomly choose some of them.
3. Iterate through the selected resources and call the implementation.
Copy link
Member

Choose a reason for hiding this comment

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

  1. Iterate through the selected resources and call the implementation.

Maybe we could do that in parallel.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes!


Besides the network communication, chaos-mesh should also provide a way to
communicate through local unix socket, to avoid uneccessary network overhead.
For example, the plugin can be registered with a path:
Copy link
Member

Choose a reason for hiding this comment

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

What does this for? I think it is impossible for an external plugin to using unix domain socket: I imagine that the external plugin runs as one pod that you do not know which node will be scheduled on, if the pod of "external plugin" and the pod "controller-manager" run on different node, there is no way to use unix domain socket.

Copy link
Member Author

@YangKeao YangKeao Jul 7, 2021

Choose a reason for hiding this comment

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

Yes. I plan to setup some "official plugin" like pod selector to use unix socket. They use the same SDK with others (but run in the same binary or container or pod with the controller).

The users can also add extra container and volume for the controller to deploy the selector plugin, for performance.

Signed-off-by: YangKeao <keao.yang@yahoo.com>
...
```

And then, the controller could establish a `grpc` connection to the service and
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the service used for?

Copy link
Contributor

Choose a reason for hiding this comment

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

Implement service for every selector type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The users should setup a service for it. Just like the webhook in Kubernetes. We need to setup a service for controller-manager, and create a WebhookConfiguration points to the service.

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.

3 participants