Skip to content

Commit

Permalink
support node feature discovery (#10861)
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Yan <[email protected]>
  • Loading branch information
yankay authored Mar 5, 2024
1 parent 04e40f2 commit 90b0151
Show file tree
Hide file tree
Showing 22 changed files with 916 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ Note: Upstart/SysV init based OS types are not supported.
- [gcp-pd-csi-plugin](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver) v1.9.2
- [local-path-provisioner](https://github.com/rancher/local-path-provisioner) v0.0.24
- [local-volume-provisioner](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner) v2.5.0
- [node-feature-discovery](https://github.com/kubernetes-sigs/node-feature-discovery) v0.14.2

## Container Runtime Notes

Expand Down
9 changes: 9 additions & 0 deletions inventory/sample/group_vars/k8s_cluster/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,12 @@ kube_vip_enabled: false
# port: 6443
# kube_vip_interface: eth0
# kube_vip_services_enabled: false

# Node Feature Discovery
node_feature_discovery_enabled: false
# node_feature_discovery_gc_sa_name: node-feature-discovery
# node_feature_discovery_gc_sa_create: false
# node_feature_discovery_worker_sa_name: node-feature-discovery
# node_feature_discovery_worker_sa_create: false
# node_feature_discovery_master_config:
# extraLabelNs: ["nvidia.com"]
7 changes: 7 additions & 0 deletions roles/kubernetes-apps/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,10 @@ dependencies:
- inventory_hostname == groups['kube_control_plane'][0]
tags:
- scheduler_plugins

- role: kubernetes-apps/node_feature_discovery
when:
- node_feature_discovery_enabled
- inventory_hostname == groups['kube_control_plane'][0]
tags:
- node_feature_discovery
16 changes: 16 additions & 0 deletions roles/kubernetes-apps/node_feature_discovery/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
node_feature_discovery_enabled: false
node_feature_discovery_namespace: node-feature-discovery
node_feature_discovery_enable_nodefeature_api: true
node_feature_discovery_gc_replicas: 1
node_feature_discovery_gc_interval: 1h
node_feature_discovery_gc_sa_name: node-feature-discovery-gc
node_feature_discovery_gc_sa_create: true
node_feature_discovery_master_replicas: 1
node_feature_discovery_master_crd_controller: null
node_feature_discovery_master_instance: null
node_feature_discovery_master_config: null
node_feature_discovery_worker_sa_name: node-feature-discovery-worker
node_feature_discovery_worker_sa_create: true
node_feature_discovery_worker_config: null
node_feature_discovery_worker_tolerations: null
49 changes: 49 additions & 0 deletions roles/kubernetes-apps/node_feature_discovery/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
- name: Node Feature Discovery | Create addon dir
file:
path: "{{ kube_config_dir }}/addons/node_feature_discovery"
state: directory
owner: root
group: root
mode: 0755
when:
- inventory_hostname == groups['kube_control_plane'][0]

- name: Node Feature Discovery | Templates list
set_fact:
node_feature_discovery_templates:
- { name: nfd-ns, file: nfd-ns.yaml, type: ns }
- { name: nfd-api-crd, file: nfd-api-crds.yaml, type: crd }
- { name: nfd-serviceaccount, file: nfd-serviceaccount.yaml, type: sa }
- { name: nfd-role, file: nfd-role.yaml, type: role }
- { name: nfd-clusterrole, file: nfd-clusterrole.yaml, type: clusterrole }
- { name: nfd-rolebinding, file: nfd-rolebinding.yaml, type: rolebinding }
- { name: nfd-clusterrolebinding, file: nfd-clusterrolebinding.yaml, type: clusterrolebinding }
- { name: nfd-master-conf, file: nfd-master-conf.yaml, type: cm }
- { name: nfd-worker-conf, file: nfd-worker-conf.yaml, type: cm }
- { name: nfd-topologyupdater-conf, file: nfd-topologyupdater-conf.yaml, type: cm }
- { name: nfd-gc, file: nfd-gc.yaml, type: deploy }
- { name: nfd-master, file: nfd-master.yaml, type: deploy }
- { name: nfd-worker, file: nfd-worker.yaml, type: ds }
- { name: nfd-service, file: nfd-service.yaml, type: srv }

- name: Node Feature Discovery | Create manifests
template:
src: "{{ item.file }}.j2"
dest: "{{ kube_config_dir }}/addons/node_feature_discovery/{{ item.file }}"
mode: 0644
with_items: "{{ node_feature_discovery_templates }}"
register: node_feature_discovery_manifests
when:
- inventory_hostname == groups['kube_control_plane'][0]

- name: Node Feature Discovery | Apply manifests
kube:
name: "{{ item.item.name }}"
kubectl: "{{ bin_dir }}/kubectl"
resource: "{{ item.item.type }}"
filename: "{{ kube_config_dir }}/addons/node_feature_discovery/{{ item.item.file }}"
state: "latest"
with_items: "{{ node_feature_discovery_manifests.results }}"
when:
- inventory_hostname == groups['kube_control_plane'][0]
Loading

0 comments on commit 90b0151

Please sign in to comment.