-
Notifications
You must be signed in to change notification settings - Fork 36
feat: add event handling strategy changes in kubernetes object monitor #639
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
Merged
lalitadithya
merged 13 commits into
NVIDIA:main
from
tanishagoyal2:390-event-handling-in-kubernetes-monitor
Jan 21, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7cd7b22
feat: add processing strategy field in health events
tanishagoyal2 4c30024
feat: add e2e tests
tanishagoyal2 d38169b
feat: add event handling strategy in kubernetes monitor
tanishagoyal2 6f224f2
feat: temp commit
tanishagoyal2 134cea2
chore: review changes
tanishagoyal2 da3deff
chore: merge conflicts resolve
tanishagoyal2 93b3c0b
fix: add rule based override test
tanishagoyal2 c031572
fix: coderabbit changes
tanishagoyal2 75b2f1c
fix: revert annotation changes
tanishagoyal2 cd253b5
fix: close connnection properly
tanishagoyal2 7752903
chore: update tests to check node event is not created
tanishagoyal2 5a90c1a
Merge branch 'main' into 390-event-handling-in-kubernetes-monitor
tanishagoyal2 86ff149
fix: correct typo
tanishagoyal2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| apiVersion: v1 | ||
| data: | ||
| config.toml: | | ||
| [[policies]] | ||
| name = "node-test-condition" | ||
| enabled = true | ||
|
|
||
| [policies.resource] | ||
| group = "" | ||
| version = "v1" | ||
| kind = "Node" | ||
|
|
||
| [policies.predicate] | ||
| expression = ''' | ||
|
|
||
| resource.status.conditions.filter(c, c.type == "TestCondition" && c.status == "False").size() > 0 | ||
| ''' | ||
|
|
||
| [policies.healthEvent] | ||
| componentClass = "Node" | ||
| isFatal = false | ||
| message = "Node test condition is not ready" | ||
| recommendedAction = "CONTACT_SUPPORT" | ||
| errorCode = ["NODE_TEST_CONDITION_NOT_READY"] | ||
| processingStrategy = "STORE_ONLY" | ||
| kind: ConfigMap | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/instance: nvsentinel | ||
| app.kubernetes.io/name: kubernetes-object-monitor | ||
| name: kubernetes-object-monitor | ||
| namespace: nvsentinel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package helpers | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| "sigs.k8s.io/e2e-framework/klient" | ||
| "sigs.k8s.io/e2e-framework/pkg/envconf" | ||
| ) | ||
|
|
||
| const ( | ||
| K8S_DEPLOYMENT_NAME = "kubernetes-object-monitor" | ||
| K8S_CONTAINER_NAME = "kubernetes-object-monitor" | ||
| ) | ||
|
|
||
| type KubernetesObjectMonitorTestContext struct { | ||
| NodeName string | ||
| ConfigMapBackup []byte | ||
| TestNamespace string | ||
| } | ||
|
|
||
| func TeardownKubernetesObjectMonitor( | ||
| ctx context.Context, t *testing.T, c *envconf.Config, configMapBackup []byte, originalArgs []string, | ||
| ) { | ||
| t.Helper() | ||
|
|
||
| client, err := c.NewClient() | ||
| require.NoError(t, err) | ||
|
|
||
| if configMapBackup != nil { | ||
| t.Log("Restoring configmap from memory") | ||
|
|
||
| err = createConfigMapFromBytes(ctx, client, configMapBackup, "kubernetes-object-monitor", NVSentinelNamespace) | ||
| require.NoError(t, err) | ||
tanishagoyal2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| err = RestartDeployment(ctx, t, client, K8S_DEPLOYMENT_NAME, NVSentinelNamespace) | ||
| require.NoError(t, err) | ||
| } | ||
|
|
||
| err = RestoreDeploymentArgs(t, ctx, client, K8S_DEPLOYMENT_NAME, NVSentinelNamespace, K8S_CONTAINER_NAME, originalArgs) | ||
| require.NoError(t, err) | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| WaitForDeploymentRollout(ctx, t, client, K8S_DEPLOYMENT_NAME, NVSentinelNamespace) | ||
| } | ||
|
|
||
| func UpdateKubernetesObjectMonitorConfigMap(ctx context.Context, t *testing.T, client klient.Client, | ||
| configMapPath string, configName string) { | ||
| t.Helper() | ||
|
|
||
| if configMapPath == "" { | ||
| t.Fatalf("configMapPath is empty") | ||
| } | ||
|
|
||
| t.Logf("Updating configmap %s", configName) | ||
|
|
||
| err := createConfigMapFromFilePath(ctx, client, configMapPath, configName, NVSentinelNamespace) | ||
| require.NoError(t, err) | ||
|
|
||
| t.Logf("Restarting %s deployment", K8S_DEPLOYMENT_NAME) | ||
|
|
||
| err = RestartDeployment(ctx, t, client, K8S_DEPLOYMENT_NAME, NVSentinelNamespace) | ||
| require.NoError(t, err) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.