Skip to content

Commit

Permalink
Merge pull request #2963 from xrstf/remove-syncer
Browse files Browse the repository at this point in the history
⚠️ Remove TMC/Syncer
  • Loading branch information
openshift-merge-robot authored Jun 3, 2023
2 parents 7f7ab89 + c2b3247 commit a83e650
Show file tree
Hide file tree
Showing 319 changed files with 583 additions and 51,021 deletions.
130 changes: 0 additions & 130 deletions .github/workflows/ci.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/kcp-test-image.yaml

This file was deleted.

66 changes: 2 additions & 64 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ldflags:
require-%:
@if ! command -v $* 1> /dev/null 2>&1; then echo "$* not found in ${PATH}"; exit 1; fi

build: WHAT ?= ./cmd/... ./tmc/cmd/...
build: WHAT ?= ./cmd/...
build: require-jq require-go require-git verify-go-versions ## Build the project
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build $(BUILDFLAGS) -ldflags="$(LDFLAGS)" -o bin $(WHAT)
ln -sf kubectl-workspace bin/kubectl-workspaces
Expand All @@ -119,15 +119,7 @@ build: require-jq require-go require-git verify-go-versions ## Build the project

.PHONY: build-all
build-all:
GOOS=$(OS) GOARCH=$(ARCH) $(MAKE) build WHAT='./cmd/... ./tmc/cmd/...'

.PHONY: build-kind-images
build-kind-images-ko: require-ko
$(eval SYNCER_IMAGE=$(shell KO_DOCKER_REPO=kind.local KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) ko build --platform=linux/$(ARCH) ./cmd/syncer))
$(eval TEST_IMAGE=$(shell KO_DOCKER_REPO=kind.local KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) ko build --platform=linux/$(ARCH) ./test/e2e/fixtures/kcp-test-image))
build-kind-images: build-kind-images-ko
@test -n "$(SYNCER_IMAGE)" && (echo $(SYNCER_IMAGE) pushed to "$(KIND_CLUSTER_NAME)" kind cluster) || (echo Failed to create syncer image and/or to push it to "$(KIND_CLUSTER_NAME)" kind cluster; exit 1)
@test -n "$(TEST_IMAGE)" && (echo $(TEST_IMAGE) pushed to "$(KIND_CLUSTER_NAME)" kind cluster) || (echo Failed to create test image and and/or to push it to "$(KIND_CLUSTER_NAME)" kind cluster; exit 1)
GOOS=$(OS) GOARCH=$(ARCH) $(MAKE) build WHAT='./cmd/...'

install: WHAT ?= ./cmd/...
install: require-jq require-go require-git verify-go-versions ## Install the project
Expand Down Expand Up @@ -278,31 +270,6 @@ test-e2e: build-all
UNSAFE_E2E_HACK_DISABLE_ETCD_FSYNC=true NO_GORUN=1 GOOS=$(OS) GOARCH=$(ARCH) \
$(GO_TEST) -race $(COUNT_ARG) $(PARALLELISM_ARG) $(WHAT) $(TEST_ARGS) $(COMPLETE_SUITES_ARG)

.PHONY: test-e2e-shared
ifdef USE_GOTESTSUM
test-e2e-shared: $(GOTESTSUM)
endif
test-e2e-shared: TEST_ARGS ?=
test-e2e-shared: WHAT ?= ./test/e2e...
test-e2e-shared: WORK_DIR ?= .
ifdef ARTIFACT_DIR
test-e2e-shared: LOG_DIR ?= $(ARTIFACT_DIR)/kcp
else
test-e2e-shared: LOG_DIR ?= $(WORK_DIR)/.kcp
endif
test-e2e-shared: require-kind build-all build-kind-images
mkdir -p "$(LOG_DIR)" "$(WORK_DIR)/.kcp"
kind get kubeconfig > "$(WORK_DIR)/.kcp/kind.kubeconfig"
rm -f "$(WORK_DIR)/.kcp/ready-to-test"
UNSAFE_E2E_HACK_DISABLE_ETCD_FSYNC=true NO_GORUN=1 \
./bin/test-server --quiet --log-file-path="$(LOG_DIR)/kcp.log" $(TEST_SERVER_ARGS) 2>&1 & PID=$$! && echo "PID $$PID" && \
trap 'kill -TERM $$PID' TERM INT EXIT && \
while [ ! -f "$(WORK_DIR)/.kcp/ready-to-test" ]; do sleep 1; done && \
echo 'Starting test(s)' && \
NO_GORUN=1 GOOS=$(OS) GOARCH=$(ARCH) \
$(GO_TEST) -race $(COUNT_ARG) $(PARALLELISM_ARG) $(WHAT) $(TEST_ARGS) \
-args --use-default-kcp-server --syncer-image="$(SYNCER_IMAGE)" --kcp-test-image="$(TEST_IMAGE)" --pcluster-kubeconfig="$(abspath $(WORK_DIR)/.kcp/kind.kubeconfig)" $(SUITES_ARG) \
$(if $(value WAIT),|| { echo "Terminated with $$?"; wait "$$PID"; },)

.PHONY: test-e2e-shared-minimal
ifdef USE_GOTESTSUM
Expand All @@ -329,35 +296,6 @@ test-e2e-shared-minimal: build-all
-args --use-default-kcp-server $(SUITES_ARG) \
$(if $(value WAIT),|| { echo "Terminated with $$?"; wait "$$PID"; },)

.PHONY: test-e2e-sharded
ifdef USE_GOTESTSUM
test-e2e-sharded: $(GOTESTSUM)
endif
test-e2e-sharded: TEST_ARGS ?=
test-e2e-sharded: WHAT ?= ./test/e2e...
test-e2e-sharded: WORK_DIR ?= .
test-e2e-sharded: SHARDS ?= 2
ifdef ARTIFACT_DIR
test-e2e-sharded: LOG_DIR ?= $(ARTIFACT_DIR)/kcp
else
test-e2e-sharded: LOG_DIR ?= $(WORK_DIR)/.kcp
endif
test-e2e-sharded: require-kind build-all build-kind-images
mkdir -p "$(LOG_DIR)" "$(WORK_DIR)/.kcp"
kind get kubeconfig > "$(WORK_DIR)/.kcp/kind.kubeconfig"
rm -f "$(WORK_DIR)/.kcp/ready-to-test"
UNSAFE_E2E_HACK_DISABLE_ETCD_FSYNC=true NO_GORUN=1 \
./bin/sharded-test-server --quiet --v=2 --log-dir-path="$(LOG_DIR)" --work-dir-path="$(WORK_DIR)" --shard-run-virtual-workspaces=false $(TEST_SERVER_ARGS) --number-of-shards=$(SHARDS) --cache-synthetic-delay=500ms 2>&1 & PID=$$!; echo "PID $$PID" && \
trap 'kill -TERM $$PID' TERM INT EXIT && \
while [ ! -f "$(WORK_DIR)/.kcp/ready-to-test" ]; do sleep 1; done && \
echo 'Starting test(s)' && \
NO_GORUN=1 GOOS=$(OS) GOARCH=$(ARCH) \
$(GO_TEST) -race $(COUNT_ARG) $(PARALLELISM_ARG) $(WHAT) $(TEST_ARGS) \
-args --use-default-kcp-server --shard-kubeconfigs=root=$(PWD)/.kcp-0/admin.kubeconfig$(shell if [ $(SHARDS) -gt 1 ]; then seq 1 $$[$(SHARDS) - 1]; fi | while read n; do echo -n ",shard-$$n=$(PWD)/.kcp-$$n/admin.kubeconfig"; done) \
$(SUITES_ARG) \
--syncer-image="$(SYNCER_IMAGE)" --kcp-test-image="$(TEST_IMAGE)" --pcluster-kubeconfig="$(abspath $(WORK_DIR)/.kcp/kind.kubeconfig)" \
$(if $(value WAIT),|| { echo "Terminated with $$?"; wait "$$PID"; },)

.PHONY: test-e2e-sharded-minimal
ifdef USE_GOTESTSUM
test-e2e-sharded-minimal: $(GOTESTSUM)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ kcp is a Kubernetes-like control plane focusing on:
- A **control plane** for many independent, **isolated** “clusters” known as **workspaces**
- Enabling API service providers to **offer APIs centrally** using **multi-tenant operators**
- Easy **API consumption** for users in their workspaces
- Flexible **scheduling** of workloads to physical clusters
- **Transparent movement** of workloads among compatible physical clusters
- **Advanced deployment strategies** for scenarios such as affinity/anti-affinity, geographic replication, cross-cloud
replication, etc.

kcp can be a building block for SaaS service providers who need a **massively multi-tenant platform** to offer services
to a large number of fully isolated tenants using Kubernetes-native APIs. The goal is to be useful to cloud
providers as well as enterprise IT departments offering APIs within their company.

**NB:** In May 2023, the kcp project was restructured and components related to workload scheduling (e.g. the syncer) and the transparent multi cluster (tmc) code were removed due to lack of interest/maintainers. Please refer to the [`main-pre-tmc-removal` branch](https://github.com/kcp-dev/kcp/tree/main-pre-tmc-removal) if you are interested in the related code.

## Documentation

Please visit [docs.kcp.io/kcp](https://docs.kcp.io/kcp) for our documentation.
Expand Down
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
8 changes: 0 additions & 8 deletions cmd/kubectl-kcp/cmd/kubectlKcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
bindcmd "github.com/kcp-dev/kcp/pkg/cliplugins/bind/cmd"
claimscmd "github.com/kcp-dev/kcp/pkg/cliplugins/claims/cmd"
crdcmd "github.com/kcp-dev/kcp/pkg/cliplugins/crd/cmd"
workloadcmd "github.com/kcp-dev/kcp/pkg/cliplugins/workload/cmd"
workspacecmd "github.com/kcp-dev/kcp/pkg/cliplugins/workspace/cmd"
"github.com/kcp-dev/kcp/pkg/cmd/help"
)
Expand Down Expand Up @@ -72,13 +71,6 @@ func KubectlKcpCommand() *cobra.Command {
}
root.AddCommand(workspaceCmd)

workloadCmd, err := workloadcmd.New(genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr})
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
root.AddCommand(workloadCmd)

crdCmd := crdcmd.New(genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr})
root.AddCommand(crdCmd)

Expand Down
Loading

0 comments on commit a83e650

Please sign in to comment.