Skip to content

Commit 6bae3e3

Browse files
fix: fixed merge conflicts
2 parents dc43692 + afa60c9 commit 6bae3e3

File tree

38 files changed

+200
-94
lines changed

38 files changed

+200
-94
lines changed

.github/workflows/code-scanning.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ jobs:
8484
8585
ALERTS=$(gh api "repos/${{ github.repository }}/code-scanning/alerts?ref=${{ github.ref }}&state=open" --jq 'length')
8686
87-
if [[ "$ALERTS" -eq 0 ]]; then
88-
REPORT="## 🛡️ CodeQL Analysis\n✅ No security issues found"
89-
else
87+
# Only comment if security issues are found
88+
if [[ "$ALERTS" -gt 0 ]]; then
9089
REPORT="## 🛡️ CodeQL Analysis\n🚨 Found **$ALERTS** security alert(s)\n\n🔗 [View details](https://github.com/${{ github.repository }}/security/code-scanning?query=is%3Aopen+branch%3A${{ github.ref_name }})"
90+
echo -e "$REPORT" | gh pr comment "$PR_NUM" --body-file=-
91+
else
92+
echo "No security issues found - skipping PR comment"
9193
fi
92-
93-
echo -e "$REPORT" | gh pr comment "$PR_NUM" --body-file=-
9494
env:
9595
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9696

.github/workflows/lint-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ jobs:
278278
output_dir: .github/outputs
279279

280280
- name: Generate Coverage Report with Fixed PR Number
281+
if: steps.changed-files.outputs.any_changed == 'true'
281282
run: |
282283
set -e # Exit on error
283284

fault-quarantine-module/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ require (
9191
google.golang.org/grpc v1.76.0 // indirect
9292
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
9393
gopkg.in/inf.v0 v0.9.1 // indirect
94-
gopkg.in/ini.v1 v1.67.0 // indirect
9594
gopkg.in/yaml.v3 v3.0.1 // indirect
9695
k8s.io/apiextensions-apiserver v0.34.1 // indirect
9796
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect

fault-quarantine-module/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnf
256256
gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
257257
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
258258
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
259-
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
260-
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
261259
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
262260
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
263261
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

fault-quarantine-module/main.go

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,26 @@ import (
2121
"syscall"
2222
"time"
2323

24+
"github.com/nvidia/nvsentinel/configmanager"
2425
"github.com/nvidia/nvsentinel/fault-quarantine-module/pkg/initializer"
2526
"k8s.io/klog/v2"
27+
"k8s.io/klog/v2/textlogger"
28+
)
29+
30+
var (
31+
// These variables will be populated during the build process
32+
version = "dev"
33+
commit = "none"
34+
date = "unknown"
2635
)
2736

2837
func main() {
29-
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT)
30-
defer stop()
38+
// Initialize klog flags to allow command-line control (e.g., -v=3)
39+
klog.InitFlags(nil)
40+
41+
// Create a context that gets cancelled on OS interrupt signals
42+
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
43+
defer stop() // Ensure the signal listener is cleaned up
3144

3245
var metricsPort = flag.String("metrics-port", "2112", "port to expose Prometheus metrics on")
3346

@@ -50,12 +63,20 @@ func main() {
5063
var circuitBreakerEnabled = flag.Bool("circuit-breaker-enabled", true,
5164
"enable or disable fault quarantine circuit breaker")
5265

53-
klog.InitFlags(nil)
54-
defer klog.Flush()
55-
5666
flag.Parse()
5767

58-
klog.Infof("Mongo client cert path: %s", *mongoClientCertMountPath)
68+
logger := textlogger.NewLogger(textlogger.NewConfig()).WithValues(
69+
"version", version,
70+
"module", "fault-quarantine-module",
71+
)
72+
73+
klog.SetLogger(logger)
74+
klog.InfoS("Starting fault-quarantine-module", "version", version, "commit", commit, "date", date)
75+
defer klog.Flush()
76+
77+
if _, err := configmanager.GetEnvVar[string]("POD_NAMESPACE"); err != nil {
78+
klog.Fatalf("Failed to get POD_NAMESPACE: %v", err)
79+
}
5980

6081
params := initializer.InitializationParams{
6182
MongoClientCertMountPath: *mongoClientCertMountPath,

fault-quarantine-module/pkg/evaluator/rule_evaluator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
platformconnectorprotos "github.com/nvidia/nvsentinel/platform-connectors/pkg/protos"
2727
"k8s.io/apimachinery/pkg/runtime"
2828
corelisters "k8s.io/client-go/listers/core/v1"
29-
"k8s.io/klog"
29+
"k8s.io/klog/v2"
3030
)
3131

3232
const (

fault-quarantine-module/pkg/evaluator/rule_set_evaluator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
multierror "github.com/hashicorp/go-multierror"
2121
"github.com/nvidia/nvsentinel/fault-quarantine-module/pkg/config"
2222
"github.com/nvidia/nvsentinel/fault-quarantine-module/pkg/informer"
23-
"k8s.io/klog"
23+
"k8s.io/klog/v2"
2424
)
2525

2626
func InitializeRuleSetEvaluators(

fault-quarantine-module/pkg/reconciler/reconciler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import (
3737
platformconnectorprotos "github.com/nvidia/nvsentinel/platform-connectors/pkg/protos"
3838
"github.com/nvidia/nvsentinel/statemanager"
3939
"go.mongodb.org/mongo-driver/bson/primitive"
40-
v1 "k8s.io/api/core/v1"
41-
"k8s.io/klog"
40+
corev1 "k8s.io/api/core/v1"
41+
"k8s.io/klog/v2"
4242
)
4343

4444
type ReconcilerConfig struct {
@@ -870,7 +870,7 @@ func (r *Reconciler) addEventToAnnotation(
870870
ctx context.Context,
871871
event *platformconnectorprotos.HealthEvent,
872872
) error {
873-
updateFn := func(node *v1.Node) error {
873+
updateFn := func(node *corev1.Node) error {
874874
if node.Annotations == nil {
875875
node.Annotations = make(map[string]string)
876876
}
@@ -908,7 +908,7 @@ func (r *Reconciler) removeEventFromAnnotation(
908908
ctx context.Context,
909909
event *platformconnectorprotos.HealthEvent,
910910
) error {
911-
updateFn := func(node *v1.Node) error {
911+
updateFn := func(node *corev1.Node) error {
912912
if node.Annotations == nil {
913913
return nil
914914
}

fault-remediation-module/go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require (
1111
k8s.io/api v0.34.1
1212
k8s.io/apimachinery v0.34.1
1313
k8s.io/client-go v0.34.1
14-
k8s.io/klog v1.0.0
1514
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
1615
sigs.k8s.io/controller-runtime v0.22.3
1716
sigs.k8s.io/yaml v1.6.0
@@ -68,6 +67,7 @@ require (
6867
github.com/nvidia/nvsentinel/platform-connectors v0.0.0-20251002153030-9e1e7404df8a
6968
github.com/nvidia/nvsentinel/statemanager v0.0.0-20251002153030-9e1e7404df8a
7069
github.com/nvidia/nvsentinel/store-client-sdk v0.0.0-20251002153030-9e1e7404df8a
70+
k8s.io/klog/v2 v2.130.1
7171
)
7272

7373
require (
@@ -91,7 +91,6 @@ require (
9191
go.yaml.in/yaml/v3 v3.0.4 // indirect
9292
gopkg.in/inf.v0 v0.9.1 // indirect
9393
k8s.io/apiextensions-apiserver v0.34.1 // indirect
94-
k8s.io/klog/v2 v2.130.1 // indirect
9594
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
9695
sigs.k8s.io/randfill v1.0.0 // indirect
9796
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect

fault-remediation-module/go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
1616
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
1717
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
1818
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
19-
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
2019
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
2120
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
2221
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -242,8 +241,6 @@ k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4=
242241
k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
243242
k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY=
244243
k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8=
245-
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
246-
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
247244
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
248245
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
249246
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=

0 commit comments

Comments
 (0)