|
| 1 | +rule_files: |
| 2 | + - cert-health-rules.yaml |
| 3 | + |
| 4 | +evaluation_interval: 30s |
| 5 | + |
| 6 | +tests: |
| 7 | + # GatewayListenerCertUnusable — listener withheld for more than 5 minutes |
| 8 | + - interval: 1m |
| 9 | + input_series: |
| 10 | + - series: 'nso_gateway_listener_cert_withheld{namespace="customer-ns", name="my-gateway", listener="https-custom", hostname="example.com", reason="InvalidCertificateRef"}' |
| 11 | + values: '1+0x5' |
| 12 | + alert_rule_test: |
| 13 | + - eval_time: 6m |
| 14 | + alertname: GatewayListenerCertUnusable |
| 15 | + exp_alerts: |
| 16 | + - exp_labels: |
| 17 | + severity: warning |
| 18 | + namespace: customer-ns |
| 19 | + name: my-gateway |
| 20 | + listener: https-custom |
| 21 | + hostname: example.com |
| 22 | + reason: InvalidCertificateRef |
| 23 | + exp_annotations: |
| 24 | + summary: "Gateway listener customer-ns/my-gateway/https-custom has an unusable TLS certificate" |
| 25 | + description: "NSO has withheld listener https-custom (hostname example.com) on Gateway my-gateway in namespace customer-ns because its TLS certificate is unusable (reason: InvalidCertificateRef). The customer cannot serve HTTPS on this hostname. Check the cert-manager Certificate and Secret in the downstream cluster." |
| 26 | + |
| 27 | + # GatewayListenerCertUnusable — listener withheld for less than 5 minutes (should NOT alert) |
| 28 | + - interval: 1m |
| 29 | + input_series: |
| 30 | + - series: 'nso_gateway_listener_cert_withheld{namespace="customer-ns", name="my-gateway", listener="https-custom", hostname="example.com", reason="InvalidCertificateRef"}' |
| 31 | + values: '1+0x2' |
| 32 | + alert_rule_test: |
| 33 | + - eval_time: 3m |
| 34 | + alertname: GatewayListenerCertUnusable |
| 35 | + exp_alerts: [] |
| 36 | + |
| 37 | + # GatewayListenerCertUnusable — listener is healthy (withheld=0, should NOT alert) |
| 38 | + - interval: 1m |
| 39 | + input_series: |
| 40 | + - series: 'nso_gateway_listener_cert_withheld{namespace="customer-ns", name="healthy-gateway", listener="https-custom", hostname="ok.com", reason="InvalidCertificateRef"}' |
| 41 | + values: '0+0x5' |
| 42 | + alert_rule_test: |
| 43 | + - eval_time: 6m |
| 44 | + alertname: GatewayListenerCertUnusable |
| 45 | + exp_alerts: [] |
| 46 | + |
| 47 | + # GatewayListenerCertExpiringSoon — cert expires in 5 days (within 7-day threshold) |
| 48 | + # At eval_time 62m (3720s), expiry_time = 3720 + 5*86400 = 435720 |
| 49 | + - interval: 1m |
| 50 | + input_series: |
| 51 | + - series: 'nso_gateway_listener_cert_expiry_time{namespace="customer-ns", name="my-gateway", listener="https-custom", hostname="example.com", secret="my-gateway-https-custom"}' |
| 52 | + values: '435720+0x62' |
| 53 | + alert_rule_test: |
| 54 | + - eval_time: 62m |
| 55 | + alertname: GatewayListenerCertExpiringSoon |
| 56 | + exp_alerts: |
| 57 | + - exp_labels: |
| 58 | + severity: warning |
| 59 | + namespace: customer-ns |
| 60 | + name: my-gateway |
| 61 | + listener: https-custom |
| 62 | + hostname: example.com |
| 63 | + secret: my-gateway-https-custom |
| 64 | + exp_annotations: |
| 65 | + summary: "TLS certificate for Gateway listener customer-ns/my-gateway/https-custom expires in less than 7 days" |
| 66 | + description: "The cert-manager Certificate for listener https-custom (hostname example.com, secret my-gateway-https-custom) on Gateway my-gateway in namespace customer-ns expires within 7 days. cert-manager should renew it automatically, but renewal fails if the domain's DNS no longer points to Datum. Verify the Certificate is Ready=True in the downstream cluster." |
| 67 | + |
| 68 | + # GatewayListenerCertExpiringSoon — cert expires in 8 days (outside threshold, should NOT alert) |
| 69 | + # At eval_time 62m (3720s), expiry_time = 3720 + 8*86400 = 694920 |
| 70 | + - interval: 1m |
| 71 | + input_series: |
| 72 | + - series: 'nso_gateway_listener_cert_expiry_time{namespace="customer-ns", name="my-gateway", listener="https-custom", hostname="example.com", secret="my-gateway-https-custom"}' |
| 73 | + values: '694920+0x62' |
| 74 | + alert_rule_test: |
| 75 | + - eval_time: 62m |
| 76 | + alertname: GatewayListenerCertExpiringSoon |
| 77 | + exp_alerts: [] |
| 78 | + |
| 79 | + # TLSBackstopPruningChains — backstop actively dropping chains for more than 2 minutes |
| 80 | + - interval: 1m |
| 81 | + input_series: |
| 82 | + - series: 'nso_extension_tls_pruned_chains_active' |
| 83 | + values: '3+0x2' |
| 84 | + alert_rule_test: |
| 85 | + - eval_time: 3m |
| 86 | + alertname: TLSBackstopPruningChains |
| 87 | + exp_alerts: |
| 88 | + - exp_labels: |
| 89 | + severity: warning |
| 90 | + exp_annotations: |
| 91 | + summary: "Extension server TLS backstop is actively pruning 3 broken filter chain(s)" |
| 92 | + description: "The extension server's TLS backstop is dropping 3 broken TLS filter chain(s) from PostTranslateModify responses. Check extension server logs for 'pruned invalid TLS chains' to identify affected hostnames. If GatewayListenerCertUnusable is also firing, the two-layer defense is working as expected. If only this alert fires, the controller-side cert gating may have missed the listener." |
| 93 | + |
| 94 | + # TLSBackstopPruningChains — backstop just started, under 2 minutes (should NOT alert) |
| 95 | + - interval: 1m |
| 96 | + input_series: |
| 97 | + - series: 'nso_extension_tls_pruned_chains_active' |
| 98 | + values: '2+0x0' |
| 99 | + alert_rule_test: |
| 100 | + - eval_time: 1m |
| 101 | + alertname: TLSBackstopPruningChains |
| 102 | + exp_alerts: [] |
| 103 | + |
| 104 | + # TLSBackstopPruningChains — no chains pruned (should NOT alert) |
| 105 | + - interval: 1m |
| 106 | + input_series: |
| 107 | + - series: 'nso_extension_tls_pruned_chains_active' |
| 108 | + values: '0+0x2' |
| 109 | + alert_rule_test: |
| 110 | + - eval_time: 3m |
| 111 | + alertname: TLSBackstopPruningChains |
| 112 | + exp_alerts: [] |
| 113 | + |
| 114 | + # TLSBackstopListenerAllCertsBroken — all certs broken for more than 2 minutes (critical) |
| 115 | + - interval: 1m |
| 116 | + input_series: |
| 117 | + - series: 'nso_extension_tls_listeners_left_intact_active' |
| 118 | + values: '1+0x2' |
| 119 | + alert_rule_test: |
| 120 | + - eval_time: 3m |
| 121 | + alertname: TLSBackstopListenerAllCertsBroken |
| 122 | + exp_alerts: |
| 123 | + - exp_labels: |
| 124 | + severity: critical |
| 125 | + exp_annotations: |
| 126 | + summary: "1 Envoy listener(s) have all TLS certificates broken — backstop cannot protect them" |
| 127 | + description: "The extension server left 1 Envoy listener(s) completely intact because every TLS filter chain on them referenced a broken certificate. The backstop never empties a listener, so Envoy will reject the LDS update for those listeners (see EnvoyListenerUpdateRejected). This means NSO's controller-side cert gating did not suppress the listener before it reached the data plane. Check extension server logs for 'listeners_left_intact' and investigate why evaluateListenerCertHealth did not catch the listener." |
| 128 | + |
| 129 | + # TLSBackstopListenerAllCertsBroken — condition just started, under 2 minutes (should NOT alert) |
| 130 | + - interval: 1m |
| 131 | + input_series: |
| 132 | + - series: 'nso_extension_tls_listeners_left_intact_active' |
| 133 | + values: '2+0x0' |
| 134 | + alert_rule_test: |
| 135 | + - eval_time: 1m |
| 136 | + alertname: TLSBackstopListenerAllCertsBroken |
| 137 | + exp_alerts: [] |
| 138 | + |
| 139 | + # TLSBackstopListenerAllCertsBroken — no intact listeners (should NOT alert) |
| 140 | + - interval: 1m |
| 141 | + input_series: |
| 142 | + - series: 'nso_extension_tls_listeners_left_intact_active' |
| 143 | + values: '0+0x2' |
| 144 | + alert_rule_test: |
| 145 | + - eval_time: 3m |
| 146 | + alertname: TLSBackstopListenerAllCertsBroken |
| 147 | + exp_alerts: [] |
0 commit comments