New root namespace plugin reload API sys/plugins/reload/:type/:name (#24878)

This commit is contained in:
Tom Proctor
2024-01-17 15:46:27 +00:00
committed by GitHub
parent cadef7b2cd
commit 80f85a05f6
21 changed files with 875 additions and 177 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/hashicorp/go-memdb"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/consts"
"github.com/hashicorp/vault/sdk/logical"
)
@@ -263,7 +264,7 @@ var (
return paths
}
handleGlobalPluginReload = func(context.Context, *Core, string, string, []string) error {
handleGlobalPluginReload = func(context.Context, *Core, pluginReloadRequest) error {
return nil
}
handleSetupPluginReload = func(*Core) error {
@@ -277,6 +278,16 @@ var (
checkRaw = func(b *SystemBackend, path string) error { return nil }
)
// Contains the config for a global plugin reload
type pluginReloadRequest struct {
Type string `json:"type"` // Either 'plugins' or 'mounts'
PluginType consts.PluginType `json:"plugin_type"`
Subjects []string `json:"subjects"` // The plugin names or mount points for the reload
ReloadID string `json:"reload_id"` // a UUID for the request
Timestamp time.Time `json:"timestamp"`
Namespace *namespace.Namespace
}
// tuneMount is used to set config on a mount point
func (b *SystemBackend) tuneMountTTLs(ctx context.Context, path string, me *MountEntry, newDefault, newMax time.Duration) error {
zero := time.Duration(0)