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

fixing cache creation, if 0 do not create any, allow flag to create #135

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions src/go/k8s/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func main() {
additionalControllers []string
operatorMode bool
enableHelmControllers bool

helmCacheMaxSize int
// allowPVCDeletion controls the PVC deletion feature in the Cluster custom resource.
// PVCs will be deleted when its Pod has been deleted and the Node that Pod is assigned to
// does not exist, or has the NoExecute taint. This is intended to support the rancher.io/local-path
Expand Down Expand Up @@ -183,7 +183,8 @@ func main() {
flag.StringSliceVar(&additionalControllers, "additional-controllers", []string{""}, fmt.Sprintf("which controllers to run, available: all, %s", strings.Join(availableControllers, ", ")))
flag.BoolVar(&operatorMode, "operator-mode", true, "enables to run as an operator, setting this to false will disable cluster (deprecated), redpanda resources reconciliation.")
flag.BoolVar(&enableHelmControllers, "enable-helm-controllers", true, "if a namespace is defined and operator mode is true, this enables the use of helm controllers to manage fluxcd helm resources.")

flag.IntVar(&helmCacheMaxSize, "helm-cache-max-size", 0,
alejandroEsc marked this conversation as resolved.
Show resolved Hide resolved
"The maximum size of the cache in number of indexes.")
logOptions.BindFlags(flag.CommandLine)
clientOptions.BindFlags(flag.CommandLine)
kubeConfigOpts.BindFlags(flag.CommandLine)
Expand Down Expand Up @@ -388,7 +389,12 @@ func main() {

cacheRecorder := helmSourceController.MustMakeCacheMetrics()
indexTTL := 15 * time.Minute
helmIndexCache := helmSourceController.NewCache(0, indexTTL)

var helmIndexCache helmSourceController.Cache
if helmCacheMaxSize > 0 {
alejandroEsc marked this conversation as resolved.
Show resolved Hide resolved
helmIndexCache = helmSourceController.NewCache(helmCacheMaxSize, 1*time.Minute)
alejandroEsc marked this conversation as resolved.
Show resolved Hide resolved
}

chartOpts := helmSourceController.HelmChartReconcilerOptions{
RateLimiter: helper.GetDefaultRateLimiter(),
}
Expand Down
Loading