255ba6aec9
- Updated `generate_report.sh` to include additional scanners and output paths. - Enhanced `send_report.py` with new data classes for misconfigurations and vulnerabilities. - Improved parsing logic for Trivy output, supporting both Kubernetes and image scans. - Added Prometheus metrics generation for various scan results, including misconfigurations and vulnerabilities. - Introduced unit tests for parsing Trivy output and generating Prometheus metrics. - Modified Terraform variables for SMTP port type and added Pushgateway URL variable.
105 lines
2.2 KiB
Terraform
105 lines
2.2 KiB
Terraform
resource "kubernetes_deployment" "pushgateway" {
|
|
metadata {
|
|
name = "pushgateway"
|
|
namespace = kubernetes_namespace.prometheus.metadata[0].name
|
|
labels = {
|
|
app = "pushgateway"
|
|
}
|
|
}
|
|
|
|
spec {
|
|
replicas = 1
|
|
strategy {
|
|
type = "Recreate"
|
|
}
|
|
|
|
selector {
|
|
match_labels = {
|
|
app = "pushgateway"
|
|
}
|
|
}
|
|
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "pushgateway"
|
|
}
|
|
annotations = {
|
|
"prometheus.io/scrape" = "true"
|
|
"prometheus.io/port" = "9091"
|
|
}
|
|
}
|
|
|
|
spec {
|
|
automount_service_account_token = false
|
|
|
|
security_context {
|
|
run_as_non_root = true
|
|
run_as_user = 65534
|
|
run_as_group = 65534
|
|
seccomp_profile {
|
|
type = "RuntimeDefault"
|
|
}
|
|
}
|
|
|
|
container {
|
|
name = "pushgateway"
|
|
image = "prom/pushgateway:${local.app_version}"
|
|
args = ["--persistence.file=/pushgateway/metrics"]
|
|
|
|
port {
|
|
name = "http"
|
|
container_port = 9091
|
|
}
|
|
|
|
security_context {
|
|
run_as_non_root = true
|
|
run_as_user = 65534
|
|
run_as_group = 65534
|
|
allow_privilege_escalation = false
|
|
privileged = false
|
|
read_only_root_filesystem = true
|
|
capabilities {
|
|
drop = ["ALL"]
|
|
}
|
|
}
|
|
|
|
volume_mount {
|
|
name = "pushgateway-storage-volume"
|
|
mount_path = "/pushgateway"
|
|
}
|
|
}
|
|
|
|
volume {
|
|
name = "pushgateway-storage-volume"
|
|
host_path {
|
|
path = local.pushgateway_folder
|
|
type = "DirectoryOrCreate"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "pushgateway" {
|
|
metadata {
|
|
name = "pushgateway"
|
|
namespace = kubernetes_namespace.prometheus.metadata[0].name
|
|
}
|
|
|
|
spec {
|
|
selector = {
|
|
app = "pushgateway"
|
|
}
|
|
type = "ClusterIP"
|
|
|
|
port {
|
|
port = 9091
|
|
protocol = "TCP"
|
|
target_port = "http"
|
|
}
|
|
}
|
|
}
|
|
|