in pkg/containercredentials/config.go [72:98]
func (f *FileConfig) Load(content []byte) error {
f.mu.Lock()
defer f.mu.Unlock()
if content == nil || len(content) == 0 {
klog.Info("Container credentials config file is empty, clearing cache")
f.identityConfigObject = nil
f.cache = nil
return nil
}
var configObject IdentityConfigObject
if err := json.Unmarshal(content, &configObject); err != nil {
return fmt.Errorf("error Unmarshalling container credentials config file: %v", err)
}
newCache := make(map[Identity]bool)
for _, item := range configObject.Identities {
klog.V(5).Infof("Adding SA %s/%s to container credentials config cache", item.Namespace, item.ServiceAccount)
newCache[item] = true
}
f.identityConfigObject = &configObject
f.cache = newCache
klog.Info("Successfully loaded container credentials config file")
return nil
}