Skip to content

Commit 2c0fddc

Browse files
committed
Add email alert to SELinux jobs
Enhance the kops test generator to optionaly add email alerts + configure them for the SELinux jobs
1 parent f416a67 commit 2c0fddc

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

config/jobs/kubernetes/kops/build_jobs.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ def build_test(cloud='aws',
8585
build_cluster=None,
8686
cluster_name=None,
8787
template_path=None,
88-
storage_e2e_cred=False):
88+
storage_e2e_cred=False,
89+
alert_email=None,
90+
alert_num_failures=None):
8991
# pylint: disable=too-many-statements,too-many-branches,too-many-arguments
9092
if kops_version is None:
9193
kops_deploy_url = marker_updown_green(None)
@@ -259,6 +261,11 @@ def build_test(cloud='aws',
259261
'testgrid-days-of-results': str(days_of_results),
260262
'testgrid-tab-name': tab,
261263
}
264+
if alert_email is not None:
265+
annotations['testgrid-alert-email'] = alert_email
266+
if alert_num_failures is not None:
267+
annotations['testgrid-num-failures-to-alert'] = str(alert_num_failures)
268+
262269
for (k, v) in spec.items():
263270
annotations[f"test.kops.k8s.io/{k}"] = v or ""
264271

@@ -299,7 +306,9 @@ def presubmit_test(branch='master',
299306
use_boskos=False,
300307
build_cluster=None,
301308
cluster_name=None,
302-
use_preset_for_account_creds=None):
309+
use_preset_for_account_creds=None,
310+
alert_email=None,
311+
alert_num_failures=None):
303312
# pylint: disable=too-many-statements,too-many-branches,too-many-arguments
304313
if cloud == 'aws':
305314
if distro == "channels":
@@ -422,6 +431,11 @@ def presubmit_test(branch='master',
422431
'testgrid-days-of-results': '90',
423432
'testgrid-tab-name': tab_name or name,
424433
}
434+
if alert_email is not None:
435+
annotations['testgrid-alert-email'] = alert_email
436+
if alert_num_failures is not None:
437+
annotations['testgrid-num-failures-to-alert'] = str(alert_num_failures)
438+
425439
for (k, v) in spec.items():
426440
annotations[f"test.kops.k8s.io/{k}"] = v or ""
427441

@@ -932,7 +946,9 @@ def generate_misc():
932946
test_args="--master-os-distro=custom --node-os-distro=custom",
933947
# Serial and Disruptive tests can be slow.
934948
test_timeout_minutes=120,
935-
runs_per_day=3),
949+
runs_per_day=3,
950+
alert_email="[email protected]",
951+
alert_num_failures=10),
936952

937953
# [sig-storage, @jsafrane] A one-off scenario testing all SELinux related feature gates enabled
938954
# and opt-in selinux-warning-controller.
@@ -970,7 +986,9 @@ def generate_misc():
970986
test_args="--master-os-distro=custom --node-os-distro=custom",
971987
# Serial and Disruptive tests can be slow.
972988
test_timeout_minutes=120,
973-
runs_per_day=3),
989+
runs_per_day=3,
990+
alert_email="[email protected]",
991+
alert_num_failures=10),
974992

975993
# test kube-up to kops jobs migration
976994
build_test(name_override="ci-kubernetes-e2e-cos-gce-canary",

config/jobs/kubernetes/kops/kops-periodics-misc2.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,8 +2145,10 @@ periodics:
21452145
test.kops.k8s.io/kops_channel: alpha
21462146
test.kops.k8s.io/kops_version: latest
21472147
test.kops.k8s.io/networking: cilium
2148+
testgrid-alert-email: [email protected]
21482149
testgrid-dashboards: kops-distro-rhel9, kops-k8s-ci, kops-latest, sig-cluster-lifecycle-kops
21492150
testgrid-days-of-results: '90'
2151+
testgrid-num-failures-to-alert: '10'
21502152
testgrid-tab-name: kops-aws-selinux
21512153

21522154
# {"cloud": "aws", "distro": "rhel9", "extra_flags": "--set=cluster.spec.containerd.selinuxEnabled=true --set=cluster.spec.kubeControllerManager.controllers=* --set=cluster.spec.kubeControllerManager.controllers=selinux-warning-controller --discovery-store=s3://k8s-kops-prow/discovery", "feature_flags": "SELinuxMount", "k8s_version": "ci", "kops_channel": "alpha", "kops_version": "latest", "networking": "cilium"}
@@ -2216,8 +2218,10 @@ periodics:
22162218
test.kops.k8s.io/kops_channel: alpha
22172219
test.kops.k8s.io/kops_version: latest
22182220
test.kops.k8s.io/networking: cilium
2221+
testgrid-alert-email: [email protected]
22192222
testgrid-dashboards: kops-distro-rhel9, kops-k8s-ci, kops-latest, sig-cluster-lifecycle-kops
22202223
testgrid-days-of-results: '90'
2224+
testgrid-num-failures-to-alert: '10'
22212225
testgrid-tab-name: kops-aws-selinux-alpha
22222226

22232227
# {"cloud": "gce", "distro": "cos105", "extra_flags": "--image=cos-cloud/cos-105-17412-370-67 --set=spec.nodeProblemDetector.enabled=true --gce-service-account=default", "k8s_version": "ci", "kops_channel": "alpha", "kops_version": "latest", "networking": "kubenet"}

0 commit comments

Comments
 (0)