func (v *vulcan) NewBackend(rsc *kubernetes.Resource) (loadbalancer.Backend, error) { s := engine.HTTPBackendSettings{ Timeouts: engine.HTTPBackendTimeouts{}, KeepAlive: engine.HTTPBackendKeepAlive{}, } if val, ok := rsc.GetAnnotation(DailTimeoutKey); ok { s.Timeouts.Dial = val } if val, ok := rsc.GetAnnotation(ReadTimeoutKey); ok { s.Timeouts.Read = val } if val, ok := rsc.GetAnnotation(MaxIdleConnsKey); ok { if i, er := strconv.Atoi(val); er == nil { s.KeepAlive.MaxIdleConnsPerHost = i } } if val, ok := rsc.GetAnnotation(loadbalancer.BackendSettingsKey); ok { if er := json.Unmarshal([]byte(val), &s); er != nil { logger.Warnf("Failed to parse settings for frontend %q: %v", rsc.ID, er) } } b, er := engine.NewHTTPBackend(rsc.ID(), s) if er != nil { return nil, er } if rsc.IsWebsocket() { b.Type = ws } return newBackend(b), nil }