From 97453a618b5663dd65aecec3b267d1aeff1b58f7 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 31 Oct 2016 10:02:02 -0700 Subject: [PATCH] *: rename kube-etcd-controller -> etcd-operator --- README.md | 44 +++++++++++------------ ROADMAP.md | 4 +-- cmd/backup/main.go | 12 +++---- cmd/{controller => operator}/main.go | 21 +++++------ doc/design/cluster_tls.md | 8 ++--- example/deployment.yaml | 10 +++--- glide.yaml | 2 +- hack/build/controller/Dockerfile | 10 ------ hack/build/operator/Dockerfile | 10 ++++++ hack/build/{controller => operator}/build | 4 +-- hack/jenkins | 8 ++--- hack/release/README.md | 8 ++--- hack/test | 4 +-- pkg/analytics/client.go | 6 ++-- pkg/backup/backup.go | 12 +++---- pkg/backup/http.go | 5 +-- pkg/chaos/chaos.go | 2 +- pkg/cluster/cluster.go | 13 +++---- pkg/cluster/cluster_status.go | 2 +- pkg/cluster/reconcile.go | 13 +++---- pkg/cluster/upgrade.go | 7 ++-- pkg/controller/controller.go | 11 +++--- pkg/controller/etcd_cluster_list.go | 5 +-- pkg/spec/backup.go | 2 +- pkg/spec/cluster.go | 8 ++--- pkg/util/constants/constants.go | 2 +- pkg/util/etcdutil/member.go | 2 +- pkg/util/k8sutil/backup.go | 7 ++-- pkg/util/k8sutil/k8sutil.go | 9 ++--- test/e2e/README.md | 2 +- test/e2e/e2e_test.go | 19 +++++----- test/e2e/framework/framework.go | 27 +++++++------- test/e2e/main_test.go | 5 +-- test/e2e/seed_migration_test.go | 7 ++-- test/e2e/upgrade_test.go | 7 ++-- version/version.go | 2 +- 36 files changed, 166 insertions(+), 154 deletions(-) rename cmd/{controller => operator}/main.go (91%) delete mode 100644 hack/build/controller/Dockerfile create mode 100644 hack/build/operator/Dockerfile rename hack/build/{controller => operator}/build (77%) diff --git a/README.md b/README.md index 90c62f3..a0821cc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# kube-etcd-controller +# etcd operator [![Build Status](https://jenkins-etcd-public.prod.coreos.systems/buildStatus/icon?job=etcd-controller-master)](https://jenkins-etcd-public.prod.coreos.systems/job/etcd-controller-master/) @@ -8,15 +8,13 @@ The `etcd operator` project now ships with a lot of execiting features. We stron ## Overview -Kube-etcd-controller manages etcd clusters atop [Kubernetes][k8s-home], automating their creation and administration: +etcd operator manages etcd clusters atop [Kubernetes][k8s-home], automating their creation and administration: - [Create](#create-an-etcd-cluster) - [Destroy](#destroy-an-existing-etcd-cluster) - [Resize](#resize-an-etcd-cluster) - [Recover a member](#member-recovery) - [Backup and restore a cluster](#disaster-recovery) -- Cluster migration (TODO) - - Migrate an existing etcd cluster into controller management - [rolling upgrade](#try-upgrade-etcd-cluster) ## Requirements @@ -27,16 +25,16 @@ Kube-etcd-controller manages etcd clusters atop [Kubernetes][k8s-home], automati ## Limitations - Backup works only for data in etcd3 storage, not for data in etcd2 storage. -- Migration, the process of allowing the controller to manage existing etcd3 clusters, only supports a single-member cluster, with all nodes running in the same Kubernetes cluster. +- Migration, the process of allowing the etcd operator to manage existing etcd3 clusters, only supports a single-member cluster, with all nodes running in the same Kubernetes cluster. -## Deploy kube-etcd-controller +## Deploy etcd operator ```bash -$ kubectl create -f example/etcd-controller.yaml -pod "kube-etcd-controller" created +$ kubectl create -f example/etcd operator.yaml +pod "etcd operator" created ``` -kube-etcd-controller will create a Kubernetes *Third-Party Resource* (TPR) called "etcd-cluster", and an "etcd-controller-backup" storage class. +etcd operator will create a Kubernetes *Third-Party Resource* (TPR) called "etcd-cluster", and an "etcd operator-backup" storage class. ```bash $ kubectl get thirdpartyresources @@ -212,7 +210,7 @@ NAME READY STATUS RESTARTS AGE ## Member recovery -If the minority of etcd members crash, the etcd controller will automatically recover the failure. +If the minority of etcd members crash, the etcd operator will automatically recover the failure. Let's walk through in the following steps. Redo the "create" process to have a cluster with 3 members. @@ -223,7 +221,7 @@ Simulate a member failure by deleting a pod: $ kubectl delete pod etcd-cluster-0000 ``` -The etcd controller will recover the failure by creating a new pod `etcd-cluster-0003` +The etcd operator will recover the failure by creating a new pod `etcd-cluster-0003` ```bash $ kubectl get pods @@ -233,25 +231,25 @@ etcd-cluster-0002 1/1 Running 0 5s etcd-cluster-0003 1/1 Running 0 5s ``` -### Controller recovery +### etcd operator recovery -If the etcd controller restarts, it can recover its previous state. +If the etcd operator restarts, it can recover its previous state. -Continued from above, you can simulate a controller crash and a member crash: +Continued from above, you can simulate a operator crash and a member crash: ```bash -$ kubectl delete -f example/etcd-controller.yaml -pod "kube-etcd-controller" deleted +$ kubectl delete -f example/etcd-operator.yaml +pod "etcd-operator" deleted $ kubectl delete etcd-cluster-0001 pod "etcd-cluster-0001" deleted ``` -Then restart the etcd controller. It should automatically recover itself. It also recovers the etcd cluster: +Then restart the etcd operator. It should automatically recover itself. It also recovers the etcd cluster: ```bash $ kubectl create -f example/etcd-cluster.yaml -pod "kube-etcd-controller" created +pod "etcd-operator" created $ kubectl get pods NAME READY STATUS RESTARTS AGE etcd-cluster-0002 1/1 Running 0 4m @@ -261,14 +259,14 @@ etcd-cluster-0004 1/1 Running 0 6s ## Disaster recovery -If the majority of etcd members crash, but at least one backup exists for the cluster, the etcd controller can restore the entire cluster from the backup. +If the majority of etcd members crash, but at least one backup exists for the cluster, the etcd operator can restore the entire cluster from the backup. -By default, the etcd controller creates a storage class on initialization: +By default, the etcd operator creates a storage class on initialization: ``` $ kubectl get storageclass NAME TYPE -etcd-controller-backup kubernetes.io/gce-pd +etcd-operator-backup kubernetes.io/gce-pd ``` This is used to request the persistent volume to store the backup data. (TODO: We are planning to support AWS EBS soon.) @@ -298,7 +296,7 @@ pod "etcd-cluster-0002" deleted pod "etcd-cluster-0003" deleted ``` -Now quorum is lost. The etcd controller will start to recover the cluster by: +Now quorum is lost. The etcd operator will start to recover the cluster by: - Creating a new seed member to recover from the backup - Add the specified number of members into the seed cluster @@ -320,7 +318,7 @@ Note: Sometimes member recovery can fail because of a race caused by a delay in ## Upgrade an etcd cluster -Clean up any existing etcd cluster, but keep the etcd controller running. +Clean up any existing etcd cluster, but keep the etcd operator running. Have the following yaml file ready: diff --git a/ROADMAP.md b/ROADMAP.md index 4b25e8a..1ed5e63 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,6 +1,6 @@ # Roadmap -This document defines a high level roadmap for the etcd cluster controller development. +This document defines a high level roadmap for the etcd cluster operator development. The dates below should not be considered authoritative, but rather indicative of the projected timeline of the project. @@ -21,7 +21,7 @@ The dates below should not be considered authoritative, but rather indicative of - More structured logging - Add prefix for different clusters - Use infof, waringf, errorf consistently - - Expose controller metrics + - Expose operator metrics - How many clusters it manages - How many actions it does - Expose the running status of the etcd cluster diff --git a/cmd/backup/main.go b/cmd/backup/main.go index 074e6c5..0fca6a0 100644 --- a/cmd/backup/main.go +++ b/cmd/backup/main.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,10 +19,10 @@ import ( "fmt" "os" - "github.com/coreos/kube-etcd-controller/pkg/backup" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" - "github.com/coreos/kube-etcd-controller/version" + "github.com/coreos/etcd-operator/pkg/backup" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + "github.com/coreos/etcd-operator/version" ) var ( @@ -51,7 +51,7 @@ func init() { func main() { if printVersion { - fmt.Println("kube-etcd-backup", version.Version) + fmt.Println("etcd-operator-backup", version.Version) os.Exit(0) } diff --git a/cmd/controller/main.go b/cmd/operator/main.go similarity index 91% rename from cmd/controller/main.go rename to cmd/operator/main.go index 6fa4597..00b1737 100644 --- a/cmd/controller/main.go +++ b/cmd/operator/main.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,12 +21,13 @@ import ( "os" "time" + "github.com/coreos/etcd-operator/pkg/analytics" + "github.com/coreos/etcd-operator/pkg/chaos" + "github.com/coreos/etcd-operator/pkg/controller" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + "github.com/coreos/etcd-operator/version" + "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/pkg/analytics" - "github.com/coreos/kube-etcd-controller/pkg/chaos" - "github.com/coreos/kube-etcd-controller/pkg/controller" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" - "github.com/coreos/kube-etcd-controller/version" "golang.org/x/time/rate" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/leaderelection" @@ -67,7 +68,7 @@ func init() { flag.StringVar(&caFile, "ca-file", "", "- NOT RECOMMENDED FOR PRODUCTION - Path to TLS CA file.") flag.BoolVar(&tlsInsecure, "tls-insecure", false, "- NOT RECOMMENDED FOR PRODUCTION - Don't verify API server's CA certificate.") // chaos level will be removed once we have a formal tool to inject failures. - flag.IntVar(&chaosLevel, "chaos-level", -1, "DO NOT USE IN PRODUCTION - level of chaos injected into the etcd clusters created by the controller.") + flag.IntVar(&chaosLevel, "chaos-level", -1, "DO NOT USE IN PRODUCTION - level of chaos injected into the etcd clusters created by the operator.") flag.BoolVar(&printVersion, "version", false, "Show version and quit") flag.Parse() @@ -79,7 +80,7 @@ func init() { func main() { if printVersion { - fmt.Println("kube-etcd-controller", version.Version) + fmt.Println("etcd-operator", version.Version) os.Exit(0) } @@ -87,7 +88,7 @@ func main() { analytics.Enable() } - analytics.ControllerStarted() + analytics.OperatorStarted() id, err := os.Hostname() if err != nil { @@ -97,7 +98,7 @@ func main() { leaderelection.RunOrDie(leaderelection.LeaderElectionConfig{ EndpointsMeta: api.ObjectMeta{ Namespace: namespace, - Name: "etcd-controller", + Name: "etcd-operator", }, Client: k8sutil.MustCreateClient(masterHost, tlsInsecure, &restclient.TLSClientConfig{ CertFile: certFile, diff --git a/doc/design/cluster_tls.md b/doc/design/cluster_tls.md index eba990c..573847b 100644 --- a/doc/design/cluster_tls.md +++ b/doc/design/cluster_tls.md @@ -2,7 +2,7 @@ ## Abstract -The primary goals kube-etcd-controller cluster TLS: +The primary goals etcd-operator cluster TLS: * Encrypt etcd client/peer communication * Cryptographically attestable identites for following components: * etcd controller @@ -13,7 +13,7 @@ The primary goals kube-etcd-controller cluster TLS: ## Intra-Cluster PKI overview -Here is the overview for kube-etcd-controller TLS flow, which should set us up well for integrating with pre-existing external PKI. +Here is the overview for etcd-operator TLS flow, which should set us up well for integrating with pre-existing external PKI. ### Trust delegation diagram: @@ -89,7 +89,7 @@ Here is the overview for kube-etcd-controller TLS flow, which should set us up w ### Certificate signing procedure -1. kube-etcd-controller pod startup: +1. etcd-operator pod startup: * generate `controller CA` private key * generate `controller CA` certificate (peer and client) (select one of following) * generate self-signed cert (default for now, useful for development mode) @@ -139,7 +139,7 @@ In the case that the _signer_ and _signee_ are within the same component, we hav This is a symbol for a _signee_ submitting a CSR to a _signer_, and recieving back a signed certificate back. -In the case of kube-etcd-controller, this will be coordinated via the Kubernetes API server. +In the case of etcd-operator, this will be coordinated via the Kubernetes API server. ----- diff --git a/example/deployment.yaml b/example/deployment.yaml index 1cdd7d6..fcec60e 100644 --- a/example/deployment.yaml +++ b/example/deployment.yaml @@ -1,21 +1,21 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: kube-etcd-controller + name: etcd-operator spec: replicas: 1 selector: matchLabels: - name: kube-etcd-controller + name: etcd-operator template: metadata: labels: - name: kube-etcd-controller + name: etcd-operator spec: containers: - - name: etcd-controller + - name: etcd-operator # TODO: change this to official quay container - image: gcr.io/coreos-k8s-scale-testing/kube-etcd-controller + image: gcr.io/coreos-k8s-scale-testing/etcd-operator env: - name: MY_POD_NAMESPACE valueFrom: diff --git a/glide.yaml b/glide.yaml index b52b955..a838796 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,4 +1,4 @@ -package: github.com/coreos/kube-etcd-controller +package: github.com/coreos/etcd-operator import: - package: github.com/Sirupsen/logrus version: v0.10.0 diff --git a/hack/build/controller/Dockerfile b/hack/build/controller/Dockerfile deleted file mode 100644 index 92ae695..0000000 --- a/hack/build/controller/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM golang - -ADD . /go/src/github.com/coreos/kube-etcd-controller - -RUN cd /go/src/github.com/coreos/kube-etcd-controller && \ - go build -o kube-etcd-controller ./cmd/controller/main.go && \ - mv kube-etcd-controller /usr/local/bin && \ - rm -rf /go/* - -CMD ["/bin/sh", "-c", "/usr/local/bin/kube-etcd-controller"] diff --git a/hack/build/operator/Dockerfile b/hack/build/operator/Dockerfile new file mode 100644 index 0000000..e5a4910 --- /dev/null +++ b/hack/build/operator/Dockerfile @@ -0,0 +1,10 @@ +FROM golang + +ADD . /go/src/github.com/coreos/etcd-operator + +RUN cd /go/src/github.com/coreos/etcd-operator && \ + go build -o etcd-operator ./cmd/operator/main.go && \ + mv etcd-operator /usr/local/bin && \ + rm -rf /go/* + +CMD ["/bin/sh", "-c", "/usr/local/bin/etcd-operator"] diff --git a/hack/build/controller/build b/hack/build/operator/build similarity index 77% rename from hack/build/controller/build rename to hack/build/operator/build index d3f8dd1..1ad2a5a 100755 --- a/hack/build/controller/build +++ b/hack/build/operator/build @@ -14,7 +14,7 @@ if ! which docker > /dev/null; then exit 1 fi -: ${IMAGE:?"Need to set IMAGE, e.g. gcr.io/coreos-k8s-scale-testing/kube-etcd-controller"} +: ${IMAGE:?"Need to set IMAGE, e.g. gcr.io/coreos-k8s-scale-testing/etcd-operator"} -docker build --tag "${IMAGE}" -f hack/build/controller/Dockerfile . +docker build --tag "${IMAGE}" -f hack/build/operator/Dockerfile . gcloud docker -- push "${IMAGE}" diff --git a/hack/jenkins b/hack/jenkins index 2beb031..f4f96de 100755 --- a/hack/jenkins +++ b/hack/jenkins @@ -13,8 +13,8 @@ export GOPATH=`pwd` echo "GOPATH: ${GOPATH}" mkdir -p $GOPATH/src/github.com/coreos -ln -s "${origpwd}" $GOPATH/src/github.com/coreos/kube-etcd-controller -cd $GOPATH/src/github.com/coreos/kube-etcd-controller +ln -s "${origpwd}" $GOPATH/src/github.com/coreos/etcd-operator +cd $GOPATH/src/github.com/coreos/etcd-operator cleanup() { echo "cleaning up ===" @@ -27,10 +27,10 @@ trap cleanup EXIT glide install GIT_VERSION=$(git rev-parse HEAD) -export CONTROLLER_IMAGE="gcr.io/coreos-k8s-scale-testing/kube-etcd-controller:${GIT_VERSION}" +export OPERATOR_IMAGE="gcr.io/coreos-k8s-scale-testing/etcd-operator:${GIT_VERSION}" export TEST_NAMESPACE="e2e-test-${BUILD_ID}" -echo "controller image: ${CONTROLLER_IMAGE}" +echo "operator image: ${OPERATOR_IMAGE}" echo "test namespace: ${TEST_NAMESPACE}" if "hack/test"; then diff --git a/hack/release/README.md b/hack/release/README.md index 4a23886..3f855ee 100644 --- a/hack/release/README.md +++ b/hack/release/README.md @@ -1,7 +1,7 @@ Release Workflow ====== -This docs describes the release process of kube-etcd-controller public docker image. +This docs describes the release process of etcd-operator public docker image. ## Prerequisites @@ -13,7 +13,7 @@ Make sure you have a quay.io account. ## Build image -Make sure your working directory is root of "kube-etcd-controller/". +Make sure your working directory is root of "etcd-operator/". Install dependency if none exists: ``` @@ -23,7 +23,7 @@ You should see "vendor/". Build docker image ``` -$ docker build --tag quay.io/coreos/kube-etcd-controller:${TAG} -f hack/build/controller/Dockerfile . +$ docker build --tag quay.io/coreos/etcd-operator:${TAG} -f hack/build/controller/Dockerfile . ``` `${TAG}` is the release tag. For example, "v0.0.1", "latest". We also need to create a corresponding release on github with release note. @@ -38,6 +38,6 @@ Follow the prompts. Push docker image to quay.io: ``` -$ docker push quay.io/coreos/kube-etcd-controller:${TAG} +$ docker push quay.io/coreos/etcd-operator:${TAG} ``` `${TAG}` is the same as above. diff --git a/hack/test b/hack/test index cb8d8df..4064d57 100755 --- a/hack/test +++ b/hack/test @@ -40,12 +40,12 @@ function fmt_pass { } function build_pass { - IMAGE=$CONTROLLER_IMAGE hack/build/controller/build + IMAGE=$OPERATOR_IMAGE hack/build/operator/build } function e2e_pass { TEST_PKGS=`go list ./test/... | grep -v framework` - go test -v ${TEST_PKGS} --kubeconfig $KUBERNETES_KUBECONFIG_PATH --controller-image $CONTROLLER_IMAGE --namespace ${TEST_NAMESPACE} + go test -v ${TEST_PKGS} --kubeconfig $KUBERNETES_KUBECONFIG_PATH --operator-image $OPERATOR_IMAGE --namespace ${TEST_NAMESPACE} } for p in $PASSES; do diff --git a/pkg/analytics/client.go b/pkg/analytics/client.go index 22adb9b..073d435 100644 --- a/pkg/analytics/client.go +++ b/pkg/analytics/client.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -70,6 +70,6 @@ func ClusterDeleted() { send(ga.NewEvent(category, "cluster_deleted")) } -func ControllerStarted() { - send(ga.NewEvent(category, "controller_started")) +func OperatorStarted() { + send(ga.NewEvent(category, "opeartor_started")) } diff --git a/pkg/backup/backup.go b/pkg/backup/backup.go index a2a7fa1..08a6b98 100644 --- a/pkg/backup/backup.go +++ b/pkg/backup/backup.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The kube-etcd-etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,14 +22,14 @@ import ( "path/filepath" "time" - "golang.org/x/net/context" + "github.com/coreos/kube-etcd-etcd-operator/pkg/spec" + "github.com/coreos/kube-etcd-etcd-operator/pkg/util/constants" + "github.com/coreos/kube-etcd-etcd-operator/pkg/util/etcdutil" + "github.com/coreos/kube-etcd-etcd-operator/pkg/util/k8sutil" "github.com/Sirupsen/logrus" "github.com/coreos/etcd/clientv3" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" - "github.com/coreos/kube-etcd-controller/pkg/util/etcdutil" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" + "golang.org/x/net/context" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/unversioned" ) diff --git a/pkg/backup/http.go b/pkg/backup/http.go index 7f1b606..1ea8ddc 100644 --- a/pkg/backup/http.go +++ b/pkg/backup/http.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The kube-etcd-etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,8 +24,9 @@ import ( "strings" "time" + "github.com/coreos/kube-etcd-etcd-operator/pkg/util/constants" + "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" ) func (b *Backup) startHTTP() { diff --git a/pkg/chaos/chaos.go b/pkg/chaos/chaos.go index 4d544fd..a8ddae9 100644 --- a/pkg/chaos/chaos.go +++ b/pkg/chaos/chaos.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 8bee13b..c3e8bb6 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The kube-etcd-etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,12 +21,13 @@ import ( "sync" "time" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/constants" + "github.com/coreos/etcd-operator/pkg/util/etcdutil" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + log "github.com/Sirupsen/logrus" "github.com/coreos/etcd/clientv3" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" - "github.com/coreos/kube-etcd-controller/pkg/util/etcdutil" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" "github.com/pborman/uuid" "golang.org/x/net/context" k8sapi "k8s.io/kubernetes/pkg/api" @@ -298,7 +299,7 @@ func (c *Cluster) migrateSeedMember() error { // delete the original seed member from the etcd cluster. // now we have migrate the seed member into kubernetes. - // our controller not takes control over it. + // our etcd-operator not takes control over it. ctx, cancel = context.WithTimeout(context.Background(), constants.DefaultRequestTimeout) _, err = etcdcli.Cluster.MemberRemove(ctx, seedID) cancel() diff --git a/pkg/cluster/cluster_status.go b/pkg/cluster/cluster_status.go index 1a85a8f..e7ccc5a 100644 --- a/pkg/cluster/cluster_status.go +++ b/pkg/cluster/cluster_status.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/cluster/reconcile.go b/pkg/cluster/reconcile.go index 929d640..b2a3b53 100644 --- a/pkg/cluster/reconcile.go +++ b/pkg/cluster/reconcile.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The kube-etcd-etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,13 +19,14 @@ import ( "fmt" "net/http" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/constants" + "github.com/coreos/etcd-operator/pkg/util/etcdutil" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + log "github.com/Sirupsen/logrus" "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" - "github.com/coreos/kube-etcd-controller/pkg/util/etcdutil" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" "golang.org/x/net/context" "k8s.io/kubernetes/pkg/api" ) @@ -65,7 +66,7 @@ func (c *Cluster) reconcile(pods []*api.Pod) error { // // Definitions: // - running pods in k8s cluster -// - members in controller knowledge +// - members in etcd-operator knowledge // Steps: // 1. Remove all pods from running set that does not belong to member set. // 2. L consist of remaining pods of runnings diff --git a/pkg/cluster/upgrade.go b/pkg/cluster/upgrade.go index 1c2c8e0..f12d47b 100644 --- a/pkg/cluster/upgrade.go +++ b/pkg/cluster/upgrade.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,9 +17,10 @@ package cluster import ( "fmt" + "github.com/coreos/etcd-operator/pkg/util/etcdutil" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/pkg/util/etcdutil" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" ) func (c *Cluster) upgradeOneMember(m *etcdutil.Member) error { diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 2200faa..848a027 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,11 +23,12 @@ import ( "sync" "time" + "github.com/coreos/etcd-operator/pkg/analytics" + "github.com/coreos/etcd-operator/pkg/cluster" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + log "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/pkg/analytics" - "github.com/coreos/kube-etcd-controller/pkg/cluster" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" k8sapi "k8s.io/kubernetes/pkg/api" unversionedAPI "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" diff --git a/pkg/controller/etcd_cluster_list.go b/pkg/controller/etcd_cluster_list.go index 7dc649c..dc40115 100644 --- a/pkg/controller/etcd_cluster_list.go +++ b/pkg/controller/etcd_cluster_list.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,7 +15,8 @@ package controller import ( - "github.com/coreos/kube-etcd-controller/pkg/spec" + "github.com/coreos/etcd-operator/pkg/spec" + "k8s.io/kubernetes/pkg/api/unversioned" ) diff --git a/pkg/spec/backup.go b/pkg/spec/backup.go index 20ae6b4..2b193ad 100644 --- a/pkg/spec/backup.go +++ b/pkg/spec/backup.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/spec/cluster.go b/pkg/spec/cluster.go index e7ef461..587912e 100644 --- a/pkg/spec/cluster.go +++ b/pkg/spec/cluster.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ type EtcdCluster struct { type ClusterSpec struct { // Size is the expected size of the etcd cluster. - // The controller will eventually make the size of the running + // The etcd-operator will eventually make the size of the running // cluster equal to the expected size. // The vaild range of the size is from 1 to 7. Size int `json:"size"` @@ -37,11 +37,11 @@ type ClusterSpec struct { // labels. NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // AntiAffinity determines if the controller tries to avoid putting + // AntiAffinity determines if the etcd-operator tries to avoid putting // the etcd members in the same cluster onto the same node. AntiAffinity bool `json:"antiAffinity"` // Version is the expected version of the etcd cluster. - // The controller will eventually make the etcd cluster version + // The etcd-operator will eventually make the etcd cluster version // equal to the expected version. Version string `json:"version"` // Backup is the backup policy for the etcd cluster. diff --git a/pkg/util/constants/constants.go b/pkg/util/constants/constants.go index 89a0b7e..ad8ed46 100644 --- a/pkg/util/constants/constants.go +++ b/pkg/util/constants/constants.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/util/etcdutil/member.go b/pkg/util/etcdutil/member.go index edc52d3..b68a99b 100644 --- a/pkg/util/etcdutil/member.go +++ b/pkg/util/etcdutil/member.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/util/k8sutil/backup.go b/pkg/util/k8sutil/backup.go index ca94f0c..98ad34c 100644 --- a/pkg/util/k8sutil/backup.go +++ b/pkg/util/k8sutil/backup.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,9 +18,10 @@ import ( "fmt" "time" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/constants" + "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" unversionedAPI "k8s.io/kubernetes/pkg/api/unversioned" diff --git a/pkg/util/k8sutil/k8sutil.go b/pkg/util/k8sutil/k8sutil.go index 3057e1c..7ae8975 100644 --- a/pkg/util/k8sutil/k8sutil.go +++ b/pkg/util/k8sutil/k8sutil.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,9 +22,10 @@ import ( "strings" "time" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" - "github.com/coreos/kube-etcd-controller/pkg/util/etcdutil" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/constants" + "github.com/coreos/etcd-operator/pkg/util/etcdutil" + "k8s.io/kubernetes/pkg/api" apierrors "k8s.io/kubernetes/pkg/api/errors" unversionedAPI "k8s.io/kubernetes/pkg/api/unversioned" diff --git a/test/e2e/README.md b/test/e2e/README.md index 05482a9..c3d254e 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -12,5 +12,5 @@ Prerequisites: e2e tests are written as go test. All go test techniques applies, e.g. picking what to run, timeout length. Let's say I want to run all tests in "test/e2e/": ``` -$ go test -v ./test/e2e/ --kubeconfig "$HOME/.kube/config" --controller-image gcr.io/coreos-k8s-scale-testing/kube-etcd-controller:latest +$ go test -v ./test/e2e/ --kubeconfig "$HOME/.kube/config" --controller-image gcr.io/coreos-k8s-scale-testing/etcd-operator:latest ``` diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 01e3720..56b276c 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,11 +23,12 @@ import ( "testing" "time" - "github.com/coreos/kube-etcd-controller/pkg/cluster" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/pkg/util/constants" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" - "github.com/coreos/kube-etcd-controller/test/e2e/framework" + "github.com/coreos/etcd-operator/pkg/cluster" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/pkg/util/constants" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + "github.com/coreos/etcd-operator/test/e2e/framework" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" k8sclient "k8s.io/kubernetes/pkg/client/unversioned" @@ -365,12 +366,12 @@ func deleteEtcdCluster(f *framework.Framework, name string) error { } buf := bytes.NewBuffer(nil) - if err := getLogs(f.KubeClient, f.Namespace.Name, "kube-etcd-controller", "kube-etcd-controller", buf); err != nil { + if err := getLogs(f.KubeClient, f.Namespace.Name, "etcd-operator", "etcd-operator", buf); err != nil { return err } - fmt.Println("kube-etcd-controller logs ===") + fmt.Println("etcd-operator logs ===") fmt.Println(buf.String()) - fmt.Println("kube-etcd-controller logs END ===") + fmt.Println("etcd-operator logs END ===") req, err := http.NewRequest("DELETE", fmt.Sprintf("%s/apis/coreos.com/v1/namespaces/%s/etcdclusters/%s", f.MasterHost, f.Namespace.Name, name), nil) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index c6209cf..38c87c7 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,9 @@ import ( "flag" "time" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" @@ -36,7 +37,7 @@ type Framework struct { // Setup setups a test framework and points "Global" to it. func Setup() error { kubeconfig := flag.String("kubeconfig", "", "kube config path, e.g. $HOME/.kube/config") - ctrlImage := flag.String("controller-image", "", "controller image, e.g. gcr.io/coreos-k8s-scale-testing/kube-etcd-controller") + opImage := flag.String("operator-image", "", "operator image, e.g. gcr.io/coreos-k8s-scale-testing/etcd-operator") ns := flag.String("namespace", "default", "e2e test namespace") flag.Parse() @@ -67,7 +68,7 @@ func Setup() error { KubeClient: cli, Namespace: namespace, } - return Global.setup(*ctrlImage) + return Global.setup(*opImage) } func Teardown() error { @@ -82,27 +83,27 @@ func Teardown() error { return nil } -func (f *Framework) setup(ctrlImage string) error { - if err := f.setupEtcdController(ctrlImage); err != nil { - logrus.Errorf("fail to setup etcd controller: %v", err) +func (f *Framework) setup(opImage string) error { + if err := f.setupEtcdOperator(opImage); err != nil { + logrus.Errorf("fail to setup etcd operator: %v", err) return err } logrus.Info("e2e setup successfully") return nil } -func (f *Framework) setupEtcdController(ctrlImage string) error { +func (f *Framework) setupEtcdOperator(opImage string) error { // TODO: unify this and the yaml file in example/ pod := &api.Pod{ ObjectMeta: api.ObjectMeta{ - Name: "kube-etcd-controller", - Labels: map[string]string{"name": "kube-etcd-controller"}, + Name: "etcd-operator", + Labels: map[string]string{"name": "etcd-operator"}, }, Spec: api.PodSpec{ Containers: []api.Container{ { - Name: "kube-etcd-controller", - Image: ctrlImage, + Name: "etcd-operator", + Image: opImage, Env: []api.EnvVar{ { Name: "MY_POD_NAMESPACE", @@ -124,6 +125,6 @@ func (f *Framework) setupEtcdController(ctrlImage string) error { return err } - logrus.Info("etcd controller created successfully") + logrus.Info("etcd operator created successfully") return nil } diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 2a47013..badaf46 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,9 @@ import ( "os" "testing" + "github.com/coreos/etcd-operator/test/e2e/framework" + "github.com/Sirupsen/logrus" - "github.com/coreos/kube-etcd-controller/test/e2e/framework" ) func TestMain(m *testing.M) { diff --git a/test/e2e/seed_migration_test.go b/test/e2e/seed_migration_test.go index d6f2c80..7dbd897 100644 --- a/test/e2e/seed_migration_test.go +++ b/test/e2e/seed_migration_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,9 +21,10 @@ import ( "path" "testing" + "github.com/coreos/etcd-operator/pkg/spec" + "github.com/coreos/etcd-operator/test/e2e/framework" + "github.com/coreos/etcd/embed" - "github.com/coreos/kube-etcd-controller/pkg/spec" - "github.com/coreos/kube-etcd-controller/test/e2e/framework" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" ) diff --git a/test/e2e/upgrade_test.go b/test/e2e/upgrade_test.go index fc7505d..6e0d4ba 100644 --- a/test/e2e/upgrade_test.go +++ b/test/e2e/upgrade_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,8 +17,9 @@ package e2e import ( "testing" - "github.com/coreos/kube-etcd-controller/pkg/util/k8sutil" - "github.com/coreos/kube-etcd-controller/test/e2e/framework" + "github.com/coreos/etcd-operator/pkg/util/k8sutil" + "github.com/coreos/etcd-operator/test/e2e/framework" + "k8s.io/kubernetes/pkg/api" ) diff --git a/version/version.go b/version/version.go index fbf4c45..a1854a0 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ -// Copyright 2016 The kube-etcd-controller Authors +// Copyright 2016 The etcd-operator Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.