Skip to content

Commit

Permalink
Merge pull request #11 from gkarthiks/fix
Browse files Browse the repository at this point in the history
fix: print the logs
  • Loading branch information
gkarthiks authored Jul 28, 2020
2 parents 718c906 + 53d4771 commit fc59118
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions helper/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,32 @@ func populateIpAddresses(podsList *v1.PodList, vaultPool *types.VaultPool) {
for _, pod := range podsList.Items {
currentPodNames[pod.Name] = struct{}{}
if pod.Status.Phase == v1.PodRunning {
log.Printf("TODO: Pod %v is running\n", pod.Name)
log.Printf("TODO: adding the current pod(%v) and ip(%v)\n", pod.Name, pod.Status.PodIP)
// adding the currently discovered pod ips
//globals.VaultIPList[pod.Name] = pod.Status.PodIP
if _, ok := globals.VaultIPList[pod.Name]; ok {
log.Printf("TODO: inside if _, ok := globals.VaultIPList[pod.Name]; ok { with the value ` %v ` \n", globals.VaultIPList[pod.Name])
log.Infof("%v already added and configured", pod.Name)
} else {
log.Printf("TODO: inside if _, ok := globals.VaultIPList[pod.Name]; ok { with the value ` %v ` \n", globals.VaultIPList[pod.Name])
log.Infof("%v adding and configuring", pod.Name)
globals.VaultIPList[pod.Name] = pod.Status.PodIP
log.Printf("TODO: now the value of the vaultiplist is %v \n", reflect.ValueOf(globals.VaultIPList).MapKeys())
}
}
}

log.Printf("Vault IP List data at the end of populate %v", reflect.ValueOf(globals.VaultIPList).MapKeys() )
log.Printf("TODO: now Vault IP List data at the end of populate %v \n", reflect.ValueOf(globals.VaultIPList).MapKeys())

for historyPodName, ipAddress := range globals.VaultIPList {
log.Printf("TODO: inside the reconciliation loop with historyPodName: %v, ipAddress: %v \n",historyPodName, ipAddress)
if _, ok := currentPodNames[historyPodName]; !ok {
log.Printf("TODO: inside the if _, ok := currentPodNames[historyPodName]; with ok value= %v and currentPodNames[historyPodName]= %v \n",ok, currentPodNames[historyPodName] )
// removing the obsolete pod and its details
log.Printf("TODO: removing the obsolete pod and its details")
delete(globals.VaultIPList, historyPodName)
log.Printf("TODO: RetireBackend %v", ipAddress)
vaultPool.RetireBackend(ipAddress)
log.Printf("TODO: after RetireBackend vaultpool", reflect.ValueOf(vaultPool).MapKeys())
}
}
}

0 comments on commit fc59118

Please sign in to comment.