From f67703fb6c183b567763a006e60bc9317175df2d Mon Sep 17 00:00:00 2001 From: bertinm-gc Date: Tue, 17 Sep 2024 12:42:07 +0300 Subject: [PATCH 1/9] Support groundcover CLI in windows [sc-19269] (#291) --- .goreleaser.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a590791..9749a96 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -11,6 +11,7 @@ builds: goos: - linux - darwin + - windows goarch: - amd64 - arm64 From 05f1a19e25d4e0db8680b0e9076fe7b79ce8a00c Mon Sep 17 00:00:00 2001 From: bertinm-gc Date: Tue, 17 Sep 2024 13:35:16 +0300 Subject: [PATCH 2/9] CLI release 0 22 3 [sc-19273] (#292) --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f21c68..c1d0cd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,22 @@ We use the following categories for changes: ### Security +## [0.22.3] 2024-09-17 + +### Added + +- Support groundcover CLI in windows [#sc-19269] + +### Changed + +### Fixed + +### Removed + +### Deprecated + +### Security + ## [0.22.2] 2024-07-04 ### Added From 690b89fbbee324f5f9880ea5e56dd7c0e068d9da Mon Sep 17 00:00:00 2001 From: Ori Shussman Date: Mon, 7 Oct 2024 14:16:32 +0200 Subject: [PATCH 3/9] change alligator to sensor (#293) --- cmd/deploy.go | 2 +- cmd/status.go | 68 +++++++++++------------ pkg/helm/presets/agent/kernel-5-11.yaml | 2 +- pkg/helm/presets/agent/low-resources.yaml | 2 +- pkg/sentry/client.go | 2 +- pkg/sentry/context.go | 2 +- pkg/sentry/context_test.go | 6 +- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cmd/deploy.go b/cmd/deploy.go index ff3d1be..9d5d4f9 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -471,7 +471,7 @@ func validateInstall(ctx context.Context, kubeClient *k8s.Client, releaseName, n } if agentEnabled { - if err = waitForAlligators(ctx, kubeClient, namespace, appVersion, deployableNodesCount, sentryHelmContext); err != nil { + if err = waitForSensors(ctx, kubeClient, namespace, appVersion, deployableNodesCount, sentryHelmContext); err != nil { return err } } diff --git a/cmd/status.go b/cmd/status.go index 538e718..28aa135 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -28,18 +28,18 @@ const ( PVC_POLLING_RETRIES = 40 PVC_POLLING_TIMEOUT = time.Minute * 10 - ALLIGATORS_POLLING_INTERVAL = time.Second * 15 - ALLIGATORS_POLLING_RETRIES = 28 - ALLIGATORS_POLLING_TIMEOUT = time.Minute * 7 + SENSORS_POLLING_INTERVAL = time.Second * 15 + SENSORS_POLLING_RETRIES = 28 + SENSORS_POLLING_TIMEOUT = time.Minute * 7 - ALLIGATOR_LABEL_SELECTOR = "app=alligator" - BACKEND_LABEL_SELECTOR = "app!=alligator" - PORTAL_LABEL_SELECTOR = "app=portal" - RUNNING_FIELD_SELECTOR = "status.phase=Running" + SENSOR_LABEL_SELECTOR = "app=sensor" + BACKEND_LABEL_SELECTOR = "app!=sensor" + PORTAL_LABEL_SELECTOR = "app=portal" + RUNNING_FIELD_SELECTOR = "status.phase=Running" WAIT_FOR_PORTAL_FORMAT = "Waiting until cluster establish connectivity" WAIT_FOR_PVCS_FORMAT = "Waiting until all PVCs are bound (%d/%d PVCs)" - WAIT_FOR_ALLIGATORS_FORMAT = "Waiting until all nodes are monitored (%d/%d Nodes)" + WAIT_FOR_SENSORS_FORMAT = "Waiting until all nodes are monitored (%d/%d Nodes)" TIMEOUT_INSTALLATION_FORMAT = "Installation takes longer than expected, you can check the status using \"kubectl get pods -n %s\"" PVCS_VALIDATION_EVENT_NAME = "pvcs_validation" @@ -117,7 +117,7 @@ var StatusCmd = &cobra.Command{ } nodesCount := len(nodeList.Items) - if err = waitForAlligators(ctx, kubeClient, namespace, chart.AppVersion(), nodesCount, sentryHelmContext); err != nil { + if err = waitForSensors(ctx, kubeClient, namespace, chart.AppVersion(), nodesCount, sentryHelmContext); err != nil { return err } @@ -178,7 +178,7 @@ func waitForPortal(ctx context.Context, kubeClient *k8s.Client, namespace, appVe return err } -func waitForAlligators(ctx context.Context, kubeClient *k8s.Client, namespace, appVersion string, expectedAlligatorsCount int, sentryHelmContext *sentry_utils.HelmContext) error { +func waitForSensors(ctx context.Context, kubeClient *k8s.Client, namespace, appVersion string, expectedSensorsCount int, sentryHelmContext *sentry_utils.HelmContext) error { var err error event := segment.NewEvent(AGENTS_VALIDATION_EVENT_NAME) @@ -187,43 +187,43 @@ func waitForAlligators(ctx context.Context, kubeClient *k8s.Client, namespace, a event.StatusByError(err) }() - spinner := ui.GlobalWriter.NewSpinner(fmt.Sprintf(WAIT_FOR_ALLIGATORS_FORMAT, 0, expectedAlligatorsCount)) - spinner.SetStopMessage(fmt.Sprintf("All nodes are monitored (%d/%d Nodes)", expectedAlligatorsCount, expectedAlligatorsCount)) + spinner := ui.GlobalWriter.NewSpinner(fmt.Sprintf(WAIT_FOR_SENSORS_FORMAT, 0, expectedSensorsCount)) + spinner.SetStopMessage(fmt.Sprintf("All nodes are monitored (%d/%d Nodes)", expectedSensorsCount, expectedSensorsCount)) spinner.SetStopFailMessage(fmt.Sprintf(TIMEOUT_INSTALLATION_FORMAT, namespace)) spinner.Start() defer spinner.WriteStop() - runningAlligators := 0 + runningSensors := 0 - isAlligatorRunningFunc := func() error { + isSensorRunningFunc := func() error { var err error - if runningAlligators, err = getRunningAlligators(ctx, kubeClient, appVersion, namespace); err != nil { + if runningSensors, err = getRunningSensors(ctx, kubeClient, appVersion, namespace); err != nil { return err } - spinner.WriteMessage(fmt.Sprintf(WAIT_FOR_ALLIGATORS_FORMAT, runningAlligators, expectedAlligatorsCount)) + spinner.WriteMessage(fmt.Sprintf(WAIT_FOR_SENSORS_FORMAT, runningSensors, expectedSensorsCount)) - if runningAlligators >= expectedAlligatorsCount { + if runningSensors >= expectedSensorsCount { return nil } - err = errors.New("not all expected alligators are running") + err = errors.New("not all expected sensors are running") return ui.RetryableError(err) } - err = spinner.Poll(ctx, isAlligatorRunningFunc, ALLIGATORS_POLLING_INTERVAL, ALLIGATORS_POLLING_TIMEOUT, ALLIGATORS_POLLING_RETRIES) + err = spinner.Poll(ctx, isSensorRunningFunc, SENSORS_POLLING_INTERVAL, SENSORS_POLLING_TIMEOUT, SENSORS_POLLING_RETRIES) - runningAlligatorsStr := fmt.Sprintf("%d/%d", runningAlligators, expectedAlligatorsCount) - sentryHelmContext.RunningAlligators = runningAlligatorsStr - sentry_utils.SetTagOnCurrentScope(sentry_utils.EXPECTED_NODES_COUNT_TAG, fmt.Sprintf("%d", expectedAlligatorsCount)) - sentry_utils.SetTagOnCurrentScope(sentry_utils.RUNNING_ALLIGATORS_TAG, runningAlligatorsStr) + runningSensorsStr := fmt.Sprintf("%d/%d", runningSensors, expectedSensorsCount) + sentryHelmContext.RunningSensors = runningSensorsStr + sentry_utils.SetTagOnCurrentScope(sentry_utils.EXPECTED_NODES_COUNT_TAG, fmt.Sprintf("%d", expectedSensorsCount)) + sentry_utils.SetTagOnCurrentScope(sentry_utils.RUNNING_SENSORS_TAG, runningSensorsStr) sentryHelmContext.SetOnCurrentScope() event. - Set("alligatorsCount", expectedAlligatorsCount). - Set("runningAlligatorsCount", runningAlligators) + Set("sensorsCount", expectedSensorsCount). + Set("runningSensorsCount", runningSensors) if err == nil { return nil @@ -232,9 +232,9 @@ func waitForAlligators(ctx context.Context, kubeClient *k8s.Client, namespace, a defer spinner.WriteStopFail() if errors.Is(err, ui.ErrSpinnerTimeout) { - if runningAlligators > 0 { + if runningSensors > 0 { spinner.SetWarningSign() - spinner.SetStopFailMessage(fmt.Sprintf("groundcover managed to provision %d/%d nodes", runningAlligators, expectedAlligatorsCount)) + spinner.SetStopFailMessage(fmt.Sprintf("groundcover managed to provision %d/%d nodes", runningSensors, expectedSensorsCount)) } return ErrExecutionPartialSuccess @@ -243,27 +243,27 @@ func waitForAlligators(ctx context.Context, kubeClient *k8s.Client, namespace, a return err } -func getRunningAlligators(ctx context.Context, kubeClient *k8s.Client, appVersion string, namespace string) (int, error) { +func getRunningSensors(ctx context.Context, kubeClient *k8s.Client, appVersion string, namespace string) (int, error) { podClient := kubeClient.CoreV1().Pods(namespace) listOptions := metav1.ListOptions{ - LabelSelector: ALLIGATOR_LABEL_SELECTOR, + LabelSelector: SENSOR_LABEL_SELECTOR, FieldSelector: RUNNING_FIELD_SELECTOR, } - runningAlligators := 0 + runningSensors := 0 podList, err := podClient.List(ctx, listOptions) if err != nil { - return runningAlligators, err + return runningSensors, err } for _, pod := range podList.Items { if pod.Annotations["groundcover_version"] == appVersion { - runningAlligators++ + runningSensors++ } } - return runningAlligators, nil + return runningSensors, nil } func reportPodsStatus(ctx context.Context, kubeClient *k8s.Client, namespace string, sentryHelmContext *sentry_utils.HelmContext) { @@ -272,7 +272,7 @@ func reportPodsStatus(ctx context.Context, kubeClient *k8s.Client, namespace str return } - agentPodsStatus, err := listPodsStatuses(ctx, kubeClient, namespace, metav1.ListOptions{LabelSelector: ALLIGATOR_LABEL_SELECTOR}) + agentPodsStatus, err := listPodsStatuses(ctx, kubeClient, namespace, metav1.ListOptions{LabelSelector: SENSOR_LABEL_SELECTOR}) if err != nil { return } diff --git a/pkg/helm/presets/agent/kernel-5-11.yaml b/pkg/helm/presets/agent/kernel-5-11.yaml index ff423ec..0a119d8 100644 --- a/pkg/helm/presets/agent/kernel-5-11.yaml +++ b/pkg/helm/presets/agent/kernel-5-11.yaml @@ -1,6 +1,6 @@ --- agent: - alligator: + sensor: resources: requests: memory: 1Gi diff --git a/pkg/helm/presets/agent/low-resources.yaml b/pkg/helm/presets/agent/low-resources.yaml index 234626f..9461904 100644 --- a/pkg/helm/presets/agent/low-resources.yaml +++ b/pkg/helm/presets/agent/low-resources.yaml @@ -1,6 +1,6 @@ --- agent: - alligator: + sensor: resources: requests: cpu: 100m diff --git a/pkg/sentry/client.go b/pkg/sentry/client.go index be635db..f814c1f 100644 --- a/pkg/sentry/client.go +++ b/pkg/sentry/client.go @@ -20,7 +20,7 @@ const ( CLUSTER_NAME_TAG = "cluster.name" NODES_COUNT_TAG = "nodes.count" EXPECTED_NODES_COUNT_TAG = "nodes.expected_count" - RUNNING_ALLIGATORS_TAG = "nodes.running_alligators" + RUNNING_SENSORS_TAG = "nodes.running_sensors" FLUSH_TIMEOUT = time.Second * 2 ) diff --git a/pkg/sentry/context.go b/pkg/sentry/context.go index 19be35e..a0cae95 100644 --- a/pkg/sentry/context.go +++ b/pkg/sentry/context.go @@ -94,7 +94,7 @@ type HelmContext struct { ChartName string `json:",omitempty"` ReleaseName string `json:",omitempty"` ChartVersion string `json:",omitempty"` - RunningAlligators string `json:",omitempty"` + RunningSensors string `json:",omitempty"` PreviousChartVersion string `json:",omitempty"` ResourcesPresets []string `json:",omitempty"` ValuesOverride map[string]interface{} `json:",omitempty"` diff --git a/pkg/sentry/context_test.go b/pkg/sentry/context_test.go index 99c9aec..bb74419 100644 --- a/pkg/sentry/context_test.go +++ b/pkg/sentry/context_test.go @@ -157,7 +157,7 @@ func (suite *SentryContextTestSuite) TestHelmContexJsonOmitEmpty() { func (suite *SentryContextTestSuite) TestHelmContextSetOnCurrentScopeSuccess() { //prepare chartVersion := "1.0.0" - runningAlligators := "1/1" + runningSensors := "1/1" previousChartVersion := "0.9.0" repoUrl := uuid.New().String() chartName := uuid.New().String() @@ -171,7 +171,7 @@ func (suite *SentryContextTestSuite) TestHelmContextSetOnCurrentScopeSuccess() { sentryContext.PreviousChartVersion = previousChartVersion sentryContext.ValuesOverride = valuesOverride sentryContext.ResourcesPresets = resourcesPresets - sentryContext.RunningAlligators = runningAlligators + sentryContext.RunningSensors = runningSensors //act sentryContext.SetOnCurrentScope() @@ -187,7 +187,7 @@ func (suite *SentryContextTestSuite) TestHelmContextSetOnCurrentScopeSuccess() { ChartVersion: chartVersion, ValuesOverride: valuesOverride, ResourcesPresets: resourcesPresets, - RunningAlligators: runningAlligators, + RunningSensors: runningSensors, PreviousChartVersion: previousChartVersion, }, } From 2704aefa2a4b563f8be42827873ebdce44fb6053 Mon Sep 17 00:00:00 2001 From: Ori Shussman Date: Mon, 7 Oct 2024 14:30:32 +0200 Subject: [PATCH 4/9] tag cli v0.22.4 (#294) --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1d0cd8..e9399dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,22 @@ We use the following categories for changes: ### Security +## [0.22.4] 2024-10-07 + +### Added + +### Changed + +### Fixed + +- Waiting for sensor pods instead of alligator pods [#sc-19833] + +### Removed + +### Deprecated + +### Security + ## [0.22.3] 2024-09-17 ### Added From eb89b96f1aad628b72dfb0f8a755c77dc87ed23f Mon Sep 17 00:00:00 2001 From: Aviv Zohari <101040711+avivzgroundcover@users.noreply.github.com> Date: Sun, 13 Oct 2024 14:41:04 +0300 Subject: [PATCH 5/9] [sc-20013] add-vector-to-cli-low-preset (#295) --- pkg/helm/presets/backend/low-resources.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/helm/presets/backend/low-resources.yaml b/pkg/helm/presets/backend/low-resources.yaml index b257bab..075370c 100644 --- a/pkg/helm/presets/backend/low-resources.yaml +++ b/pkg/helm/presets/backend/low-resources.yaml @@ -80,7 +80,6 @@ monitors-manager: cpu: 50m memory: 150Mi - backend: postgresql: primary: @@ -91,3 +90,11 @@ backend: limits: memory: 60Mi +vector: + replicas: 1 + resources: + requests: + cpu: 50m + memory: 256Mi + limits: + memory: 1024Mi From 00fa97a790db51054b8f22e6cb7377f2e160b1b7 Mon Sep 17 00:00:00 2001 From: Aviv Zohari <101040711+avivzgroundcover@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:03:27 +0300 Subject: [PATCH 6/9] [sc-20036] added keep to low resources overrides (#296) --- pkg/helm/presets/backend/low-resources.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/helm/presets/backend/low-resources.yaml b/pkg/helm/presets/backend/low-resources.yaml index 075370c..a935386 100644 --- a/pkg/helm/presets/backend/low-resources.yaml +++ b/pkg/helm/presets/backend/low-resources.yaml @@ -89,6 +89,12 @@ backend: memory: 40Mi limits: memory: 60Mi + keep: + backend: + resources: + requests: + cpu: 100m + memory: 128Mi vector: replicas: 1 From f15f925a482507011691f2cef2b2cbfa5d349649 Mon Sep 17 00:00:00 2001 From: Aviv Zohari <101040711+avivzgroundcover@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:07:15 +0300 Subject: [PATCH 7/9] release v0.22.5 (#297) --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9399dd..e546d87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,22 @@ We use the following categories for changes: ### Security +## [0.22.5] 2024-10-13 + +### Added + +### Changed + +- Update low resources presets to include new components [#sc-20036] + +### Fixed + +### Removed + +### Deprecated + +### Security + ## [0.22.4] 2024-10-07 ### Added From 50d3eb6ce71fecfc8d6e10578a008fb9e76f0f5d Mon Sep 17 00:00:00 2001 From: Aviv Zohari <101040711+avivzgroundcover@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:14:01 +0300 Subject: [PATCH 8/9] [sc-20056] Low resource preset should take precedence over kernel 5.11 overrides (#298) --- CHANGELOG.md | 2 ++ cmd/deploy.go | 8 +------- pkg/helm/tune.go | 14 +++++++++++++- pkg/helm/tune_test.go | 34 ++++++++++++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e546d87..84e6147 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ We use the following categories for changes: ### Fixed +- Low resource preset should take precedence over kernel 5.11 overrides [#sc-20056] + ### Removed ### Deprecated diff --git a/cmd/deploy.go b/cmd/deploy.go index 9d5d4f9..69679c6 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -6,7 +6,6 @@ import ( "strconv" "time" - "github.com/blang/semver/v4" "github.com/getsentry/sentry-go" "github.com/imdario/mergo" "github.com/pkg/errors" @@ -46,7 +45,6 @@ const ( HELM_REPO_URL = "https://helm.groundcover.com" CLUSTER_URL_FORMAT = "%s/?clusterId=%s&viewType=Overview" QUAY_REGISTRY_PRESET_PATH = "presets/quay.yaml" - AGENT_KERNEL_5_11_PRESET_PATH = "presets/agent/kernel-5-11.yaml" CUSTOM_METRICS_PRESET_PATH = "presets/backend/custom-metrics.yaml" KUBE_STATE_METRICS_PRESET_PATH = "presets/backend/kube-state-metrics.yaml" STORAGE_CLASS_TEMPLATE_PATH = "templates/backend/storage-class.yaml" @@ -607,7 +605,7 @@ func generateChartValues(chartValues map[string]interface{}, apiKey, installatio helm.BACKEND_LOW_RESOURCES_PATH, } } else { - agentPresetPath := helm.GetAgentResourcePresetPath(allocatableResources) + agentPresetPath := helm.GetAgentResourcePresetPath(allocatableResources, nodesReport.MaximalKernelVersion()) if agentPresetPath != helm.DEFAULT_PRESET { overridePaths = append(overridePaths, agentPresetPath) } @@ -632,10 +630,6 @@ func generateChartValues(chartValues map[string]interface{}, apiKey, installatio overridePaths = append(overridePaths, KUBE_STATE_METRICS_PRESET_PATH) } - if semver.MustParseRange(">=5.11.0")(nodesReport.MaximalKernelVersion()) { - overridePaths = append(overridePaths, AGENT_KERNEL_5_11_PRESET_PATH) - } - if len(overridePaths) > 0 { sentryHelmContext.ResourcesPresets = overridePaths sentryHelmContext.SetOnCurrentScope() diff --git a/pkg/helm/tune.go b/pkg/helm/tune.go index 6c61457..bd9851b 100644 --- a/pkg/helm/tune.go +++ b/pkg/helm/tune.go @@ -3,6 +3,7 @@ package helm import ( "embed" + "github.com/blang/semver/v4" "groundcover.com/pkg/k8s" "k8s.io/apimachinery/pkg/api/resource" ) @@ -17,6 +18,13 @@ const ( AGENT_DEFAULT_MEMORY_THRESHOLD = "1024Mi" AGENT_LOW_RESOURCES_PATH = "presets/agent/low-resources.yaml" + // Starting from Linux kernel version 5.11, eBPF maps are accounted for in the memory cgroup + // of the process that created them. For this reason we need to increase the memory limit for + // the agent. + // https://github.com/cilium/ebpf/blob/v0.16.0/docs/ebpf/concepts/rlimit.md#resource-limits + AGENT_KERNEL_5_11_PRESET_PATH = "presets/agent/kernel-5-11.yaml" + KERNEL_5_11_SEMVER_EXPRESSION = ">=5.11.0" + EMPTYDIR_STORAGE_PATH = "presets/backend/emptydir-storage.yaml" BACKEND_DEFAULT_TOTAL_CPU_THRESHOLD = "12000m" @@ -39,7 +47,7 @@ type AllocatableResources struct { NodeCount int } -func GetAgentResourcePresetPath(allocatableResources *AllocatableResources) string { +func GetAgentResourcePresetPath(allocatableResources *AllocatableResources, maxKernelVersion semver.Version) string { defaultCpuThreshold := resource.MustParse(AGENT_DEFAULT_CPU_THRESHOLD) defaultMemoryThreshold := resource.MustParse(AGENT_DEFAULT_MEMORY_THRESHOLD) @@ -50,6 +58,10 @@ func GetAgentResourcePresetPath(allocatableResources *AllocatableResources) stri return AGENT_LOW_RESOURCES_PATH } + if semver.MustParseRange(KERNEL_5_11_SEMVER_EXPRESSION)(maxKernelVersion) { + return AGENT_KERNEL_5_11_PRESET_PATH + } + return DEFAULT_PRESET } diff --git a/pkg/helm/tune_test.go b/pkg/helm/tune_test.go index 6a35db9..957d3b6 100644 --- a/pkg/helm/tune_test.go +++ b/pkg/helm/tune_test.go @@ -3,6 +3,7 @@ package helm_test import ( "testing" + "github.com/blang/semver/v4" "github.com/stretchr/testify/assert" "groundcover.com/pkg/helm" "groundcover.com/pkg/k8s" @@ -10,6 +11,11 @@ import ( "k8s.io/apimachinery/pkg/api/resource" ) +var ( + Kernel510Semver = semver.MustParse("5.10.0") + Kernel511Semver = semver.MustParse("5.11.0") +) + func TestTuneResourcesValuesAgentLow(t *testing.T) { // arrange agentLowCpu := resource.MustParse(helm.AGENT_DEFAULT_CPU_THRESHOLD) @@ -28,7 +34,7 @@ func TestTuneResourcesValuesAgentLow(t *testing.T) { resources := helm.CalcAllocatableResources(lowNodeReport) // act - cpu := helm.GetAgentResourcePresetPath(resources) + cpu := helm.GetAgentResourcePresetPath(resources, Kernel510Semver) // assert assert.Equal(t, helm.AGENT_LOW_RESOURCES_PATH, cpu) @@ -52,12 +58,36 @@ func TestTuneResourcesValuesAgentDefault(t *testing.T) { resources := helm.CalcAllocatableResources(defaultNodeReport) // act - cpu := helm.GetAgentResourcePresetPath(resources) + cpu := helm.GetAgentResourcePresetPath(resources, Kernel510Semver) // assert assert.Equal(t, helm.DEFAULT_PRESET, cpu) } +func TestTuneResourcesValuesAgentNewKernel(t *testing.T) { + // arrange + agentDefaultCpu := resource.MustParse(helm.AGENT_DEFAULT_CPU_THRESHOLD) + agentDefaultCpu.Add(*resource.NewMilliQuantity(1, resource.DecimalSI)) + + agentDefaultMemory := resource.MustParse(helm.AGENT_DEFAULT_MEMORY_THRESHOLD) + agentDefaultMemory.Add(*resource.NewQuantity(1, resource.BinarySI)) + + defaultNodeReport := []*k8s.NodeSummary{ + { + CPU: &agentDefaultCpu, + Memory: &agentDefaultMemory, + }, + } + + resources := helm.CalcAllocatableResources(defaultNodeReport) + + // act + cpu := helm.GetAgentResourcePresetPath(resources, Kernel511Semver) + + // assert + assert.Equal(t, helm.AGENT_KERNEL_5_11_PRESET_PATH, cpu) +} + func TestTuneResourcesValuesBackendLow(t *testing.T) { // arrange backendLowCpu := resource.MustParse(helm.BACKEND_DEFAULT_TOTAL_CPU_THRESHOLD) From 9db07f303aaf670b47caa8858502dff9eacc1ac1 Mon Sep 17 00:00:00 2001 From: Aviv Zohari <101040711+avivzgroundcover@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:10:11 +0300 Subject: [PATCH 9/9] release v0.22.6 (#299) --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84e6147..2a92f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,20 @@ We use the following categories for changes: ### Fixed +### Removed + +### Deprecated + +### Security + +## [0.22.6] 2024-10-21 + +### Added + +### Changed + +### Fixed + - Low resource preset should take precedence over kernel 5.11 overrides [#sc-20056] ### Removed