Skip to content

Commit

Permalink
Merge pull request #1514 from ahmed-mez/master
Browse files Browse the repository at this point in the history
Add `WithAllowLabels` to public `BuilderInterface`
  • Loading branch information
k8s-ci-robot authored Jun 29, 2021
2 parents d94da52 + 10460d7 commit 7594278
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/store/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ import (
"k8s.io/kube-state-metrics/v2/pkg/watch"
)

// Make sure the internal Builder implements the public BuilderInterface.
// New Builder methods should be added to the public BuilderInterface.
var _ ksmtypes.BuilderInterface = &Builder{}

// Builder helps to build store. It follows the builder pattern
// (https://en.wikipedia.org/wiki/Builder_pattern).
type Builder struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ func (b *Builder) WithAllowDenyList(l ksmtypes.AllowDenyLister) {
b.internal.WithAllowDenyList(l)
}

// WithAllowLabels configures which labels can be returned for metrics
func (b *Builder) WithAllowLabels(l map[string][]string) {
b.internal.WithAllowLabels(l)
}

// WithGenerateStoreFunc configures a custom generate store function
func (b *Builder) WithGenerateStoreFunc(f ksmtypes.BuildStoreFunc) {
b.internal.WithGenerateStoreFunc(f)
Expand Down
1 change: 1 addition & 0 deletions pkg/builder/types/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type BuilderInterface interface {
WithVPAClient(c vpaclientset.Interface)
WithAllowDenyList(l AllowDenyLister)
WithGenerateStoreFunc(f BuildStoreFunc)
WithAllowLabels(l map[string][]string)
DefaultGenerateStoreFunc() BuildStoreFunc
Build() []cache.Store
}
Expand Down

0 comments on commit 7594278

Please sign in to comment.