-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh all pull image secrets every hour #110
Refresh all pull image secrets every hour #110
Conversation
4bd7204
to
29f7d44
Compare
} | ||
|
||
// refreshAllPullSecrets deletes and recreates image registry pull secrets for all namespaces | ||
func refreshAllPullSecrets() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets generate tokens for 12 hours in first place so dont have to refresh it that often
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but when I try to change the expiry it still gives the same value
package main
import (
"context"
"fmt"
"log"
"time"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
)
func main() {
creds, err := google.FindDefaultCredentials(context.Background())
if err != nil {
log.Fatal(err)
}
token, err := creds.TokenSource.Token()
if err != nil {
log.Fatal(err)
}
fmt.Println(token.Expiry)
dur, err := time.ParseDuration("30s")
if err != nil {
log.Fatal(err)
}
ts := oauth2.ReuseTokenSourceWithExpiry(token, creds.TokenSource, dur)
token, err = ts.Token()
if err != nil {
log.Fatal(err)
}
fmt.Println(token.Expiry)
}
Fixes #105
Running a ticker that runs every hour that deletes the image pull secret in all namespaces and recreates them