diff --git a/internal/job/vault_seal_watcher.go b/internal/job/vault_seal_watcher.go index 9d6ac3d9..4d39c838 100644 --- a/internal/job/vault_seal_watcher.go +++ b/internal/job/vault_seal_watcher.go @@ -73,13 +73,14 @@ func (v *VaultSealWatcher) Run() { switch svc { case "vault-hash-0": vc = vaultClients[0] + v.log.Debug("Vault Client",vc) case "vault-hash-1": vc = vaultClients[1] - + v.log.Debug("Vault Client",vc) case "vault-hash-2": vc = vaultClients[2] - + v.log.Debug("Vault Client",vc) default: // Handle the case where the service name doesn't match any of the instances } @@ -100,7 +101,12 @@ func (v *VaultSealWatcher) Run() { if svc == "vault-hash-0" { v.log.Info("Unsealing for first instance") - err = vc.Unseal() + _, unsealKeys, err := vc.GetVaultSecretValuesforMultiInstance() + if err != nil { + v.log.Errorf("Failed to fetch the credential: %v\n", err) + return + } + err = vc.UnsealVaultInstance(podip,unsealKeys) if err != nil { v.log.Errorf("failed to unseal vault, %s", err) diff --git a/server/server.go b/server/server.go index 685f4cec..a1c065e1 100644 --- a/server/server.go +++ b/server/server.go @@ -75,28 +75,28 @@ func initScheduler(log logging.Logger, cfg config.Configuration) (s *job.Schedul } } - if cfg.VaultPolicyWatchInterval != "" { - pj, err := job.NewVaultPolicyWatcher(log, cfg.VaultPolicyWatchInterval) - if err != nil { - log.Fatal("failed to init policy watcher job", err) - } - - err = s.AddJob("vault-policy-watcher", pj) - if err != nil { - log.Fatal("failed to add policy watcher job", err) - } - } - - if cfg.VaultCredSyncInterval != "" { - pj, err := job.NewVaultCredSync(log, cfg.VaultCredSyncInterval) - if err != nil { - log.Fatal("failed to init cred sync job", err) - } - - err = s.AddJob("vault-cred-sync", pj) - if err != nil { - log.Fatal("failed to add cred sync job", err) - } - } + // if cfg.VaultPolicyWatchInterval != "" { + // pj, err := job.NewVaultPolicyWatcher(log, cfg.VaultPolicyWatchInterval) + // if err != nil { + // log.Fatal("failed to init policy watcher job", err) + // } + + // err = s.AddJob("vault-policy-watcher", pj) + // if err != nil { + // log.Fatal("failed to add policy watcher job", err) + // } + // } + + // if cfg.VaultCredSyncInterval != "" { + // pj, err := job.NewVaultCredSync(log, cfg.VaultCredSyncInterval) + // if err != nil { + // log.Fatal("failed to init cred sync job", err) + // } + + // err = s.AddJob("vault-cred-sync", pj) + // if err != nil { + // log.Fatal("failed to add cred sync job", err) + // } + // } return }