Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: public Builder compatibility with the BuilderInterface #1994

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import (
"k8s.io/kube-state-metrics/v2/pkg/options"
)

// Make sure the public Builder implements the public BuilderInterface.
// New internal Builder methods should be added to the public BuilderInterface.
var _ ksmtypes.BuilderInterface = &Builder{}
clamoriniere marked this conversation as resolved.
Show resolved Hide resolved

// Builder helps to build store. It follows the builder pattern
// (https://en.wikipedia.org/wiki/Builder_pattern).
type Builder struct {
Expand Down Expand Up @@ -61,6 +65,11 @@ func (b *Builder) WithNamespaces(n options.NamespaceList) {
b.internal.WithNamespaces(n)
}

// WithFieldSelectorFilter sets the fieldSelector property of a Builder.
func (b *Builder) WithFieldSelectorFilter(fieldSelectorFilter string) {
b.internal.WithFieldSelectorFilter(fieldSelectorFilter)
}

// WithSharding sets the shard and totalShards property of a Builder.
func (b *Builder) WithSharding(shard int32, totalShards int) {
b.internal.WithSharding(shard, totalShards)
Expand Down Expand Up @@ -103,8 +112,8 @@ func (b *Builder) WithAllowAnnotations(annotations map[string][]string) {
}

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

// WithGenerateStoresFunc configures a custom generate store function
Expand Down