mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
source: allow multi-type features
Allow multiple types of features (flags, attributes, instances) under the same name.
This commit is contained in:
parent
3b448ae623
commit
bb565c0949
1 changed files with 0 additions and 9 deletions
|
@ -164,25 +164,16 @@ func GetAllFeatures() *nfdv1alpha1.Features {
|
||||||
for k, v := range f.Flags {
|
for k, v := range f.Flags {
|
||||||
// Prefix feature with the name of the source
|
// Prefix feature with the name of the source
|
||||||
k = n + "." + k
|
k = n + "." + k
|
||||||
if typ := features.Exists(k); typ != "" {
|
|
||||||
panic(fmt.Sprintf("feature source %q returned flag feature %q which already exists (type %q)", n, k, typ))
|
|
||||||
}
|
|
||||||
features.Flags[k] = v
|
features.Flags[k] = v
|
||||||
}
|
}
|
||||||
for k, v := range f.Attributes {
|
for k, v := range f.Attributes {
|
||||||
// Prefix feature with the name of the source
|
// Prefix feature with the name of the source
|
||||||
k = n + "." + k
|
k = n + "." + k
|
||||||
if typ := features.Exists(k); typ != "" {
|
|
||||||
panic(fmt.Sprintf("feature source %q returned attribute feature %q which already exists (type %q)", n, k, typ))
|
|
||||||
}
|
|
||||||
features.Attributes[k] = v
|
features.Attributes[k] = v
|
||||||
}
|
}
|
||||||
for k, v := range f.Instances {
|
for k, v := range f.Instances {
|
||||||
// Prefix feature with the name of the source
|
// Prefix feature with the name of the source
|
||||||
k = n + "." + k
|
k = n + "." + k
|
||||||
if typ := features.Exists(k); typ != "" {
|
|
||||||
panic(fmt.Sprintf("feature source %q returned instance feature %q which already exists (type %q)", n, k, typ))
|
|
||||||
}
|
|
||||||
features.Instances[k] = v
|
features.Instances[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue