Skip to content

Commit 7a077b0

Browse files
committed
check for updates every 12 hours
1 parent 5497f43 commit 7a077b0

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

server.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"log"
2222
"net/http"
2323
"os"
24+
"time"
2425

2526
"github.com/blang/semver/v4"
2627
admissionv1 "k8s.io/api/admission/v1"
@@ -347,12 +348,21 @@ func updateCheck() error {
347348
return nil
348349
}
349350

350-
func main() {
351-
log.Print("GCP Auth Webhook started!")
352-
351+
func updateTicker() {
353352
if err := updateCheck(); err != nil {
354353
log.Println(err)
355354
}
355+
for range time.Tick(12 * time.Hour) {
356+
if err := updateCheck(); err != nil {
357+
log.Println(err)
358+
}
359+
}
360+
}
361+
362+
func main() {
363+
log.Print("GCP Auth Webhook started!")
364+
365+
go updateTicker()
356366

357367
mux := http.NewServeMux()
358368

0 commit comments

Comments
 (0)