Skip to content

Commit

Permalink
Merge pull request #652 from k8stopologyawareschedwg/consume-cluster-…
Browse files Browse the repository at this point in the history
…scoped-api

NFD-Topology-Updater: Bump NRT API to version v0.0.12
  • Loading branch information
k8s-ci-robot authored Nov 16, 2021
2 parents fd7c7e5 + b444ef9 commit c29ab3b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 29 deletions.
3 changes: 0 additions & 3 deletions cmd/nfd-master/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ func initFlags(flagset *flag.FlagSet) *master.Args {
flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false,
"Verify worker node name against the worker's TLS certificate. "+
"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
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
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
name: noderesourcetopologies.topology.node.k8s.io
namespace: ""
spec:
group: topology.node.k8s.io
names:
Expand All @@ -16,7 +15,7 @@ spec:
shortNames:
- node-res-topo
singular: noderesourcetopology
scope: Namespaced
scope: Cluster
versions:
- name: v1alpha1
schema:
Expand Down
5 changes: 0 additions & 5 deletions deployment/helm/node-feature-discovery/templates/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ spec:
{{- if .Values.master.extraLabelNs | empty | not }}
- "--extra-label-ns={{- join "," .Values.master.extraLabelNs }}"
{{- end }}
{{- if .Values.master.topologyUpdaterNs | empty }}
- "--nrt-namespace={{ $.Release.Namespace }}"
{{- else }}
- "--nrt-namespace={{ .Values.master.topologyUpdaterNs }}"
{{- end }}
## Enable TLS authentication
## 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
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
name: noderesourcetopologies.topology.node.k8s.io
namespace: ""
spec:
group: topology.node.k8s.io
names:
Expand All @@ -17,7 +16,7 @@ spec:
shortNames:
- node-res-topo
singular: noderesourcetopology
scope: Namespaced
scope: Cluster
versions:
- name: v1alpha1
schema:
Expand Down
1 change: 0 additions & 1 deletion deployment/helm/node-feature-discovery/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ master:
podSecurityContext: {}
# fsGroup: 2000

topologyUpdaterNs: ""
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
2 changes: 0 additions & 2 deletions docs/advanced/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ Usage of nfd-master:
Comma separated list of labels to be exposed as extended resources.
-verify-node-name
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
Print version and exit.
```
Expand Down
1 change: 0 additions & 1 deletion docs/get-started/deployment-and-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ We have introduced the following Chart parameters.
| `master.*` | dict | | NFD master deployment configuration |
| `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments |
| `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.podSecurityContext` | dict | {} | SecurityContext holds pod-level security attributes and common container settings |
| `master.service.type` | string | ClusterIP | NFD master service type |
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5
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/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1
Expand All @@ -20,8 +20,8 @@ require (
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.27.1
k8s.io/api v0.22.0
k8s.io/apimachinery v0.22.0
k8s.io/client-go v0.22.0
k8s.io/apimachinery v0.22.3
k8s.io/client-go v0.22.3
k8s.io/klog/v2 v2.9.0
k8s.io/kubelet v0.0.0
k8s.io/kubernetes v1.22.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.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/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10 h1:wHS+TOQfFY67wkS1roZ5WVyihnE/IQmVsD0zzKtzHrU=
github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10/go.mod h1:yJo22okt35DQhvNw3Hgpaol6/oryET8Y5n1CJb9R5mM=
github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.12 h1:NhXbOjO1st8hIcVpegr3zw/AGG12vs3z//tCDDcfPpE=
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/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand Down
11 changes: 5 additions & 6 deletions pkg/nfd-master/nfd-master.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ type Args struct {
Prune bool
VerifyNodeName bool
ResourceLabels utils.StringSetVal
NRTNamespace string
}

type NfdMaster interface {
Expand Down Expand Up @@ -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)
}
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 {
klog.Errorf("failed to advertise NodeResourceTopology: %w", err)
return &topologypb.NodeTopologyResponse{}, err
Expand Down Expand Up @@ -642,15 +641,15 @@ func modifyCR(topoUpdaterZones []*v1alpha1.Zone) []v1alpha1.Zone {
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()
if err != nil {
return err
}

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) {
nrtNew := v1alpha1.NodeResourceTopology{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -660,7 +659,7 @@ func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZone
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 {
return fmt.Errorf("failed to create v1alpha1.NodeResourceTopology!:%w", err)
}
Expand All @@ -672,7 +671,7 @@ func (m *nfdMaster) updateCR(hostname string, tmpolicy []string, topoUpdaterZone
nrtMutated := nrt.DeepCopy()
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 {
return fmt.Errorf("failed to update v1alpha1.NodeResourceTopology!:%w", err)
}
Expand Down

0 comments on commit c29ab3b

Please sign in to comment.