This repository has been archived on 2023-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
dex/storage/kubernetes/garbage_collection.go

30 lines
628 B
Go
Raw Normal View History

2016-07-25 20:00:28 +00:00
package kubernetes
import (
"fmt"
"log"
)
// TODO(ericchiang): Complete this.
type multiErr []error
func (m multiErr) Error() string {
return fmt.Sprintf("errors encountered: %s", m)
}
func (cli *client) gcAuthRequests() error {
var authRequests AuthRequestList
if err := cli.list(resourceAuthRequest, &authRequests); err != nil {
return err
}
for _, authRequest := range authRequests.AuthRequests {
if cli.now().After(authRequest.Expiry) {
if err := cli.delete(resourceAuthRequest, authRequest.ObjectMeta.Name); err != nil {
log.Printf("failed to detele auth request: %v", err)
}
}
}
return nil
}