From 08ab59c5944a91b3d647ed3b4b951c760d52ca20 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Thu, 13 Jan 2022 23:23:19 +0100
Subject: [PATCH] feat(node-features): Add node feature discovery

This patch adds NFD (Node Feature Discovery) which will provide various
additional labels on the nodes to use them for better node selector
statements. This should help to future-proof the setup.

References:
https://kubernetes-sigs.github.io/node-feature-discovery/v0.10/get-started/introduction.html
---
 infrastructure/kustomization.yaml             |  1 +
 .../node-features/kustomization.yaml          |  7 ++++++
 infrastructure/node-features/namespace.yaml   |  7 ++++++
 infrastructure/node-features/release.yaml     | 23 +++++++++++++++++++
 infrastructure/node-features/repository.yaml  |  7 ++++++
 5 files changed, 45 insertions(+)
 create mode 100644 infrastructure/node-features/kustomization.yaml
 create mode 100644 infrastructure/node-features/namespace.yaml
 create mode 100644 infrastructure/node-features/release.yaml
 create mode 100644 infrastructure/node-features/repository.yaml

diff --git a/infrastructure/kustomization.yaml b/infrastructure/kustomization.yaml
index 1957d4935..ccd7ac76c 100644
--- a/infrastructure/kustomization.yaml
+++ b/infrastructure/kustomization.yaml
@@ -8,3 +8,4 @@ resources:
   - cert-manager
   - prometheus
   - ingress-nginx
+  - node-features
diff --git a/infrastructure/node-features/kustomization.yaml b/infrastructure/node-features/kustomization.yaml
new file mode 100644
index 000000000..6b558abcc
--- /dev/null
+++ b/infrastructure/node-features/kustomization.yaml
@@ -0,0 +1,7 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+namespace: node-features-system
+resources:
+  - namespace.yaml
+  - repository.yaml
+  - release.yaml
diff --git a/infrastructure/node-features/namespace.yaml b/infrastructure/node-features/namespace.yaml
new file mode 100644
index 000000000..2d112c5bb
--- /dev/null
+++ b/infrastructure/node-features/namespace.yaml
@@ -0,0 +1,7 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: node-features-system
+  labels:
+    name: node-features-system
+    kyverno.shivering-isles.com/class: "system"
diff --git a/infrastructure/node-features/release.yaml b/infrastructure/node-features/release.yaml
new file mode 100644
index 000000000..9b6fc2596
--- /dev/null
+++ b/infrastructure/node-features/release.yaml
@@ -0,0 +1,23 @@
+apiVersion: helm.toolkit.fluxcd.io/v2beta1
+kind: HelmRelease
+metadata:
+  name: node-feature-discovery
+  namespace: node-features-system
+spec:
+  releaseName: node-feature-discovery
+  chart:
+    spec:
+      chart: node-feature-discovery
+      sourceRef:
+        kind: HelmRepository
+        name: node-feature-discovery
+      version: 0.10.0
+  interval: 5m
+  values:
+    tls:
+      enable: true
+      certManager: true
+  install:
+    crds: CreateReplace
+  upgrade:
+    crds: CreateReplace
diff --git a/infrastructure/node-features/repository.yaml b/infrastructure/node-features/repository.yaml
new file mode 100644
index 000000000..2777542a9
--- /dev/null
+++ b/infrastructure/node-features/repository.yaml
@@ -0,0 +1,7 @@
+apiVersion: source.toolkit.fluxcd.io/v1beta1
+kind: HelmRepository
+metadata:
+  name: node-feature-discovery
+spec:
+  interval: 30m
+  url: https://kubernetes-sigs.github.io/node-feature-discovery/charts
-- 
GitLab