Skip to content
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

Refine Debug Log #280

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sinks/eventbridge/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,19 @@ func (ebSink *eventBridgeSink) isAkValid() bool {

t, err := time.Parse(utils.StsTokenTimeLayout, ebSink.akInfo.Expiration)
if err != nil {
klog.Errorf("failed to parse time layout, %v", err)
klog.Errorf("failed to parse time layout, akInfo: %v, err: %v", ebSink.akInfo, err)
return false
}
nowT := time.Now()

if t.Before(nowT) {
klog.Error("invalid token which is expired")
klog.Errorf("invalid token which is expired. now: %v, expirationTime: %v", nowT, t)
return false
}

t = t.Add(-time.Minute * time.Duration(10))
if t.Before(nowT) {
klog.Error("valid token which will be expired in ten minutes, should refresh it")
klog.Errorf("valid token which will be expired in ten minutes, should refresh it. now: %v, expirationTime: %v", nowT, t)
return false
}

Expand Down
2 changes: 2 additions & 0 deletions sinks/utils/aliyun_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ func ParseAKInfoFromConfigPath() (*AKInfo, error) {
if err != nil {
klog.Fatalf("error unmarshal token config: %v", err)
}
klog.V(8).Infof("parse ak info from config path: %v, akInfo: %v", ConfigPath, akInfo)

keyring := akInfo.Keyring
ak, err := Decrypt(akInfo.AccessKeyId, []byte(keyring))
if err != nil {
Expand Down