mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
expose 'storage_type' on the sys/seal-status endpoint (#7486)
* expose 'storage_type' on the sys/seal-status endpoint * add comments * Update vault/core.go Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>
This commit is contained in:
@@ -77,6 +77,7 @@ type SealStatusResponse struct {
|
|||||||
ClusterName string `json:"cluster_name,omitempty"`
|
ClusterName string `json:"cluster_name,omitempty"`
|
||||||
ClusterID string `json:"cluster_id,omitempty"`
|
ClusterID string `json:"cluster_id,omitempty"`
|
||||||
RecoverySeal bool `json:"recovery_seal"`
|
RecoverySeal bool `json:"recovery_seal"`
|
||||||
|
StorageType string `json:"storage_type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnsealOpts struct {
|
type UnsealOpts struct {
|
||||||
|
|||||||
@@ -664,6 +664,7 @@ func (c *ServerCommand) Run(args []string) int {
|
|||||||
coreConfig := &vault.CoreConfig{
|
coreConfig := &vault.CoreConfig{
|
||||||
Physical: backend,
|
Physical: backend,
|
||||||
RedirectAddr: config.Storage.RedirectAddr,
|
RedirectAddr: config.Storage.RedirectAddr,
|
||||||
|
StorageType: config.Storage.Type,
|
||||||
HAPhysical: nil,
|
HAPhysical: nil,
|
||||||
Seal: barrierSeal,
|
Seal: barrierSeal,
|
||||||
AuditBackends: c.AuditBackends,
|
AuditBackends: c.AuditBackends,
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ func handleSysSealStatusRaw(core *vault.Core, w http.ResponseWriter, r *http.Req
|
|||||||
Initialized: false,
|
Initialized: false,
|
||||||
Sealed: true,
|
Sealed: true,
|
||||||
RecoverySeal: core.SealAccess().RecoveryKeySupported(),
|
RecoverySeal: core.SealAccess().RecoveryKeySupported(),
|
||||||
|
StorageType: core.StorageType(),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -233,6 +234,7 @@ func handleSysSealStatusRaw(core *vault.Core, w http.ResponseWriter, r *http.Req
|
|||||||
ClusterName: clusterName,
|
ClusterName: clusterName,
|
||||||
ClusterID: clusterID,
|
ClusterID: clusterID,
|
||||||
RecoverySeal: core.SealAccess().RecoveryKeySupported(),
|
RecoverySeal: core.SealAccess().RecoveryKeySupported(),
|
||||||
|
StorageType: core.StorageType(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +251,7 @@ type SealStatusResponse struct {
|
|||||||
ClusterName string `json:"cluster_name,omitempty"`
|
ClusterName string `json:"cluster_name,omitempty"`
|
||||||
ClusterID string `json:"cluster_id,omitempty"`
|
ClusterID string `json:"cluster_id,omitempty"`
|
||||||
RecoverySeal bool `json:"recovery_seal"`
|
RecoverySeal bool `json:"recovery_seal"`
|
||||||
|
StorageType string `json:"storage_type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: because we didn't provide explicit tagging in the past we can't do it
|
// Note: because we didn't provide explicit tagging in the past we can't do it
|
||||||
|
|||||||
@@ -172,6 +172,9 @@ type Core struct {
|
|||||||
// HABackend may be available depending on the physical backend
|
// HABackend may be available depending on the physical backend
|
||||||
ha physical.HABackend
|
ha physical.HABackend
|
||||||
|
|
||||||
|
// storageType is the the storage type set in the storage configuration
|
||||||
|
storageType string
|
||||||
|
|
||||||
// redirectAddr is the address we advertise as leader if held
|
// redirectAddr is the address we advertise as leader if held
|
||||||
redirectAddr string
|
redirectAddr string
|
||||||
|
|
||||||
@@ -474,6 +477,8 @@ type CoreConfig struct {
|
|||||||
|
|
||||||
Physical physical.Backend `json:"physical" structs:"physical" mapstructure:"physical"`
|
Physical physical.Backend `json:"physical" structs:"physical" mapstructure:"physical"`
|
||||||
|
|
||||||
|
StorageType string `json:"storage_type" structs:"storage_type" mapstructure:"storage_type"`
|
||||||
|
|
||||||
// May be nil, which disables HA operations
|
// May be nil, which disables HA operations
|
||||||
HAPhysical physical.HABackend `json:"ha_physical" structs:"ha_physical" mapstructure:"ha_physical"`
|
HAPhysical physical.HABackend `json:"ha_physical" structs:"ha_physical" mapstructure:"ha_physical"`
|
||||||
|
|
||||||
@@ -546,6 +551,7 @@ func (c *CoreConfig) Clone() *CoreConfig {
|
|||||||
DisableCache: c.DisableCache,
|
DisableCache: c.DisableCache,
|
||||||
DisableMlock: c.DisableMlock,
|
DisableMlock: c.DisableMlock,
|
||||||
CacheSize: c.CacheSize,
|
CacheSize: c.CacheSize,
|
||||||
|
StorageType: c.StorageType,
|
||||||
RedirectAddr: c.RedirectAddr,
|
RedirectAddr: c.RedirectAddr,
|
||||||
ClusterAddr: c.ClusterAddr,
|
ClusterAddr: c.ClusterAddr,
|
||||||
DefaultLeaseTTL: c.DefaultLeaseTTL,
|
DefaultLeaseTTL: c.DefaultLeaseTTL,
|
||||||
@@ -613,6 +619,7 @@ func NewCore(conf *CoreConfig) (*Core, error) {
|
|||||||
devToken: conf.DevToken,
|
devToken: conf.DevToken,
|
||||||
physical: conf.Physical,
|
physical: conf.Physical,
|
||||||
underlyingPhysical: conf.Physical,
|
underlyingPhysical: conf.Physical,
|
||||||
|
storageType: conf.StorageType,
|
||||||
redirectAddr: conf.RedirectAddr,
|
redirectAddr: conf.RedirectAddr,
|
||||||
clusterAddr: new(atomic.Value),
|
clusterAddr: new(atomic.Value),
|
||||||
clusterListener: new(atomic.Value),
|
clusterListener: new(atomic.Value),
|
||||||
@@ -1820,6 +1827,11 @@ func (c *Core) SealAccess() *SealAccess {
|
|||||||
return NewSealAccess(c.seal)
|
return NewSealAccess(c.seal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StorageType returns a string equal to the storage configuration's type.
|
||||||
|
func (c *Core) StorageType() string {
|
||||||
|
return c.storageType
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Core) Logger() log.Logger {
|
func (c *Core) Logger() log.Logger {
|
||||||
return c.logger
|
return c.logger
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user