feat(gcp): add GCP plugin (#5229)
Add GCP as a supported plugin for dynamic host catalogs
This commit is contained in:
1 parent
f227020b67
commit
514bcc19f6
8 files changed
+428
-4
No files matched your search
@@ -320,6 +320,8 @@ func New(ctx context.Context, conf *Config) (*Controller, error) {
|
||||
if _, err := conf.RegisterPlugin(ctx, pluginType, client, []plugin.PluginType{plugin.PluginTypeHost}, plugin.WithDescription(fmt.Sprintf("Built-in %s host plugin", enabledPlugin.String()))); err != nil {
|
||||
return nil, fmt.Errorf("error registering %s host plugin: %w", pluginType, err)
|
||||
}
|
||||
case enabledPlugin == base.EnabledPluginGCP && !c.conf.SkipPlugins:
|
||||
fallthrough
|
||||
case enabledPlugin == base.EnabledPluginAws && !c.conf.SkipPlugins:
|
||||
pluginType := strings.ToLower(enabledPlugin.String())
|
||||
client, cleanup, err := external_plugins.CreateHostPlugin(
|
||||
|
||||
@@ -257,6 +257,7 @@ func TestController_NewPluginsConfig(t *testing.T) {
|
||||
conf.EnabledPlugins = []base.EnabledPlugin{
|
||||
base.EnabledPluginAws,
|
||||
base.EnabledPluginHostAzure,
|
||||
base.EnabledPluginGCP,
|
||||
}
|
||||
|
||||
_, err = New(testCtx, conf)
|
||||
@@ -265,14 +266,15 @@ func TestController_NewPluginsConfig(t *testing.T) {
|
||||
// Check that both plugins were written to the temp dir
|
||||
files, err := os.ReadDir(tmpDir)
|
||||
require.NoError(err)
|
||||
require.Len(files, 2)
|
||||
require.Len(files, 3)
|
||||
for _, file := range files {
|
||||
name := filepath.Base(file.Name())
|
||||
// Remove random chars and hyphen
|
||||
name = name[0 : len(name)-6]
|
||||
switch name {
|
||||
case boundary_plugin_assets.PluginPrefix + "aws",
|
||||
boundary_plugin_assets.PluginPrefix + "azure":
|
||||
boundary_plugin_assets.PluginPrefix + "azure",
|
||||
boundary_plugin_assets.PluginPrefix + "gcp":
|
||||
default:
|
||||
require.Fail("unexpected name", name)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user