Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions bucketbroker/client/config/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ package config
import (
"os"

brokerconfig "github.com/ironcore-dev/brokers/common/client/config"
"github.com/ironcore-dev/ironcore/utils/client/config"
configutils "github.com/ironcore-dev/controller-utils/configutils"
"k8s.io/apiserver/pkg/server/egressselector"
ctrl "sigs.k8s.io/controller-runtime"
)

var log = ctrl.Log.WithName("client").WithName("config")

func NewGetter() (*brokerconfig.BrokerGetter, error) {
return brokerconfig.NewBrokerGetter(config.GetterOptions{
func NewGetter() (*configutils.Getter, error) {
return configutils.NewGetter(configutils.GetterOptions{
Name: "bucketbroker",
NetworkContext: egressselector.ControlPlane.AsNetworkContext(),
})
}

func NewGetterOrDie() *brokerconfig.BrokerGetter {
func NewGetterOrDie() *configutils.Getter {
getter, err := NewGetter()
if err != nil {
log.Error(err, "Error creating getter")
Expand Down
13 changes: 12 additions & 1 deletion bucketbroker/cmd/bucketbroker/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (

bucketbrokerconfig "github.com/ironcore-dev/brokers/bucketbroker/client/config"
"github.com/ironcore-dev/brokers/bucketbroker/server"
configutils "github.com/ironcore-dev/controller-utils/configutils"

"github.com/ironcore-dev/brokers/common"
iri "github.com/ironcore-dev/ironcore/iri/apis/bucket/v1alpha1"
"github.com/ironcore-dev/ironcore/utils/client/config"
Expand Down Expand Up @@ -83,7 +85,16 @@ func Run(ctx context.Context, opts Options) error {
return fmt.Errorf("error creating new getter: %w", err)
}

cfg, err := getter.GetConfig(ctx, &opts.GetConfigOptions)
getConfigOptions := &configutils.GetConfigOptions{
Context: opts.GetConfigOptions.Context,
EgressSelectorConfig: opts.GetConfigOptions.EgressSelectorConfig,
QPS: opts.GetConfigOptions.QPS,
Burst: opts.GetConfigOptions.Burst,
}
if opts.GetConfigOptions.Kubeconfig != "" {
getConfigOptions.Kubeconfig = &opts.GetConfigOptions.Kubeconfig
}
cfg, err := getter.GetConfig(ctx, getConfigOptions)
if err != nil {
return fmt.Errorf("error getting config: %w", err)
}
Expand Down
81 changes: 0 additions & 81 deletions common/client/config/config.go

This file was deleted.

9 changes: 4 additions & 5 deletions machinebroker/client/config/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ package config
import (
"os"

brokerconfig "github.com/ironcore-dev/brokers/common/client/config"
"github.com/ironcore-dev/ironcore/utils/client/config"
configutils "github.com/ironcore-dev/controller-utils/configutils"
"k8s.io/apiserver/pkg/server/egressselector"
ctrl "sigs.k8s.io/controller-runtime"
)

var log = ctrl.Log.WithName("client").WithName("config")

func NewGetter() (*brokerconfig.BrokerGetter, error) {
return brokerconfig.NewBrokerGetter(config.GetterOptions{
func NewGetter() (*configutils.Getter, error) {
return configutils.NewGetter(configutils.GetterOptions{
Name: "machinebroker",
NetworkContext: egressselector.ControlPlane.AsNetworkContext(),
})
}

func NewGetterOrDie() *brokerconfig.BrokerGetter {
func NewGetterOrDie() *configutils.Getter {
getter, err := NewGetter()
if err != nil {
log.Error(err, "Error creating getter")
Expand Down
12 changes: 11 additions & 1 deletion machinebroker/cmd/machinebroker/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
mchinebrokerconfig "github.com/ironcore-dev/brokers/machinebroker/client/config"
machinebrokerhttp "github.com/ironcore-dev/brokers/machinebroker/http"
"github.com/ironcore-dev/brokers/machinebroker/server"
configutils "github.com/ironcore-dev/controller-utils/configutils"
iri "github.com/ironcore-dev/ironcore/iri/apis/machine/v1alpha1"
"github.com/ironcore-dev/ironcore/utils/client/config"

Expand Down Expand Up @@ -95,7 +96,16 @@ func Run(ctx context.Context, opts Options) error {
return fmt.Errorf("error creating new getter: %w", err)
}

cfg, err := getter.GetConfig(ctx, &opts.GetConfigOptions)
getConfigOptions := &configutils.GetConfigOptions{
Context: opts.GetConfigOptions.Context,
EgressSelectorConfig: opts.GetConfigOptions.EgressSelectorConfig,
QPS: opts.GetConfigOptions.QPS,
Burst: opts.GetConfigOptions.Burst,
}
if opts.GetConfigOptions.Kubeconfig != "" {
getConfigOptions.Kubeconfig = &opts.GetConfigOptions.Kubeconfig
}
cfg, err := getter.GetConfig(ctx, getConfigOptions)
if err != nil {
return fmt.Errorf("error getting config: %w", err)
}
Expand Down
9 changes: 4 additions & 5 deletions volumebroker/client/config/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ package config
import (
"os"

brokerconfig "github.com/ironcore-dev/brokers/common/client/config"
"github.com/ironcore-dev/ironcore/utils/client/config"
configutils "github.com/ironcore-dev/controller-utils/configutils"
"k8s.io/apiserver/pkg/server/egressselector"
ctrl "sigs.k8s.io/controller-runtime"
)

var log = ctrl.Log.WithName("client").WithName("config")

func NewGetter() (*brokerconfig.BrokerGetter, error) {
return brokerconfig.NewBrokerGetter(config.GetterOptions{
func NewGetter() (*configutils.Getter, error) {
return configutils.NewGetter(configutils.GetterOptions{
Name: "volumebroker",
NetworkContext: egressselector.ControlPlane.AsNetworkContext(),
})
}

func NewGetterOrDie() *brokerconfig.BrokerGetter {
func NewGetterOrDie() *configutils.Getter {
getter, err := NewGetter()
if err != nil {
log.Error(err, "Error creating getter")
Expand Down
12 changes: 11 additions & 1 deletion volumebroker/cmd/volumebroker/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ironcore-dev/brokers/common"
volumebrokerconfig "github.com/ironcore-dev/brokers/volumebroker/client/config"
"github.com/ironcore-dev/brokers/volumebroker/server"
configutils "github.com/ironcore-dev/controller-utils/configutils"
iri "github.com/ironcore-dev/ironcore/iri/apis/volume/v1alpha1"
"github.com/ironcore-dev/ironcore/utils/client/config"

Expand Down Expand Up @@ -83,7 +84,16 @@ func Run(ctx context.Context, opts Options) error {
return fmt.Errorf("error creating new getter: %w", err)
}

cfg, err := getter.GetConfig(ctx, &opts.GetConfigOptions)
getConfigOptions := &configutils.GetConfigOptions{
Context: opts.GetConfigOptions.Context,
EgressSelectorConfig: opts.GetConfigOptions.EgressSelectorConfig,
QPS: opts.GetConfigOptions.QPS,
Burst: opts.GetConfigOptions.Burst,
}
if opts.GetConfigOptions.Kubeconfig != "" {
getConfigOptions.Kubeconfig = &opts.GetConfigOptions.Kubeconfig
}
cfg, err := getter.GetConfig(ctx, getConfigOptions)
if err != nil {
return fmt.Errorf("error getting config: %w", err)
}
Expand Down
Loading