diff --git a/src/chartserver/cache.go b/src/chartserver/cache.go index d6cbe34d5..5794e866b 100644 --- a/src/chartserver/cache.go +++ b/src/chartserver/cache.go @@ -59,11 +59,11 @@ func NewChartCache(config *ChartCacheConfig) *ChartCache { return chartCache } - if config.DriverType != cacheDriverMem && config.DriverType != cacheDriverRedis { + if config.DriverType != cacheDriverMem && config.DriverType != cacheDriverRedis && config.DriverType != cacheDriverRedisSentinel { return chartCache } - if config.DriverType == cacheDriverRedis { + if config.DriverType == cacheDriverRedis || config.DriverType == cacheDriverRedisSentinel { if len(config.Config) == 0 { return chartCache } @@ -107,7 +107,7 @@ func (chc *ChartCache) PutChart(chart *ChartVersionDetails) { case cacheDriverMem: // Directly put object in err = chc.cache.Put(chart.Metadata.Digest, chart, standardExpireTime) - case cacheDriverRedis: + case cacheDriverRedis, cacheDriverRedisSentinel: // Marshal to json data before saving var jsonData []byte if jsonData, err = json.Marshal(chart); err == nil { @@ -193,7 +193,7 @@ func initCacheDriver(cacheConfig *ChartCacheConfig) beego_cache.Cache { redisCache, err := beego_cache.NewCache(cacheDriverRedisSentinel, cacheConfig.Config) if err != nil { // Just logged - hlog.Errorf("Failed to initialize redis cache: %s", err) + hlog.Errorf("Failed to initialize redis sentinel cache: %s", err) if count < maxTry { <-time.After(time.Duration(backoff(count)) * time.Second) @@ -203,7 +203,7 @@ func initCacheDriver(cacheConfig *ChartCacheConfig) beego_cache.Cache { return nil } - hlog.Info("Enable redis cache for chart caching") + hlog.Info("Enable redis sentinel cache for chart caching") return redisCache } default: diff --git a/src/chartserver/handler_utility.go b/src/chartserver/handler_utility.go index 5937ad3d2..bea908836 100644 --- a/src/chartserver/handler_utility.go +++ b/src/chartserver/handler_utility.go @@ -175,7 +175,7 @@ func (c *Controller) GetChartVersionDetails(namespace, chartName, version string chartDetails.Security.Signature.Provenance = provFilePath } else { // Just log it - hlog.Errorf("Failed to get prov file for chart %s with error: %s, got %d bytes", chartV.Name, err.Error(), len(provBytes)) + hlog.Debugf("Failed to get prov file for chart %s with error: %s, got %d bytes", chartV.Name, err.Error(), len(provBytes)) } return chartDetails, nil diff --git a/src/chartserver/utils.go b/src/chartserver/utils.go index 2166f8a3b..fdaa84793 100644 --- a/src/chartserver/utils.go +++ b/src/chartserver/utils.go @@ -130,7 +130,7 @@ func getCacheConfig() (*ChartCacheConfig, error) { return nil, fmt.Errorf("failed to parse redis configurations from '%s' with error: %s", redisCfg, err) } if _, isSet := redisCfg["masterName"]; isSet { - driver = "redis_sentinel" + driver = cacheDriverRedisSentinel } // Convert config map to string