1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-31 04:04:51 +00:00

NFD-Topology-Updater: Bump NRT API to version v0.0.12

The NodeResourceTopology API has been made cluster
scoped as in the current context a CR corresponds to
a Node and since Node is a cluster scoped resource it
makes sense to make NRT cluster scoped as well.

Ref: https://github.com/k8stopologyawareschedwg/noderesourcetopology-api/pull/18
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
This commit is contained in:
Swati Sehgal 2021-11-16 11:58:04 +00:00
parent cfc1c82746
commit b444ef95a8
10 changed files with 14 additions and 29 deletions

View file

@ -105,9 +105,6 @@ func initFlags(flagset *flag.FlagSet) *master.Args {
flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false, flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false,
"Verify worker node name against the worker's TLS certificate. "+ "Verify worker node name against the worker's TLS certificate. "+
"Only takes effect when TLS authentication has been enabled.") "Only takes effect when TLS authentication has been enabled.")
flagset.StringVar(&args.NRTNamespace, "nrt-namespace", "default",
"Namespace in which Node Resource Topology CR are created"+
"Ensure that the namespace specified is already exists.")
return args return args
} }

View file

@ -3,10 +3,9 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/1870 api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/1870
controller-gen.kubebuilder.io/version: v0.6.0 controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null creationTimestamp: null
name: noderesourcetopologies.topology.node.k8s.io name: noderesourcetopologies.topology.node.k8s.io
namespace: ""
spec: spec:
group: topology.node.k8s.io group: topology.node.k8s.io
names: names:
@ -16,7 +15,7 @@ spec:
shortNames: shortNames:
- node-res-topo - node-res-topo
singular: noderesourcetopology singular: noderesourcetopology
scope: Namespaced scope: Cluster
versions: versions:
- name: v1alpha1 - name: v1alpha1
schema: schema:

View file

@ -62,11 +62,6 @@ spec:
{{- if .Values.master.extraLabelNs | empty | not }} {{- if .Values.master.extraLabelNs | empty | not }}
- "--extra-label-ns={{- join "," .Values.master.extraLabelNs }}" - "--extra-label-ns={{- join "," .Values.master.extraLabelNs }}"
{{- end }} {{- end }}
{{- if .Values.master.topologyUpdaterNs | empty }}
- "--nrt-namespace={{ $.Release.Namespace }}"
{{- else }}
- "--nrt-namespace={{ .Values.master.topologyUpdaterNs }}"
{{- end }}
## Enable TLS authentication ## Enable TLS authentication
## The example below assumes having the root certificate named ca.crt stored in ## The example below assumes having the root certificate named ca.crt stored in
## a ConfigMap named nfd-ca-cert, and, the TLS authentication credentials stored ## a ConfigMap named nfd-ca-cert, and, the TLS authentication credentials stored

View file

@ -4,10 +4,9 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/1870 api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/1870
controller-gen.kubebuilder.io/version: v0.6.0 controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null creationTimestamp: null
name: noderesourcetopologies.topology.node.k8s.io name: noderesourcetopologies.topology.node.k8s.io
namespace: ""
spec: spec:
group: topology.node.k8s.io group: topology.node.k8s.io
names: names:
@ -17,7 +16,7 @@ spec:
shortNames: shortNames:
- node-res-topo - node-res-topo
singular: noderesourcetopology singular: noderesourcetopology
scope: Namespaced scope: Cluster
versions: versions:
- name: v1alpha1 - name: v1alpha1
schema: schema:

View file

@ -27,7 +27,6 @@ master:
podSecurityContext: {} podSecurityContext: {}
# fsGroup: 2000 # fsGroup: 2000
topologyUpdaterNs: ""
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
capabilities: capabilities:

View file

@ -184,8 +184,6 @@ Usage of nfd-master:
Comma separated list of labels to be exposed as extended resources. Comma separated list of labels to be exposed as extended resources.
-verify-node-name -verify-node-name
Verify worker node name against the worker's TLS certificate. Only takes effect when TLS authentication has been enabled. Verify worker node name against the worker's TLS certificate. Only takes effect when TLS authentication has been enabled.
-nrt-namespace
Namespace in which Node Resource Topology CR are created. Ensure that the namespace specified already exists
-version -version
Print version and exit. Print version and exit.
``` ```

View file

@ -298,7 +298,6 @@ We have introduced the following Chart parameters.
| `master.*` | dict | | NFD master deployment configuration | | `master.*` | dict | | NFD master deployment configuration |
| `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments | | `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments |
| `master.extraLabelNs` | array | [] | List of allowed extra label namespaces | | `master.extraLabelNs` | array | [] | List of allowed extra label namespaces |
| `master.topologyUpdaterNs` | string | "" | Namespace in which Node Resource Topology CR are created, the namespace specified must be already existed. |
| `master.replicaCount` | integer | 1 | Number of desired pods. This is a pointer to distinguish between explicit zero and not specified | | `master.replicaCount` | integer | 1 | Number of desired pods. This is a pointer to distinguish between explicit zero and not specified |
| `master.podSecurityContext` | dict | {} | SecurityContext holds pod-level security attributes and common container settings | | `master.podSecurityContext` | dict | {} | SecurityContext holds pod-level security attributes and common container settings |
| `master.service.type` | string | ClusterIP | NFD master service type | | `master.service.type` | string | ClusterIP | NFD master service type |

6
go.mod
View file

@ -8,7 +8,7 @@ require (
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5 github.com/google/go-cmp v0.5.5
github.com/jaypipes/ghw v0.8.1-0.20210827132705-c7224150a17e github.com/jaypipes/ghw v0.8.1-0.20210827132705-c7224150a17e
github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10 github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.12
github.com/klauspost/cpuid/v2 v2.0.9 github.com/klauspost/cpuid/v2 v2.0.9
github.com/onsi/ginkgo v1.14.0 github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1 github.com/onsi/gomega v1.10.1
@ -20,8 +20,8 @@ require (
google.golang.org/grpc v1.38.0 google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.27.1 google.golang.org/protobuf v1.27.1
k8s.io/api v0.22.0 k8s.io/api v0.22.0
k8s.io/apimachinery v0.22.0 k8s.io/apimachinery v0.22.3
k8s.io/client-go v0.22.0 k8s.io/client-go v0.22.3
k8s.io/klog/v2 v2.9.0 k8s.io/klog/v2 v2.9.0
k8s.io/kubelet v0.0.0 k8s.io/kubelet v0.0.0
k8s.io/kubernetes v1.22.0 k8s.io/kubernetes v1.22.0

4
go.sum
View file

@ -416,8 +416,8 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10 h1:wHS+TOQfFY67wkS1roZ5WVyihnE/IQmVsD0zzKtzHrU= github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.12 h1:NhXbOjO1st8hIcVpegr3zw/AGG12vs3z//tCDDcfPpE=
github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10/go.mod h1:yJo22okt35DQhvNw3Hgpaol6/oryET8Y5n1CJb9R5mM= github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.12/go.mod h1:AkACMQGiTgCt0lQw3m7TTU8PLH9lYKNK5e9DqFf5VuM=
github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=

View file

@ -94,7 +94,6 @@ type Args struct {
Prune bool Prune bool
VerifyNodeName bool VerifyNodeName bool
ResourceLabels utils.StringSetVal ResourceLabels utils.StringSetVal
NRTNamespace string
} }
type NfdMaster interface { type NfdMaster interface {
@ -447,7 +446,7 @@ func (m *nfdMaster) UpdateNodeTopology(c context.Context, r *topologypb.NodeTopo
klog.Infof("received CR updation request for node %q", r.NodeName) klog.Infof("received CR updation request for node %q", r.NodeName)
} }
if !m.args.NoPublish { if !m.args.NoPublish {
err := m.updateCR(r.NodeName, r.TopologyPolicies, r.Zones, m.args.NRTNamespace) err := m.updateCR(r.NodeName, r.TopologyPolicies, r.Zones)
if err != nil { if err != nil {
klog.Errorf("failed to advertise NodeResourceTopology: %w", err) klog.Errorf("failed to advertise NodeResourceTopology: %w", err)
return &topologypb.NodeTopologyResponse{}, err return &topologypb.NodeTopologyResponse{}, err
@ -642,7 +641,7 @@ func modifyCR(topoUpdaterZones []*v1alpha1.Zone) []v1alpha1.Zone {
return zones return zones
} }
func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZones []*v1alpha1.Zone, namespace string) error { func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZones []*v1alpha1.Zone) error {
cli, err := m.apihelper.GetTopologyClient() cli, err := m.apihelper.GetTopologyClient()
if err != nil { if err != nil {
return err return err
@ -650,7 +649,7 @@ func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZone
zones := modifyCR(topoUpdaterZones) zones := modifyCR(topoUpdaterZones)
nrt, err := cli.TopologyV1alpha1().NodeResourceTopologies(namespace).Get(context.TODO(), hostname, metav1.GetOptions{}) nrt, err := cli.TopologyV1alpha1().NodeResourceTopologies().Get(context.TODO(), hostname, metav1.GetOptions{})
if errors.IsNotFound(err) { if errors.IsNotFound(err) {
nrtNew := v1alpha1.NodeResourceTopology{ nrtNew := v1alpha1.NodeResourceTopology{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
@ -660,7 +659,7 @@ func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZone
TopologyPolicies: tmpolicy, TopologyPolicies: tmpolicy,
} }
_, err := cli.TopologyV1alpha1().NodeResourceTopologies(namespace).Create(context.TODO(), &nrtNew, metav1.CreateOptions{}) _, err := cli.TopologyV1alpha1().NodeResourceTopologies().Create(context.TODO(), &nrtNew, metav1.CreateOptions{})
if err != nil { if err != nil {
return fmt.Errorf("failed to create v1alpha1.NodeResourceTopology!:%w", err) return fmt.Errorf("failed to create v1alpha1.NodeResourceTopology!:%w", err)
} }
@ -672,7 +671,7 @@ func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZone
nrtMutated := nrt.DeepCopy() nrtMutated := nrt.DeepCopy()
nrtMutated.Zones = zones nrtMutated.Zones = zones
nrtUpdated, err := cli.TopologyV1alpha1().NodeResourceTopologies(namespace).Update(context.TODO(), nrtMutated, metav1.UpdateOptions{}) nrtUpdated, err := cli.TopologyV1alpha1().NodeResourceTopologies().Update(context.TODO(), nrtMutated, metav1.UpdateOptions{})
if err != nil { if err != nil {
return fmt.Errorf("failed to update v1alpha1.NodeResourceTopology!:%w", err) return fmt.Errorf("failed to update v1alpha1.NodeResourceTopology!:%w", err)
} }