Skip to content

Commit

Permalink
Create kubernetes-monitoring rbac's if only KSPM is enabled (#4125) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
luhi-DT authored Nov 29, 2024
1 parent 12cb27e commit 4d01742
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.rbac.activeGate.create }}
{{- if or (eq .Values.rbac.activeGate.create true) (eq .Values.rbac.kspm.create true) }}
# Copyright 2021 Dynatrace LLC

# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.rbac.activeGate.create }}
{{- if or (eq .Values.rbac.activeGate.create true) (eq .Values.rbac.kspm.create true) }}
# Copyright 2021 Dynatrace LLC

# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,17 @@ tests:
kind: ServiceAccount
name: dynatrace-kubernetes-monitoring
namespace: NAMESPACE
- it: should exist if only kspm is turned on
set:
rbac.activeGate.create: false
rbac.kspm.create: true
asserts:
- hasDocuments:
count: 2
- it: shouldn't exist if turned off
set:
rbac.activeGate.create: false
rbac.kspm.create: false
asserts:
- hasDocuments:
count: 0
count: 0
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ tests:
path: metadata.annotations
value:
test: test
- it: should exist if only kspm is turned on
set:
rbac.activeGate.create: false
rbac.kspm.create: true
asserts:
- isKind:
of: ServiceAccount
- it: shouldn't exist if turned off
set:
rbac.activeGate.create: false
rbac.kspm.create: false
asserts:
- hasDocuments:
count: 0
count: 0
2 changes: 1 addition & 1 deletion pkg/api/validation/dynakube/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func isOneAgentModuleDisabled(_ context.Context, v *Validator, dk *dynakube.Dyna
}

func isActiveGateModuleDisabled(_ context.Context, v *Validator, dk *dynakube.DynaKube) string {
if dk.ActiveGate().IsEnabled() && !v.modules.ActiveGate {
if dk.ActiveGate().IsEnabled() && !v.modules.ActiveGate && !v.modules.KSPM {
return errorActiveGateModuleDisabled
}

Expand Down
1 change: 0 additions & 1 deletion pkg/controllers/dynakube/kspm/daemonset/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

const (
nameSuffix = "-node-config-collector"
serviceAccountName = "dynatrace-node-config-collector"
)

Expand Down

0 comments on commit 4d01742

Please sign in to comment.