Merge pull request #306 from coreos/operator
*: rename kube-etcd-controller -> etcd-operator
This commit is contained in:
Коммит
31df6a72bf
44
README.md
44
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:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
|
@ -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.
|
||||
|
||||
-----
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
|
@ -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"]
|
|
@ -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}"
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"))
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче