mirror of
https://github.com/morten-olsen/homelab-nuclei-operator.git
synced 2026-02-08 02:16:23 +01:00
fix: run job in operator namespace to avoid permission issues
This commit is contained in:
11
cmd/main.go
11
cmd/main.go
@@ -241,6 +241,16 @@ func main() {
|
||||
scannerServiceAccount = "nuclei-scanner"
|
||||
}
|
||||
|
||||
operatorNamespace := os.Getenv("OPERATOR_NAMESPACE")
|
||||
if operatorNamespace == "" {
|
||||
// Try to read from the downward API file
|
||||
if data, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil {
|
||||
operatorNamespace = string(data)
|
||||
} else {
|
||||
operatorNamespace = "nuclei-operator-system"
|
||||
}
|
||||
}
|
||||
|
||||
defaultTemplates := []string{}
|
||||
if v := os.Getenv("DEFAULT_TEMPLATES"); v != "" {
|
||||
defaultTemplates = strings.Split(v, ",")
|
||||
@@ -259,6 +269,7 @@ func main() {
|
||||
BackoffLimit: 2,
|
||||
MaxConcurrent: maxConcurrentScans,
|
||||
ServiceAccountName: scannerServiceAccount,
|
||||
OperatorNamespace: operatorNamespace,
|
||||
DefaultResources: jobmanager.DefaultConfig().DefaultResources,
|
||||
DefaultTemplates: defaultTemplates,
|
||||
DefaultSeverity: defaultSeverity,
|
||||
|
||||
Reference in New Issue
Block a user