From 6cf29bd8eff5185ebfc8521c4b796782e92a5b3e Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 18 Aug 2023 12:49:20 +0300 Subject: [PATCH] deployment/kustomize: support nfd-gc Rename the old "topology-gc" to just "gc". Simplify the setup a bit by including the RBAC rules in the "gc" base. Note: we don't enable nfd-gc in the default overlay, yet, as the NodeFeature API isn't enabled (gc is not needed). --- .../gc-clusterrole.yaml} | 9 ++++++++- .../gc-clusterrolebinding.yaml} | 6 +++--- .../gc-serviceaccount.yaml} | 2 +- .../{topology-gc/topology-gc.yaml => gc/gc.yaml} | 12 ++++++------ .../base/{topology-gc => gc}/kustomization.yaml | 5 ++++- deployment/base/rbac-topology-gc/kustomization.yaml | 9 --------- .../master-worker-topologyupdater/kustomization.yaml | 3 +-- .../overlays/topologyupdater/kustomization.yaml | 3 +-- 8 files changed, 24 insertions(+), 25 deletions(-) rename deployment/base/{rbac-topology-gc/topology-gc-clusterrole.yaml => gc/gc-clusterrole.yaml} (74%) rename deployment/base/{rbac-topology-gc/topology-gc-clusterrolebinding.yaml => gc/gc-clusterrolebinding.yaml} (73%) rename deployment/base/{rbac-topology-gc/topology-gc-serviceaccount.yaml => gc/gc-serviceaccount.yaml} (65%) rename deployment/base/{topology-gc/topology-gc.yaml => gc/gc.yaml} (64%) rename deployment/base/{topology-gc => gc}/kustomization.yaml (56%) delete mode 100644 deployment/base/rbac-topology-gc/kustomization.yaml diff --git a/deployment/base/rbac-topology-gc/topology-gc-clusterrole.yaml b/deployment/base/gc/gc-clusterrole.yaml similarity index 74% rename from deployment/base/rbac-topology-gc/topology-gc-clusterrole.yaml rename to deployment/base/gc/gc-clusterrole.yaml index c0f431444..d4e776c2f 100644 --- a/deployment/base/rbac-topology-gc/topology-gc-clusterrole.yaml +++ b/deployment/base/gc/gc-clusterrole.yaml @@ -1,7 +1,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: nfd-topology-gc + name: nfd-gc rules: - apiGroups: - "" @@ -23,3 +23,10 @@ rules: verbs: - delete - list +- apiGroups: + - nfd.k8s-sigs.io + resources: + - nodefeatures + verbs: + - delete + - list diff --git a/deployment/base/rbac-topology-gc/topology-gc-clusterrolebinding.yaml b/deployment/base/gc/gc-clusterrolebinding.yaml similarity index 73% rename from deployment/base/rbac-topology-gc/topology-gc-clusterrolebinding.yaml rename to deployment/base/gc/gc-clusterrolebinding.yaml index b8615d63c..a0f40b6ed 100644 --- a/deployment/base/rbac-topology-gc/topology-gc-clusterrolebinding.yaml +++ b/deployment/base/gc/gc-clusterrolebinding.yaml @@ -1,12 +1,12 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: nfd-topology-gc + name: nfd-gc roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: nfd-topology-gc + name: nfd-gc subjects: - kind: ServiceAccount - name: nfd-topology-gc + name: nfd-gc namespace: default diff --git a/deployment/base/rbac-topology-gc/topology-gc-serviceaccount.yaml b/deployment/base/gc/gc-serviceaccount.yaml similarity index 65% rename from deployment/base/rbac-topology-gc/topology-gc-serviceaccount.yaml rename to deployment/base/gc/gc-serviceaccount.yaml index e56f7bbef..ec9501a89 100644 --- a/deployment/base/rbac-topology-gc/topology-gc-serviceaccount.yaml +++ b/deployment/base/gc/gc-serviceaccount.yaml @@ -1,4 +1,4 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: nfd-topology-gc + name: nfd-gc diff --git a/deployment/base/topology-gc/topology-gc.yaml b/deployment/base/gc/gc.yaml similarity index 64% rename from deployment/base/topology-gc/topology-gc.yaml rename to deployment/base/gc/gc.yaml index 07565e3a0..bbae4aa5c 100644 --- a/deployment/base/topology-gc/topology-gc.yaml +++ b/deployment/base/gc/gc.yaml @@ -3,21 +3,21 @@ kind: Deployment metadata: labels: app: nfd - name: nfd-topology-gc + name: nfd-gc spec: selector: matchLabels: - app: nfd-topology-gc + app: nfd-gc template: metadata: labels: - app: nfd-topology-gc + app: nfd-gc spec: dnsPolicy: ClusterFirstWithHostNet - serviceAccount: nfd-topology-gc + serviceAccount: nfd-gc containers: - - name: nfd-topology-gc + - name: nfd-gc image: gcr.io/k8s-staging-nfd/node-feature-discovery:master imagePullPolicy: Always command: - - "nfd-topology-gc" + - "nfd-gc" diff --git a/deployment/base/topology-gc/kustomization.yaml b/deployment/base/gc/kustomization.yaml similarity index 56% rename from deployment/base/topology-gc/kustomization.yaml rename to deployment/base/gc/kustomization.yaml index 3d8da69b6..855c0a1a4 100644 --- a/deployment/base/topology-gc/kustomization.yaml +++ b/deployment/base/gc/kustomization.yaml @@ -4,4 +4,7 @@ kind: Kustomization namespace: node-feature-discovery resources: -- topology-gc.yaml +- gc-clusterrole.yaml +- gc-clusterrolebinding.yaml +- gc-serviceaccount.yaml +- gc.yaml diff --git a/deployment/base/rbac-topology-gc/kustomization.yaml b/deployment/base/rbac-topology-gc/kustomization.yaml deleted file mode 100644 index d0105ebc0..000000000 --- a/deployment/base/rbac-topology-gc/kustomization.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: node-feature-discovery - -resources: -- topology-gc-clusterrole.yaml -- topology-gc-clusterrolebinding.yaml -- topology-gc-serviceaccount.yaml diff --git a/deployment/overlays/master-worker-topologyupdater/kustomization.yaml b/deployment/overlays/master-worker-topologyupdater/kustomization.yaml index 19fa1bfcc..15f72bb5c 100644 --- a/deployment/overlays/master-worker-topologyupdater/kustomization.yaml +++ b/deployment/overlays/master-worker-topologyupdater/kustomization.yaml @@ -6,13 +6,12 @@ namespace: node-feature-discovery resources: - ../../base/rbac - ../../base/rbac-topologyupdater -- ../../base/rbac-topology-gc - ../../base/nfd-crds - ../../base/master - ../../base/worker-daemonset - ../../base/noderesourcetopologies-crd - ../../base/topologyupdater-daemonset -- ../../base/topology-gc +- ../../base/gc - namespace.yaml components: diff --git a/deployment/overlays/topologyupdater/kustomization.yaml b/deployment/overlays/topologyupdater/kustomization.yaml index e001d62ad..f78d505ca 100644 --- a/deployment/overlays/topologyupdater/kustomization.yaml +++ b/deployment/overlays/topologyupdater/kustomization.yaml @@ -5,10 +5,9 @@ namespace: node-feature-discovery resources: - ../../base/rbac-topologyupdater -- ../../base/rbac-topology-gc - ../../base/noderesourcetopologies-crd - ../../base/topologyupdater-daemonset -- ../../base/topology-gc +- ../../base/gc - namespace.yaml components: