Skip to content

Commit

Permalink
- fixed up the issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gambol99 committed Aug 25, 2023
1 parent c496c4e commit 40bc715
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion pkg/cmd/tnctl/state/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ var _ = Describe("Listing the state", func() {
var err error

BeforeEach(func() {
cc = fake.NewFakeClientWithScheme(schema.GetScheme())
cc = fake.NewClientBuilder().
WithScheme(schema.GetScheme()).
Build()
kc = k8sfake.NewSimpleClientset()

streams, _, stdout, _ = genericclioptions.NewTestIOStreams()
Expand Down
13 changes: 9 additions & 4 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/manager"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/appvia/terranetes-controller/pkg/apiserver"
Expand Down Expand Up @@ -118,14 +120,17 @@ func New(cfg *rest.Config, config Config) (*Server, error) {
}

options := manager.Options{
Cache: cache.Options{
SyncPeriod: &config.ResyncPeriod,
},
LeaderElection: false,
LeaderElectionID: "controller.terraform.appvia.io",
LeaderElectionNamespace: ns,
LeaderElectionReleaseOnCancel: true,
MetricsBindAddress: fmt.Sprintf(":%d", config.MetricsPort),
Port: config.WebhookPort,
Scheme: schema.GetScheme(),
SyncPeriod: &config.ResyncPeriod,
Metrics: metricsserver.Options{
BindAddress: fmt.Sprintf(":%d", config.MetricsPort),
},
Scheme: schema.GetScheme(),
}

if config.EnableWebhooks {
Expand Down

0 comments on commit 40bc715

Please sign in to comment.