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

k8stopo: Remove the deprecated Kubernetes topo #13303

Merged
merged 1 commit into from
Jun 13, 2023
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
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
run:
go: 1.19
go: 1.20
timeout: 10m
skip-dirs:
- go/vt/topo/k8stopo/client

linters-settings:
errcheck:
Expand Down
58 changes: 0 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -380,64 +380,6 @@ minimaltools:
dependency_check:
./tools/dependency_check.sh

install_k8s-code-generator: tools/tools.go go.mod
go install k8s.io/code-generator/cmd/deepcopy-gen
go install k8s.io/code-generator/cmd/client-gen
go install k8s.io/code-generator/cmd/lister-gen
go install k8s.io/code-generator/cmd/informer-gen

DEEPCOPY_GEN=$(VTROOTBIN)/deepcopy-gen
CLIENT_GEN=$(VTROOTBIN)/client-gen
LISTER_GEN=$(VTROOTBIN)/lister-gen
INFORMER_GEN=$(VTROOTBIN)/informer-gen

GEN_BASE_DIR ?= vitess.io/vitess/go/vt/topo/k8stopo

client_go_gen: install_k8s-code-generator
echo $$(date): Regenerating client-go code
# Delete and re-generate the deepcopy types
find $(VTROOT)/go/vt/topo/k8stopo/apis/topo/v1beta1 -name "zz_generated.deepcopy.go" -delete

# We output to ./ and then copy over the generated files to the appropriate path
# This is done so we don't have rely on the repository being cloned to `$GOPATH/src/vitess.io/vitess`

$(DEEPCOPY_GEN) -o ./ \
--input-dirs $(GEN_BASE_DIR)/apis/topo/v1beta1 \
-O zz_generated.deepcopy \
--bounding-dirs $(GEN_BASE_DIR)/apis \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt

# Delete existing code
rm -rf go/vt/topo/k8stopo/client

# Generate clientset
$(CLIENT_GEN) -o ./ \
--clientset-name versioned \
--input-base $(GEN_BASE_DIR)/apis \
--input 'topo/v1beta1' \
--output-package $(GEN_BASE_DIR)/client/clientset \
--fake-clientset=true \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt

# Generate listers
$(LISTER_GEN) -o ./ \
--input-dirs $(GEN_BASE_DIR)/apis/topo/v1beta1 \
--output-package $(GEN_BASE_DIR)/client/listers \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt

# Generate informers
$(INFORMER_GEN) -o ./ \
--input-dirs $(GEN_BASE_DIR)/apis/topo/v1beta1 \
--output-package $(GEN_BASE_DIR)/client/informers \
--versioned-clientset-package $(GEN_BASE_DIR)/client/clientset/versioned \
--listers-package $(GEN_BASE_DIR)/client/listers \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt

# Move and cleanup
mv vitess.io/vitess/go/vt/topo/k8stopo/client go/vt/topo/k8stopo/
mv vitess.io/vitess/go/vt/topo/k8stopo/apis/topo/v1beta1/zz_generated.deepcopy.go go/vt/topo/k8stopo/apis/topo/v1beta1/zz_generated.deepcopy.go
rm -rf vitess.io/vitess/go/vt/topo/k8stopo/

vtadmin_web_install:
cd web/vtadmin && npm install

Expand Down
32 changes: 0 additions & 32 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,35 +171,6 @@ install_etcd() {
ln -snf "$dist/etcd-${version}-${platform}-${target}/etcdctl" "$VTROOT/bin/etcdctl"
}


# Download and install k3s, link k3s binary into our root
install_k3s() {
local version="$1"
local dist="$2"
case $(uname) in
Linux) local platform=linux;;
*) echo "WARNING: unsupported platform. K3s only supports running on Linux, the k8s topology will not be available for local examples."; return;;
esac

case $(get_arch) in
aarch64) local target="-arm64";;
x86_64) local target="";;
arm64) local target="-arm64";;
*) echo "WARNING: unsupported architecture, the k8s topology will not be available for local examples."; return;;
esac

file="k3s${target}"

local dest="$dist/k3s${target}-${version}-${platform}"
# This is how we'd download directly from source:
# download_url=https://github.com/rancher/k3s/releases/download
# wget -O $dest "$download_url/$version/$file"
"${VTROOT}/tools/wget-retry" -O $dest "${VITESS_RESOURCES_DOWNLOAD_URL}/$file-$version"
chmod +x $dest
ln -snf $dest "$VTROOT/bin/k3s"
}


# Download and install consul, link consul binary into our root.
install_consul() {
local version="$1"
Expand Down Expand Up @@ -299,9 +270,6 @@ install_all() {
# etcd
install_dep "etcd" "v3.5.6" "$VTROOT/dist/etcd" install_etcd

# k3s
command -v k3s || install_dep "k3s" "v1.0.0" "$VTROOT/dist/k3s" install_k3s

# consul
if [ "$BUILD_CONSUL" == 1 ] ; then
install_dep "Consul" "1.11.4" "$VTROOT/dist/consul" install_consul
Expand Down
5 changes: 5 additions & 0 deletions changelog/18.0/18.0.0/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- **[New command line flags and behavior](#new-flag)**
- [VTOrc flag `--allow-emergency-reparent`](#new-flag-toggle-ers)
- **[Deprecations and Deletions](#deprecations-and-deletions)**
- [Deleted `k8stopo`](#deleted-k8stopo)


## <a id="major-changes"/>Major Changes
Expand All @@ -22,3 +23,7 @@ The users that want VTOrc to fix the replication issues, but don't want it to ru
By default, VTOrc will be able to run `EmergencyReparentShard`. The users must specify the flag to `false` to change the behaviour.

### <a id="deprecations-and-deletions"/>Deprecations and Deletions

#### <a id="deleted-k8stopo"/>Deleted `k8stopo`

The `k8stopo` has been deprecated in Vitess 17, also see https://github.com/vitessio/vitess/issues/13298. With Vitess 18 the `k8stopo` has been removed.
2 changes: 0 additions & 2 deletions examples/backups/start_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ source ../common/env.sh
# start topo server
if [ "${TOPO}" = "zk2" ]; then
CELL=zone1 ../common/scripts/zk-up.sh
elif [ "${TOPO}" = "k8s" ]; then
CELL=zone1 ../common/scripts/k3s-up.sh
else
CELL=zone1 ../common/scripts/etcd-up.sh
fi
Expand Down
7 changes: 0 additions & 7 deletions examples/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ if [ "${TOPO}" = "zk2" ]; then
TOPOLOGY_FLAGS="--topo_implementation zk2 --topo_global_server_address ${ZK_SERVER} --topo_global_root /vitess/global"

mkdir -p "${VTDATAROOT}/tmp"
elif [ "${TOPO}" = "k8s" ]; then
# Set topology environment parameters.
K8S_ADDR="localhost"
K8S_PORT="8443"
K8S_KUBECONFIG=$VTDATAROOT/tmp/k8s.kubeconfig
# shellcheck disable=SC2034
TOPOLOGY_FLAGS="--topo_implementation k8s --topo_k8s_kubeconfig ${K8S_KUBECONFIG} --topo_global_server_address ${K8S_ADDR}:${K8S_PORT} --topo_global_root /vitess/global"
elif [ "${TOPO}" = "consul" ]; then
# Set up topology environment parameters.
CONSUL_SERVER=127.0.0.1
Expand Down
28 changes: 0 additions & 28 deletions examples/common/scripts/k3s-down.sh

This file was deleted.

57 changes: 0 additions & 57 deletions examples/common/scripts/k3s-up.sh

This file was deleted.

2 changes: 0 additions & 2 deletions examples/local/101_initial_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ SIDECAR_DB_NAME=${SIDECAR_DB_NAME:-"_vt"}
# start topo server
if [ "${TOPO}" = "zk2" ]; then
CELL=zone1 ../common/scripts/zk-up.sh
elif [ "${TOPO}" = "k8s" ]; then
CELL=zone1 ../common/scripts/k3s-up.sh
elif [ "${TOPO}" = "consul" ]; then
CELL=zone1 ../common/scripts/consul-up.sh
else
Expand Down
2 changes: 0 additions & 2 deletions examples/local/401_teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ done

if [ "${TOPO}" = "zk2" ]; then
CELL=zone1 ../common/scripts/zk-down.sh
elif [ "${TOPO}" = "k8s" ]; then
CELL=zone1 ../common/scripts/k3s-down.sh
elif [ "${TOPO}" = "consul" ]; then
CELL=zone1 ../common/scripts/consul-down.sh
else
Expand Down
2 changes: 0 additions & 2 deletions examples/region_sharding/101_initial_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ source ../common/env.sh
# start topo server
if [ "${TOPO}" = "zk2" ]; then
CELL=zone1 ../common/scripts/zk-up.sh
elif [ "${TOPO}" = "k8s" ]; then
CELL=zone1 ../common/scripts/k3s-up.sh
else
CELL=zone1 ../common/scripts/etcd-up.sh
fi
Expand Down
2 changes: 0 additions & 2 deletions examples/region_sharding/301_teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ done

if [ "${TOPO}" = "zk2" ]; then
CELL=zone1 ../common/scripts/zk-down.sh
elif [ "${TOPO}" = "k8s" ]; then
CELL=zone1 ../common/scripts/k3s-down.sh
else
CELL=zone1 ../common/scripts/etcd-down.sh
fi
Expand Down
28 changes: 2 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
github.com/imdario/mergo v0.3.13 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.16.5
github.com/klauspost/pgzip v1.2.5
Expand Down Expand Up @@ -94,10 +93,6 @@ require (
gopkg.in/ldap.v2 v2.5.1
gopkg.in/warnings.v0 v0.1.2 // indirect
gotest.tools v2.2.0+incompatible
k8s.io/apiextensions-apiserver v0.18.19
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
k8s.io/code-generator v0.26.1
sigs.k8s.io/yaml v1.3.0
)

Expand All @@ -114,7 +109,6 @@ require (
github.com/xlab/treeprint v1.2.0
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201
golang.org/x/sync v0.1.0
k8s.io/utils v0.0.0-20230115233650-391b47cb4029
modernc.org/sqlite v1.20.3
)

Expand All @@ -138,17 +132,11 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand All @@ -157,19 +145,14 @@ require (
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-ieproxy v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/gomega v1.23.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
Expand All @@ -192,15 +175,10 @@ require (
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
k8s.io/api v0.26.1 // indirect
k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 // indirect
k8s.io/klog/v2 v2.90.0 // indirect
k8s.io/kube-openapi v0.0.0-20230202010329-39b3636cbaa3 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
Expand All @@ -210,6 +188,4 @@ require (
modernc.org/opt v0.1.3 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.1.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
Loading