mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	AWS upgrade role entries (#7025)
* upgrade aws roles * test upgrade aws roles * Initialize aws credential backend at mount time * add a TODO * create end-to-end test for builtin/credential/aws * fix bug in initializer * improve comments * add Initialize() to logical.Backend * use Initialize() in Core.enableCredentialInternal() * use InitializeRequest to call Initialize() * improve unit testing for framework.Backend * call logical.Backend.Initialize() from all of the places that it needs to be called. * implement backend.proto changes for logical.Backend.Initialize() * persist current role storage version when upgrading aws roles * format comments correctly * improve comments * use postUnseal funcs to initialize backends * simplify test suite * improve test suite * simplify logic in aws role upgrade * simplify aws credential initialization logic * simplify logic in aws role upgrade * use the core's activeContext for initialization * refactor builtin/plugin/Backend * use a goroutine to upgrade the aws roles * misc improvements and cleanup * do not run AWS role upgrade on DR Secondary * always call logical.Backend.Initialize() when loading a plugin. * improve comments * on standbys and DR secondaries we do not want to run any kind of upgrade logic * fix awsVersion struct * clarify aws version upgrade * make the upgrade logic for aws auth more explicit * aws upgrade is now called from a switch * fix fallthrough bug * simplify logic * simplify logic * rename things * introduce currentAwsVersion const to track aws version * improve comments * rearrange things once more * conglomerate things into one function * stub out aws auth initialize e2e test * improve aws auth initialize e2e test * finish aws auth initialize e2e test * tinker with aws auth initialize e2e test * tinker with aws auth initialize e2e test * tinker with aws auth initialize e2e test * fix typo in test suite * simplify logic a tad * rearrange assignment * Fix a few lifecycle related issues in #7025 (#7075) * Fix panic when plugin fails to load
This commit is contained in:
		 Mike Jarmy
					Mike Jarmy
				
			
				
					committed by
					
						 Brian Kassouf
						Brian Kassouf
					
				
			
			
				
	
			
			
			 Brian Kassouf
						Brian Kassouf
					
				
			
						parent
						
							8b9e9ea1ec
						
					
				
				
					commit
					c48159ea3a
				
			| @@ -49,6 +49,10 @@ type Backend struct { | ||||
| 	// and ease specifying callbacks for revocation, renewal, etc. | ||||
| 	Secrets []*Secret | ||||
|  | ||||
| 	// InitializeFunc is the callback, which if set, will be invoked via | ||||
| 	// Initialize() just after a plugin has been mounted. | ||||
| 	InitializeFunc InitializeFunc | ||||
|  | ||||
| 	// PeriodicFunc is the callback, which if set, will be invoked when the | ||||
| 	// periodic timer of RollbackManager ticks. This can be used by | ||||
| 	// backends to do anything it wishes to do periodically. | ||||
| @@ -108,6 +112,18 @@ type CleanupFunc func(context.Context) | ||||
| // InvalidateFunc is the callback for backend key invalidation. | ||||
| type InvalidateFunc func(context.Context, string) | ||||
|  | ||||
| // InitializeFunc is the callback, which if set, will be invoked via | ||||
| // Initialize() just after a plugin has been mounted. | ||||
| type InitializeFunc func(context.Context, *logical.InitializationRequest) error | ||||
|  | ||||
| // Initialize is the logical.Backend implementation. | ||||
| func (b *Backend) Initialize(ctx context.Context, req *logical.InitializationRequest) error { | ||||
| 	if b.InitializeFunc != nil { | ||||
| 		return b.InitializeFunc(ctx, req) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // HandleExistenceCheck is the logical.Backend implementation. | ||||
| func (b *Backend) HandleExistenceCheck(ctx context.Context, req *logical.Request) (checkFound bool, exists bool, err error) { | ||||
| 	b.once.Do(b.init) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user