Skip to content

Commit

Permalink
now that tmc/ is just an empty wrapper around pkg/server, get rid of …
Browse files Browse the repository at this point in the history
…it entirely
  • Loading branch information
xrstf committed Jun 2, 2023
1 parent 3e63afb commit c2b3247
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 269 deletions.
16 changes: 8 additions & 8 deletions cmd/kcp/kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/kcp-dev/kcp/pkg/cmd/help"
"github.com/kcp-dev/kcp/pkg/embeddedetcd"
kcpfeatures "github.com/kcp-dev/kcp/pkg/features"
tmcserver "github.com/kcp-dev/kcp/tmc/pkg/server"
"github.com/kcp-dev/kcp/pkg/server"
)

func main() {
Expand Down Expand Up @@ -83,7 +83,7 @@ func main() {
}

serverOptions := options.NewOptions(rootDir)
serverOptions.Server.Core.GenericControlPlane.Logs.Verbosity = logsapiv1.VerbosityLevel(2)
serverOptions.Server.GenericControlPlane.Logs.Verbosity = logsapiv1.VerbosityLevel(2)

startCmd := &cobra.Command{
Use: "start",
Expand All @@ -105,7 +105,7 @@ func main() {
},
RunE: func(cmd *cobra.Command, args []string) error {
// run as early as possible to avoid races later when some components (e.g. grpc) start early using klog
if err := logsapiv1.ValidateAndApply(serverOptions.Server.Core.GenericControlPlane.Logs, kcpfeatures.DefaultFeatureGate); err != nil {
if err := logsapiv1.ValidateAndApply(serverOptions.Server.GenericControlPlane.Logs, kcpfeatures.DefaultFeatureGate); err != nil {
return err
}

Expand All @@ -119,9 +119,9 @@ func main() {
}

logger := klog.FromContext(cmd.Context())
logger.Info("running with selected batteries", "batteries", strings.Join(completed.Server.Core.Extra.BatteriesIncluded, ","))
logger.Info("running with selected batteries", "batteries", strings.Join(completed.Server.Extra.BatteriesIncluded, ","))

config, err := tmcserver.NewConfig(completed.Server)
config, err := server.NewConfig(completed.Server)
if err != nil {
return err
}
Expand All @@ -134,13 +134,13 @@ func main() {
ctx := genericapiserver.SetupSignalContext()

// the etcd server must be up before NewServer because storage decorators access it right away
if completedConfig.Core.EmbeddedEtcd.Config != nil {
if err := embeddedetcd.NewServer(completedConfig.Core.EmbeddedEtcd).Run(ctx); err != nil {
if completedConfig.EmbeddedEtcd.Config != nil {
if err := embeddedetcd.NewServer(completedConfig.EmbeddedEtcd).Run(ctx); err != nil {
return err
}
}

s, err := tmcserver.NewServer(completedConfig)
s, err := server.NewServer(completedConfig)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/kcp/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import (
cliflag "k8s.io/component-base/cli/flag"

kcpcoreoptions "github.com/kcp-dev/kcp/cmd/kcp-core/options"
tmcserveroptions "github.com/kcp-dev/kcp/tmc/pkg/server/options"
serveroptions "github.com/kcp-dev/kcp/pkg/server/options"
)

type Options struct {
Output io.Writer

Generic kcpcoreoptions.GenericOptions
Server tmcserveroptions.Options
Server serveroptions.Options
Extra ExtraOptions
}

Expand All @@ -39,7 +39,7 @@ func NewOptions(rootDir string) *Options {
opts := &Options{
Output: nil,

Server: *tmcserveroptions.NewOptions(rootDir),
Server: *serveroptions.NewOptions(rootDir),
Generic: *kcpcoreoptions.NewGeneric(rootDir),
Extra: ExtraOptions{},
}
Expand All @@ -51,7 +51,7 @@ type completedOptions struct {
Output io.Writer

Generic kcpcoreoptions.GenericOptions
Server tmcserveroptions.CompletedOptions
Server serveroptions.CompletedOptions
Extra ExtraOptions
}

Expand Down
6 changes: 3 additions & 3 deletions test/e2e/framework/kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ import (
kcpoptions "github.com/kcp-dev/kcp/cmd/kcp/options"
"github.com/kcp-dev/kcp/cmd/sharded-test-server/third_party/library-go/crypto"
"github.com/kcp-dev/kcp/pkg/embeddedetcd"
"github.com/kcp-dev/kcp/pkg/server"
corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1"
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
kubefixtures "github.com/kcp-dev/kcp/test/e2e/fixtures/kube"
"github.com/kcp-dev/kcp/tmc/pkg/server"
)

// TestServerArgs returns the set of kcp args used to start a test
Expand Down Expand Up @@ -664,8 +664,8 @@ func (c *kcpServer) Run(opts ...RunOption) error {
}

// the etcd server must be up before NewServer because storage decorators access it right away
if completedConfig.Core.EmbeddedEtcd.Config != nil {
if err := embeddedetcd.NewServer(completedConfig.Core.EmbeddedEtcd).Run(ctx); err != nil {
if completedConfig.EmbeddedEtcd.Config != nil {
if err := embeddedetcd.NewServer(completedConfig.EmbeddedEtcd).Run(ctx); err != nil {
return err
}
}
Expand Down
77 changes: 0 additions & 77 deletions tmc/pkg/server/config.go

This file was deleted.

75 changes: 0 additions & 75 deletions tmc/pkg/server/options/options.go

This file was deleted.

102 changes: 0 additions & 102 deletions tmc/pkg/server/server.go

This file was deleted.

0 comments on commit c2b3247

Please sign in to comment.