Skip to content

Commit

Permalink
Add test case for OVNKubernetes alerts
Browse files Browse the repository at this point in the history
Rendered from template version: main (e0fcaa4)
  • Loading branch information
simu committed Apr 12, 2024
1 parent 5b86518 commit 09837bd
Show file tree
Hide file tree
Showing 17 changed files with 3,462 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "OpenShift4 Monitoring",
"slug": "openshift4-monitoring",
"parameter_key": "openshift4_monitoring",
"test_cases": "capacity-alerts remote-write user-workload-monitoring capacity-alerts-with-node-labels vsphere custom-rules release-4.13 team-routing release-4.14",
"test_cases": "capacity-alerts remote-write user-workload-monitoring capacity-alerts-with-node-labels vsphere custom-rules release-4.13 team-routing release-4.14 ovn-kubernetes",
"add_lib": "y",
"add_pp": "n",
"add_golden": "y",
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- release-4.13
- team-routing
- release-4.14
- ovn-kubernetes
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand All @@ -64,6 +65,7 @@ jobs:
- release-4.13
- team-routing
- release-4.14
- ovn-kubernetes
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= capacity-alerts
test_instances = tests/capacity-alerts.yml tests/remote-write.yml tests/user-workload-monitoring.yml tests/capacity-alerts-with-node-labels.yml tests/vsphere.yml tests/custom-rules.yml tests/release-4.13.yml tests/team-routing.yml tests/release-4.14.yml
test_instances = tests/capacity-alerts.yml tests/remote-write.yml tests/user-workload-monitoring.yml tests/capacity-alerts-with-node-labels.yml tests/vsphere.yml tests/custom-rules.yml tests/release-4.13.yml tests/team-routing.yml tests/release-4.14.yml tests/ovn-kubernetes.yml
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: redhatcop.redhat.io/v1alpha1
kind: Patch
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
labels:
name: namespace-openshift-monitoring-c4273dc15ddfdf7
name: namespace-openshift-monitoring-c4273dc15ddfdf7
namespace: syn-patch-operator
spec:
patches:
namespace-openshift-monitoring-c4273dc15ddfdf7-patch:
patchTemplate: |-
"metadata":
"labels":
"network.openshift.io/policy-group": "monitoring"
patchType: application/strategic-merge-patch+json
targetObjectRef:
apiVersion: v1
kind: Namespace
name: openshift-monitoring
serviceAccountRef:
name: patch-sa
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-openshift4-monitoring-cluster-reader
rbac.authorization.k8s.io/aggregate-to-cluster-reader: 'true'
name: syn-openshift4-monitoring-cluster-reader
rules:
- apiGroups:
- monitoring.coreos.com
resources:
- '*'
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: v1
data: {}
kind: Secret
metadata:
annotations: {}
labels:
name: alertmanager-main
name: alertmanager-main
namespace: openshift-monitoring
stringData:
alertmanager.yaml: |-
"inhibit_rules":
- "equal":
- "namespace"
- "alertname"
"source_match":
"severity": "critical"
"target_match_re":
"severity": "warning|info"
- "equal":
- "namespace"
- "alertname"
"source_match":
"severity": "warning"
"target_match_re":
"severity": "info"
"receivers":
- "name": "__component_openshift4_monitoring_null"
"route":
"group_interval": "5s"
"group_wait": "0s"
"repeat_interval": "10m"
"routes":
- "continue": false
"matchers":
- "namespace =~ \"\""
"receiver": "__component_openshift4_monitoring_null"
- "receiver": "__component_openshift4_monitoring_null"
type: Opaque
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: v1
data:
config.yaml: |-
"alertmanagerMain":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"volumeClaimTemplate":
"spec":
"resources":
"requests":
"storage": "2Gi"
"enableUserWorkload": true
"grafana":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"k8sPrometheusAdapter":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"kubeStateMetrics":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"openshiftStateMetrics":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"prometheusK8s":
"externalLabels":
"cluster_id": "c-green-test-1234"
"cluster_name": "Test Cluster 1234"
"tenant_id": "t-silent-test-1234"
"tenant_name": "Test Tenant 1234"
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"retention": "8d"
"volumeClaimTemplate":
"spec":
"resources":
"requests":
"storage": "50Gi"
"prometheusOperator":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"telemeterClient":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"thanosQuerier":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
kind: ConfigMap
metadata:
annotations: {}
labels:
name: cluster-monitoring-config
name: cluster-monitoring-config
namespace: openshift-monitoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: v1
data:
config.yaml: |-
"alertmanager":
"enableAlertmanagerConfig": true
"enabled": true
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"volumeClaimTemplate":
"spec":
"resources":
"requests":
"storage": "2Gi"
"prometheus":
"externalLabels":
"cluster_id": "c-green-test-1234-user-workload"
"cluster_name": "Test Cluster 1234 User Workload"
"tenant_id": "t-silent-test-1234"
"tenant_name": "Test Tenant 1234"
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"remoteWrite": []
"retention": "8d"
"volumeClaimTemplate":
"spec":
"resources":
"requests":
"storage": "50Gi"
"prometheusOperator":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
"thanosRuler":
"nodeSelector":
"node-role.kubernetes.io/infra": ""
kind: ConfigMap
metadata:
annotations: {}
labels:
name: user-workload-monitoring-config
name: user-workload-monitoring-config
namespace: openshift-user-workload-monitoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: alertmanager-allow-web
name: alertmanager-allow-web
namespace: openshift-monitoring
spec:
ingress:
- ports:
- port: 9092
protocol: TCP
- port: 9093
protocol: TCP
- port: 9095
protocol: TCP
- port: 9097
protocol: TCP
- from:
- namespaceSelector: {}
podSelector:
matchLabels:
app.kubernetes.io/name: alertmanager
policyTypes:
- Ingress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: allow-same-namespace
name: allow-same-namespace
namespace: openshift-monitoring
spec:
ingress:
- from:
- podSelector: {}
podSelector: {}
policyTypes:
- Ingress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: allow-non-alertmanager
name: allow-non-alertmanager
namespace: openshift-monitoring
spec:
ingress:
- {}
podSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: NotIn
values:
- alertmanager
policyTypes:
- Ingress
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: alertmanager-allow-web
name: alertmanager-allow-web
namespace: openshift-user-workload-monitoring
spec:
ingress:
- ports:
- port: 9092
protocol: TCP
- port: 9093
protocol: TCP
- port: 9095
protocol: TCP
- port: 9097
protocol: TCP
- from:
- namespaceSelector: {}
podSelector:
matchLabels:
app.kubernetes.io/name: alertmanager
policyTypes:
- Ingress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: allow-same-namespace
name: allow-same-namespace
namespace: openshift-user-workload-monitoring
spec:
ingress:
- from:
- podSelector: {}
podSelector: {}
policyTypes:
- Ingress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: allow-non-alertmanager
name: allow-non-alertmanager
namespace: openshift-user-workload-monitoring
spec:
ingress:
- {}
podSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: NotIn
values:
- alertmanager
policyTypes:
- Ingress
Loading

0 comments on commit 09837bd

Please sign in to comment.