Review feedback for Labeller

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2022-01-19 18:13:05 +00:00
parent a2ea804d2c
commit 8003748b73
2 changed files with 20 additions and 16 deletions

View File

@ -2,17 +2,24 @@ package provider
import "context"
// Labeller can return labels for a namespace from containerd.
type Labeller interface {
Labels(ctx context.Context, namespace string) (map[string]string, error)
}
/*
* FakeLabeller can be used to fake labels applied on namespace to mark them valid/invalid for openfaas functions
*/
//
// FakeLabeller can be used to fake labels applied on namespace to mark
// them valid/invalid for openfaas functions
type FakeLabeller struct {
FakeLabels map[string]string
labels map[string]string
}
func NewFakeLabeller(labels map[string]string) Labeller {
return &FakeLabeller{
labels: labels,
}
}
func (s *FakeLabeller) Labels(ctx context.Context, namespace string) (map[string]string, error) {
return s.FakeLabels, nil
return s.labels, nil
}