-
Notifications
You must be signed in to change notification settings - Fork 0
feat(observability): stage Coroot cluster heartbeat #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
01d2657
test(observability): require Coroot heartbeat
devantler b8eb882
feat(observability): stage Coroot heartbeat
devantler a444653
test(observability): tighten heartbeat contract
devantler 972fc87
fix(observability): isolate heartbeat egress
devantler a8c33b4
test(observability): reject duplicate heartbeats
devantler 6ea9ae2
docs(observability): describe heartbeat validator
devantler 3c6766a
style(observability): align contract checks
devantler 07cbf7f
fix(observability): preserve heartbeat signal
devantler 1e51998
fix(observability): deny heartbeat ingress
devantler 408f835
fix(observability): scope heartbeat policy inputs
devantler 9343340
fix(observability): validate heartbeat port
devantler ba5d1a1
docs(observability): document shell helpers
devantler 2e190f8
fix(observability): preserve staged heartbeat safety
devantler 52e6e94
fix(observability): keep validator self-contained
devantler 6038a04
fix(observability): isolate heartbeat input
devantler 4b2c52e
fix(observability): close heartbeat policy gaps
devantler 04fa044
docs(observability): document render count helpers
devantler ebd7c85
docs(observability): explain render helper
devantler 2ad7cbd
docs(observability): align helper documentation
devantler e7a11dd
fix(observability): separate Coroot heartbeat signal
devantler f010e85
fix(observability): separate heartbeat monitors
devantler b86b89f
fix(observability): protect heartbeat credentials
devantler d80f2d1
docs(observability): describe validator helpers
devantler 06fc41f
fix(observability): close heartbeat review gaps
devantler cc5aea1
fix(observability): reject credentialed heartbeat aliases
devantler ab1ba55
fix(observability): keep heartbeat token out of argv
devantler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
k8s/bases/apps/cluster-heartbeat/cilium-network-policy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| apiVersion: cilium.io/v2 | ||
| kind: CiliumNetworkPolicy | ||
| metadata: | ||
| name: allow-cluster-heartbeat | ||
| namespace: observability | ||
| spec: | ||
| endpointSelector: | ||
| matchLabels: | ||
| platform-heartbeat: "true" | ||
| enableDefaultDeny: | ||
| ingress: true | ||
| egress: true | ||
| ingressDeny: | ||
| - {} | ||
| egress: | ||
| - toFQDNs: | ||
| - matchName: hc-ping.com | ||
|
devantler marked this conversation as resolved.
|
||
| toPorts: | ||
| - ports: | ||
| - port: "443" | ||
| protocol: TCP | ||
| # DNS is the only other egress path required to resolve the exact endpoint. | ||
| - toEndpoints: | ||
| - matchLabels: | ||
| k8s:io.kubernetes.pod.namespace: kube-system | ||
| k8s-app: kube-dns | ||
| toPorts: | ||
| - ports: | ||
| - port: "53" | ||
| protocol: UDP | ||
| - port: "53" | ||
| protocol: TCP | ||
| rules: | ||
| dns: | ||
| - matchName: hc-ping.com | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Cluster-level dead-man's-switch. Every five minutes a pod pings the | ||
| # per-cluster external heartbeat monitor. The monitor alerts out of band when | ||
| # pings stop, covering the one failure that in-cluster alerting cannot report: | ||
| # the whole cluster being unavailable. | ||
| # | ||
| # The ping is unconditional. Component health remains Coroot's responsibility; | ||
| # coupling this signal to Coroot would turn a component outage into a false | ||
| # cluster-down alarm. | ||
| # | ||
| # The URL comes from the dedicated Flux substitution input through a Secret | ||
| # reference, and curl consumes it from stdin configuration, so the bearer token | ||
| # does not appear in the PodSpec or curl's runtime argv. Local and unconfigured | ||
| # clusters use the invalid fallback, and `|| true` keeps the Job from flapping | ||
| # when no external monitor is configured. The signal is the absence of pings at | ||
| # the external monitor, not the Job exit code. | ||
| apiVersion: batch/v1 | ||
| kind: CronJob | ||
| metadata: | ||
| name: cluster-heartbeat | ||
| namespace: observability | ||
| spec: | ||
| schedule: "*/5 * * * *" | ||
| concurrencyPolicy: Forbid | ||
| startingDeadlineSeconds: 30 | ||
| successfulJobsHistoryLimit: 1 | ||
| failedJobsHistoryLimit: 1 | ||
| jobTemplate: | ||
| spec: | ||
| backoffLimit: 0 | ||
| activeDeadlineSeconds: 120 | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: cluster-heartbeat | ||
| platform-heartbeat: "true" | ||
| spec: | ||
| restartPolicy: Never | ||
| automountServiceAccountToken: false | ||
|
devantler marked this conversation as resolved.
|
||
| priorityClassName: platform-critical | ||
| securityContext: | ||
| runAsNonRoot: true | ||
| runAsUser: 65532 | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| containers: | ||
| - name: heartbeat | ||
| image: docker.io/curlimages/curl:8.21.0@sha256:7c12af72ceb38b7432ab85e1a265cff6ae58e06f95539d539b654f2cfa64bb13 | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| args: | ||
| - >- | ||
| printf 'url = "%s"\n' "$HEARTBEAT_URL" | | ||
| curl --config - -sf --max-time 10 | ||
| --retry 3 --retry-delay 2 --retry-all-errors --retry-connrefused | ||
| || true | ||
| env: | ||
| - name: HEARTBEAT_URL | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: cluster-heartbeat | ||
| key: url | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| readOnlyRootFilesystem: true | ||
| runAsNonRoot: true | ||
| runAsUser: 65532 | ||
| runAsGroup: 65532 | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| resources: | ||
| requests: | ||
| cpu: 5m | ||
| memory: 16Mi | ||
| limits: | ||
| cpu: 50m | ||
| memory: 32Mi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
| # The apps Flux layer depends on infrastructure. Keeping the heartbeat here | ||
| # ensures the scoped observability deny-policy replacement is ready before the | ||
| # purpose-labelled workload starts during an existing-cluster upgrade. | ||
| resources: | ||
| - cilium-network-policy.yaml | ||
| - cron-job.yaml | ||
| - secret.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: cluster-heartbeat | ||
| namespace: observability | ||
| type: Opaque | ||
| stringData: | ||
| # Flux substitutes the encrypted cluster variable here. The CronJob reads the | ||
| # resulting Secret so the bearer URL never appears in its PodSpec or argv. | ||
| url: "${cluster_heartbeat_url:=https://example.invalid/no-cluster-heartbeat-configured}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.