diff --git a/images/node-feature-discovery/README.md b/images/node-feature-discovery/README.md new file mode 100644 index 0000000000..e6c9d099cb --- /dev/null +++ b/images/node-feature-discovery/README.md @@ -0,0 +1,54 @@ + +# node-feature-directory +| | | +| - | - | +| **OCI Reference** | `cgr.dev/chainguard/node-feature-directory` | + + +* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/node-feature-directory/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.* + +--- + + + +A minimal wolfi-based image for node-feature-discovery, Node feature discovery for Kubernetes + + + +## Download this Image +The image is available on `cgr.dev`: + +``` +docker pull cgr.dev/chainguard/node-feature-directory:latest +``` + + + +## Upstream documentation +For more information on grafana, refer to the [node-feature-discovery documentation](https://kubernetes-sigs.github.io/node-feature-discovery/stable/get-started/index.html). +Additionally the node-feature-discovery GitHub reposiory can be [found here](https://github.com/kubernetes-sigs/node-feature-discovery). + +## Helm +Node-feature-discovery can be deployed using the following helm chart: +- [https://artifacthub.io/packages/helm/node-feature-discovery/node-feature-discovery](https://artifacthub.io/packages/helm/node-feature-discovery/node-feature-discovery) + +Follow the instructions in the link above to deploy node-feature-discovery using helm. Note you +will need to override the default image and tag used, replacing with the +chainguard image, example: + +```bash +helm repo add node-feature-discovery https://kubernetes-sigs.github.io/node-feature-discovery/charts +helm repo update + +export NFD_NS=node-feature-discovery +helm install nfd/node-feature-discovery --namespace $NFD_NS --create-namespace --generate-name \ + --set image.repository=cgr.dev/chainguard/node-feature-discovery \ + --set image.tag=latest +``` + +Refer to the [helm chart documentation](https://artifacthub.io/packages/helm/node-feature-discovery/node-feature-discovery) +for full instructions on how to use the helm chart. + + diff --git a/images/node-feature-discovery/config/latest.apko.yaml b/images/node-feature-discovery/config/latest.apko.yaml new file mode 100644 index 0000000000..eabf303511 --- /dev/null +++ b/images/node-feature-discovery/config/latest.apko.yaml @@ -0,0 +1,15 @@ +contents: + packages: + +accounts: + groups: + - groupname: nonroot + gid: 65532 + users: + - username: nonroot + uid: 65532 + gid: 65532 + run-as: 65532 + +environment: + PATH: /usr/sbin:/sbin:/usr/bin:/bin \ No newline at end of file diff --git a/images/node-feature-discovery/config/main.tf b/images/node-feature-discovery/config/main.tf new file mode 100644 index 0000000000..dd177baf5b --- /dev/null +++ b/images/node-feature-discovery/config/main.tf @@ -0,0 +1,19 @@ +terraform { + required_providers { + apko = { source = "chainguard-dev/apko" } + } +} + +variable "extra_packages" { + description = "The additional packages to install" + default = ["node-feature-discovery"] +} + +data "apko_config" "this" { + config_contents = file("${path.module}/latest.apko.yaml") + extra_packages = var.extra_packages +} + +output "config" { + value = jsonencode(data.apko_config.this.config) +} diff --git a/images/node-feature-discovery/main.tf b/images/node-feature-discovery/main.tf new file mode 100644 index 0000000000..c865c277f4 --- /dev/null +++ b/images/node-feature-discovery/main.tf @@ -0,0 +1,37 @@ +terraform { + required_providers { + oci = { source = "chainguard-dev/oci" } + } +} + +variable "target_repository" { + description = "The docker repo into which the image and attestations should be published." +} + +module "latest-config" { source = "./config" } + +module "latest" { + source = "../../tflib/publisher" + name = basename(path.module) + target_repository = var.target_repository + config = module.latest-config.config + build-dev = true +} + +module "test-latest" { + source = "./tests" + digest = module.latest.image_ref +} + +resource "oci_tag" "latest" { + depends_on = [module.test-latest] + digest_ref = module.latest.image_ref + tag = "latest" +} + +resource "oci_tag" "latest-dev" { + depends_on = [module.test-latest] + digest_ref = module.latest.dev_ref + tag = "latest-dev" +} + diff --git a/images/node-feature-discovery/metadata.yaml b/images/node-feature-discovery/metadata.yaml new file mode 100644 index 0000000000..4bfcce432c --- /dev/null +++ b/images/node-feature-discovery/metadata.yaml @@ -0,0 +1,13 @@ +name: node-feature-directory +image: cgr.dev/chainguard/node-feature-directory +logo: https://storage.googleapis.com/chainguard-academy/logos/grafana.svg +endoflife: "" +console_summary: "" +short_description: A minimal wolfi-based image for node-feature-discovery, Node feature discovery for Kubernetes +compatibility_notes: "" +readme_file: README.md +upstream_url: https://github.com/grafana/https://github.com/kubernetes-sigs/node-feature-discovery +keywords: + - kubernetes + - application + - node-discovery diff --git a/images/node-feature-discovery/tests/main.tf b/images/node-feature-discovery/tests/main.tf new file mode 100644 index 0000000000..6f77e00a18 --- /dev/null +++ b/images/node-feature-discovery/tests/main.tf @@ -0,0 +1,69 @@ +terraform { + required_providers { + oci = { source = "chainguard-dev/oci" } + helm = { source = "hashicorp/helm" } + imagetest = { source = "chainguard-dev/imagetest" } + } +} + +variable "digest" { + description = "The image digest to run tests over." +} + +data "oci_string" "ref" { + input = var.digest +} + +data "imagetest_inventory" "this" {} + +resource "imagetest_harness_k3s" "this" { + name = "node-feature-discovery" + inventory = data.imagetest_inventory.this + + sandbox = { + mounts = [ + { + source = path.module + destination = "/tests" + } + ] + } +} + +module "helm_node-feature-discovery" { + source = "../../../tflib/imagetest/helm" + chart = "node-feature-discovery" + repo = "https://kubernetes-sigs.github.io/node-feature-discovery/charts" + name = "node-feature-discovery" + values = { + image = { + repository = data.oci_string.ref.registry_repo + tag = data.oci_string.ref.pseudo_tag + pullPolicy = "Always" + } + } +} + +resource "imagetest_feature" "test_labels" { + harness = imagetest_harness_k3s.this + name = "Test Labels" + description = "Basic functionality of the node-feature-discovery helm chart." + + steps = [ + { + name = "Helm install node-feature-discovery" + cmd = module.helm_node-feature-discovery.install_cmd + }, + { + name = "Ensure it has the necessary labels For CPU, Kernel and Storage" + cmd = <