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

Automate plugin installation #420

Merged
merged 25 commits into from
Jan 29, 2024
Merged

Automate plugin installation #420

merged 25 commits into from
Jan 29, 2024

Conversation

mostafa
Copy link
Member

@mostafa mostafa commented Jan 24, 2024

Ticket(s)

Description

This PR introduces a notable enhancement for creating stateless pods in Kubernetes (k8s) by automating the plugin installation process. At present, installing plugins in GatewayD requires manual intervention, where each plugin is installed using the GatewayD CLI with a GitHub URL or a local file path of a plugin archive. This method requires executing gatewayd plugin install individually for each plugin, which is inefficient (in general and also) for Kubernetes environments. A more automated approach is needed for installing and configuring plugins in k8s. Currently, the only feasible method for plugin installation involves using a volume to store the plugins and a script to execute the plugin installation commands. This approach ensures that restarting a pod does not erase the plugin configurations and binaries.

To address these challenges, this PR automates the plugin installation process by introducing a url parameter in the gatewayd_plugins.yaml configuration file. Consequently, executing gatewayd plugin install without specifying CLI arguments (such as a GitHub URL or file path) will trigger the following automated steps:

  1. Parse the gatewayd_plugins.yaml file to extract all the plugin URLs.
  2. Download and unpack the plugin archives from the specified URLs.
  3. Install the plugins, with the installation details reflected in the updated gatewayd_plugins.yaml file.

It also adds support for the --overwrite-config flag that can be used to disable overwriting the plugins config file after the plugins are installed.

Note

Since the automated plugin installation relies on the gatewayd_plugins.yaml file to be up to date with all the configuration, local paths and checksums for the latest plugins, and overwriting the plugins config file might be disabled by the user (for example, since they use configmaps), one should make sure to use the correct local paths and checksums.

Related PRs

N/A

Development Checklist

  • I have added a descriptive title to this PR.
  • I have squashed related commits together.
  • I have rebased my branch on top of the latest main branch.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added docstring(s) to my code.
  • I have made corresponding changes to the documentation (docs).
  • I have added tests for my changes.
  • I have signed all the commits.

Legal Checklist

@mostafa mostafa linked an issue Jan 24, 2024 that may be closed by this pull request
3 tasks
@mostafa mostafa force-pushed the 402-automate-plugin-installation branch from 90d0824 to aeb6d85 Compare January 24, 2024 22:13
@mostafa mostafa force-pushed the 402-automate-plugin-installation branch from f214f14 to 42d6a9a Compare January 27, 2024 19:09
@gatewayd-io gatewayd-io deleted a comment from github-actions bot Jan 27, 2024
@mostafa mostafa force-pushed the 402-automate-plugin-installation branch from 4571bae to 3e06f08 Compare January 28, 2024 23:55
@mostafa mostafa force-pushed the 402-automate-plugin-installation branch from dd13e7a to 842f360 Compare January 29, 2024 00:09
Comment on lines +62 to +63
env:
GITHUB_AUTH_TOKEN: ${{ secrets.INTEGRATION }}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to increase the rate limit of the GitHub API, so that consecutive CI runs don't hit the limit.

@@ -24,3 +20,18 @@ func executeCommandC(root *cobra.Command, args ...string) (string, error) {

return buf.String(), err
}

// mustPullPlugin pulls the gatewayd-plugin-cache plugin and returns the path to the archive.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to prevent GitHub API rate limit to be reached by pulling the plugin once and reusing it (almost) everywhere.

@mostafa mostafa marked this pull request as ready for review January 29, 2024 13:50
@mostafa mostafa mentioned this pull request Jan 29, 2024
@mostafa mostafa merged commit 978d5d2 into main Jan 29, 2024
4 checks passed
@mostafa mostafa deleted the 402-automate-plugin-installation branch January 29, 2024 19:37
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.

Automate plugin installation
2 participants