From 0cfe03012b1fdd738c774939efeaad362b2154aa Mon Sep 17 00:00:00 2001 From: Adrian Chiris Date: Sun, 16 Feb 2020 17:22:07 +0200 Subject: [PATCH] Add new feature Source - Custom with stubbed implementation --- source/custom/custom.go | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 source/custom/custom.go diff --git a/source/custom/custom.go b/source/custom/custom.go new file mode 100644 index 000000000..bae3f15b7 --- /dev/null +++ b/source/custom/custom.go @@ -0,0 +1,47 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package custom + +import ( + "encoding/json" + + "sigs.k8s.io/node-feature-discovery/source" +) + +type MatchRule struct { +} + +type CustomFeature struct { + Name string `json:"name"` + MatchOn []MatchRule `json:"matchOn"` +} + +type NFDConfig []CustomFeature + +var Config = NFDConfig{} + +// Implements FeatureSource Interface +type Source struct{} + +// Return name of the feature source +func (s Source) Name() string { return "custom" } + +// Discover features +func (s Source) Discover() (source.Features, error) { + features := source.Features{} + return features, nil +}