Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for shouldRotate (0.13 sec)

  1. security/pkg/credentialfetcher/plugin/gce.go

    				p.rotationTicker.Stop()
    			}
    			return
    		}
    	}
    }
    
    func (p *GCEPlugin) rotate() {
    	if p.shouldRotate(time.Now()) {
    		if _, err := p.GetPlatformCredential(); err != nil {
    			gcecredLog.Errorf("credential refresh failed: %+v", err)
    		}
    	}
    }
    
    func (p *GCEPlugin) shouldRotate(now time.Time) bool {
    	p.tokenMutex.RLock()
    	defer p.tokenMutex.RUnlock()
    
    	if p.tokenCache == "" {
    		return true
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Apr 30 13:56:46 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  2. security/pkg/credentialfetcher/plugin/gce_test.go

    			expectedRotate: true,
    		},
    	}
    
    	for id, tc := range testCases {
    		t.Run(id, func(t *testing.T) {
    			p := GCEPlugin{
    				tokenCache: tc.jwt,
    			}
    			if rotate := p.shouldRotate(tc.now); rotate != tc.expectedRotate {
    				t.Errorf("%s, shouldRotate(%s)=%t, expected %t",
    					id, tc.now.String(), rotate, tc.expectedRotate)
    			}
    		})
    	}
    }
    
    func creatJWTFile(path string) error {
    	if path == "" {
    		return nil
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Aug 03 18:09:59 UTC 2021
    - 10.1K bytes
    - Viewed (0)
Back to top