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

[FEATURE] Plugin System #714

Conversation

FedericoAntoniazzi
Copy link

@FedericoAntoniazzi FedericoAntoniazzi commented Aug 18, 2021

What

Implement a plugin system into k3d.

Why

Resolve #304

Implications

Introduces new commands:

  • k3d plugin install PLUGIN to install a plugin
  • k3d plugin list to list installed plugins
  • k3d plugin remove PLUGIN to remove an installed plugin

Plugins will be taken from GitHub Releases and need the files names have to be like pluginname-os-arch because k3d will look for a compatible (same OS and arch of the system which k3d is running on) executable file and download it.

Roadmap

  • Plugin management
    • Install a plugin
    • Install multiple plugins
    • Install multiple plugins from stdin
    • List installed plugins
    • Remove one or more plugins
  • Review callables plugins (reference: [Feature] Basic Plugin System - SubGoal: callables #333)
  • Implement lifecycle hooks for plugins (es, run plugin before cluster creation, deletion...)

Future improvements

  • Install plugins from a file

I'm going to work on this PR in my free time. In the meantime I would like to have feedbacks about code and maybe new ideas.

@FedericoAntoniazzi FedericoAntoniazzi changed the title Feature/plugin architecture [FEAT] Plugins Aug 18, 2021
@iwilltry42 iwilltry42 added this to the v5.1.0 milestone Aug 18, 2021
@iwilltry42
Copy link
Member

Hi @FedericoAntoniazzi , thanks for your work on this! Looking forward to getting this into k3d :)
Since it's going to be released in k3d v5.x, please base it off of the main-v5 branch. I will already update the target branch of this PR 👍
Also note, that we just today switched from using (global) logrus directly to a k3d built-in logger: #699

@iwilltry42 iwilltry42 changed the base branch from main to main-v5 August 18, 2021 16:07
@iwilltry42 iwilltry42 changed the title [FEAT] Plugins [FEATURE] Plugin System Aug 18, 2021
@FedericoAntoniazzi
Copy link
Author

Thank you, I'm going to fix the logger soon

Creates 'k3d plugin' command and 2 subcommands:
- `k3d plugin install`: Install a plugin
- `k3d plugin remove`: Remove an installed plugin

Both subcommands have yet to be implemented.
- Use `k3d plugin install owner/repo@tag` to install the `tag` release of
the owner/repo github repository. `tag` could be omitted and latest will be used
- The download location is $HOME/.k3d/plugins.
- The release must contain executable files in the format
  pluginname-os-arch because k3d will look for compatible executable and
  download it
Introduce a struct representing a plugin entity and improve semantics
Enable the possibility to use `k3d plugin install < plugins.txt` in
which plugins.txt is a list of plugins like:
owner1/repo1
owner1/repo2@v1.2.3

Thanks also to @pspgt
@FedericoAntoniazzi
Copy link
Author

I decided to take a step back and analyze the problem all together first. This PR has been closed because a new one will be opened really soon, we can use the code implemented here as know-how for the new PR.

In the meantime I created a discussion for collecting ideas about plugin management: #741 . Contributions are highly appreciated 😃

@FedericoAntoniazzi FedericoAntoniazzi deleted the feature/plugin-architecture branch March 17, 2022 21:28
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.

[FEATURE] Plugin Architecture
2 participants