Skip to content

Commit

Permalink
Add node-problem-detector (#870)
Browse files Browse the repository at this point in the history
* Add node-problem-detector

Signed-off-by: Furkan <[email protected]>
Co-authored-by: Batuhan <[email protected]>

* refactor tests

Signed-off-by: Batuhan Apaydin <[email protected]>

---------

Signed-off-by: Furkan <[email protected]>
Signed-off-by: Batuhan Apaydin <[email protected]>
Co-authored-by: Batuhan <[email protected]>
  • Loading branch information
Dentrax and developer-guy authored Jul 6, 2023
1 parent 05954b7 commit 3bcc00a
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
| [newrelic](./images/newrelic) | `cgr.dev/chainguard/newrelic` | stable | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/newrelic.build.status.latest.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/newrelic:latest) |
| [nginx](./images/nginx) | `cgr.dev/chainguard/nginx` | stable | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/nginx.build.status.latest.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/nginx:latest) |
| [node](./images/node) | `cgr.dev/chainguard/node` | stable | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/node.build.status.18.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/node:18) |
| [node-problem-detector](./images/node-problem-detector) | `cgr.dev/chainguard/node-problem-detector` | stable | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/node-problem-detector.build.status.latest.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/node-problem-detector:latest) |
| [nodetaint](./images/nodetaint) | `cgr.dev/chainguard/nodetaint` | stable | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/nodetaint.build.status.latest.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/nodetaint:latest) |
| [ntpd-rs](./images/ntpd-rs) | `cgr.dev/chainguard/ntpd-rs` | experimental | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/ntpd-rs.build.status.latest.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/ntpd-rs:latest) |
| [nvidia-device-plugin](./images/nvidia-device-plugin) | `cgr.dev/chainguard/nvidia-device-plugin` | stable | [![](https://storage.googleapis.com/chainguard-images-build-outputs/badges/nvidia-device-plugin.build.status.latest.svg)](https://registry-ui.chainguard.app/?image=cgr.dev/chainguard/nvidia-device-plugin:latest) |
Expand Down
38 changes: 38 additions & 0 deletions images/node-problem-detector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--monopod:start-->
# node-problem-detector
| | |
| - | - |
| **Status** | stable |
| **OCI Reference** | `cgr.dev/chainguard/node-problem-detector` |


* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/node-problem-detector/overview/)
* [View Image Catalog](https://console.enforce.dev/images/catalog) for a full list of available tags.
*[Contact Chainguard](https://www.chainguard.dev/chainguard-images) for enterprise support, SLAs, and access to older tags.*

---
<!--monopod:end-->

[node-problem-detector](https://github.com/kubernetes/node-problem-detector) aims to make various node problems visible to the upstream layers in the cluster management stack.

## Get It!

The image is available on `cgr.dev`:

```
docker pull cgr.dev/chainguard/node-problem-detector
```

## Usage

Install via `helm` using the upstream source shown below:

```bash
helm repo add deliveryhero https://charts.deliveryhero.io/
helm upgrade --install npd deliveryhero/node-problem-detector \
--namespace node-problem-detector \
--create-namespace \
--set image.repository=cgr.dev/chainguard/node-problem-detector \
--set image.tag=latest
```

51 changes: 51 additions & 0 deletions images/node-problem-detector/configs/latest.apko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
contents:
packages:
- node-problem-detector
- node-problem-detector-compat
- health-checker
- log-counter

accounts:
groups:
- groupname: nonroot
gid: 65532
users:
- username: nonroot
uid: 65532
gid: 65532
run-as: 0

paths:
- path: /config
type: directory
uid: 65532
gid: 65532
permissions: 0o777
recursive: true
- path: /custom-config
type: directory
uid: 65532
gid: 65532
permissions: 0o777
recursive: true
- path: /var/log
type: directory
uid: 65532
gid: 65532
permissions: 0o777
recursive: true
- path: /dev
type: directory
uid: 65532
gid: 65532
permissions: 0o777
recursive: true

entrypoint:
command: /usr/bin/node-problem-detector
cmd: --config.system-log-monitor=/config/kernel-monitor.json

annotations:
"org.opencontainers.image.authors": "Chainguard Team https://www.chainguard.dev/"
"org.opencontainers.image.url": https://edu.chainguard.dev/chainguard/chainguard-images/reference/node-problem-detector/
"org.opencontainers.image.source": https://github.com/chainguard-images/images/tree/main/images/node-problem-detector
3 changes: 3 additions & 0 deletions images/node-problem-detector/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
- apko:
config: configs/latest.apko.yaml
55 changes: 55 additions & 0 deletions images/node-problem-detector/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
terraform {
required_providers {
apko = { source = "chainguard-dev/apko" }
oci = { source = "chainguard-dev/oci" }
}
}

variable "target_repository" {
description = "The docker repo into which the image and attestations should be published."
}

module "latest" {
source = "../../tflib/publisher"
target_repository = var.target_repository
config = file("${path.module}/configs/latest.apko.yaml")
}

module "dev" { source = "../../tflib/dev-subvariant" }

module "latest-dev" {
source = "../../tflib/publisher"

target_repository = var.target_repository
config = jsonencode(module.latest.config)
}

module "version-tags" {
source = "../../tflib/version-tags"
package = "node-problem-detector"
config = module.latest.config
}

module "test-latest" {
source = "./tests"
digest = module.latest.image_ref
}

module "test-latest-dev" {
source = "./tests"
digest = module.latest-dev.image_ref
}

module "tagger" {
source = "../../tflib/tagger"

depends_on = [
module.test-latest,
module.test-latest-dev,
]

tags = merge(
{ for t in toset(concat(["latest"], module.version-tags.tag_list)) : t => module.latest.image_ref },
{ for t in toset(concat(["latest"], module.version-tags.tag_list)) : "${t}-dev" => module.latest-dev.image_ref },
)
}
28 changes: 28 additions & 0 deletions images/node-problem-detector/tests/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
}
}

variable "digest" {
description = "The image digest to run tests over."
}

data "oci_string" "ref" { input = var.digest }

resource "random_pet" "suffix" {}

resource "helm_release" "node-problem-detector" {
name = "npd-${random_pet.suffix.id}"
repository = "https://charts.deliveryhero.io/"
chart = "node-problem-detector"
namespace = "npd-${random_pet.suffix.id}"
create_namespace = true

values = [jsonencode({
image = {
repository = data.oci_string.ref.registry_repo
tag = data.oci_string.ref.pseudo_tag
}
})]
}
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@ module "nodetaint" {
target_repository = "${var.target_repository}/nodetaint"
}

module "node-problem-detector" {
source = "./images/node-problem-detector"
target_repository = "${var.target_repository}/node-problem-detector"
}

module "ntpd-rs" {
source = "./images/ntpd-rs"
target_repository = "${var.target_repository}/ntpd-rs"
Expand Down

0 comments on commit 3bcc00a

Please sign in to comment.