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

Enhancement | Cloud Provider plugin add new function to determine whether allow to create pod when errors occurred #106

Closed
chrisliu1995 opened this issue Oct 17, 2023 · 2 comments

Comments

@chrisliu1995
Copy link
Member

Background

As #15 mentioned, OKG already supported cloud providers & plugins mechanism by Kubernetes webhook. Plus, in order to increase network availability, OKG also supports the function of network asynchronous ready, running the plugin within a limited time to repeatedly establish & confirm the network until the network is ready.

However, the function of network asynchronous ready requires that the webhook can still allow the operation of creating pod when an error occurs, which actually is conflict with synchronous plugins, like Kubernetes-HostPort plugin, because synchronous plugins require pod & network ready at same time.

Proposal

Plugin interface add a new function IsSynchronous to determine whether allow to create pod when errors occurred.

The new Plugin interface would be:

type Plugin interface {
	Name() string
	// Alias define the plugin with similar func cross multi cloud provider
	Alias() string
	Init(client client.Client, options CloudProviderOptions, ctx context.Context) error
	// Pod Event handler
	OnPodAdded(client client.Client, pod *corev1.Pod, ctx context.Context) (*corev1.Pod, errors.PluginError)
	OnPodUpdated(client client.Client, pod *corev1.Pod, ctx context.Context) (*corev1.Pod, errors.PluginError)
	OnPodDeleted(client client.Client, pod *corev1.Pod, ctx context.Context) errors.PluginError

	// IsSynchronous determines whether allow to create pod when errors occurred.
	// If set to false, the webhook allows creating pods despite errors. If set to true, the webhook denies creating pods when errors occur.
	IsSynchronous() bool
}
@ashish111333
Copy link

is this resolved ? can i work on this ?

@chrisliu1995
Copy link
Member Author

is this resolved ? can i work on this ?

Finally, this solution is not accepted. We got this solution to solve the problem(#129)

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

No branches or pull requests

2 participants