Skip to content

Commit

Permalink
Update etcd default ports for v3, and validate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy St. Clair committed Aug 17, 2016
1 parent aedeccd commit 730fc70
Show file tree
Hide file tree
Showing 26 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion cluster/centos/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export NUM_NODES=${NUM_NODES:-2}
export NUM_NODES=${NUM_NODES}

# By default, the cluster will use the etcd installed on master.
export ETCD_SERVERS=${ETCD_SERVERS:-"http://$MASTER_IP:4001"}
export ETCD_SERVERS=${ETCD_SERVERS:-"http://$MASTER_IP:2379"}

# define the IP range used for service cluster IPs.
# according to rfc 1918 ref: https://tools.ietf.org/html/rfc1918 choose a private ip range here.
Expand Down
2 changes: 1 addition & 1 deletion cluster/centos/master/scripts/apiserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


MASTER_ADDRESS=${1:-"8.8.8.18"}
ETCD_SERVERS=${2:-"http://8.8.8.18:4001"}
ETCD_SERVERS=${2:-"http://8.8.8.18:2379"}
SERVICE_CLUSTER_IP_RANGE=${3:-"10.10.10.0/24"}
ADMISSION_CONTROL=${4:-""}

Expand Down
4 changes: 2 additions & 2 deletions cluster/centos/master/scripts/etcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ETCD_DATA_DIR="${etcd_data_dir}/default.etcd"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
#ETCD_LISTEN_PEER_URLS="http://localhost:2380,http://localhost:7001"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:4001"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
#ETCD_CORS=""
Expand All @@ -40,7 +40,7 @@ ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:4001"
#ETCD_INITIAL_CLUSTER="default=http://localhost:2380,default=http://localhost:7001"
#ETCD_INITIAL_CLUSTER_STATE="new"
#ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379,http://localhost:4001"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
#ETCD_DISCOVERY=""
#ETCD_DISCOVERY_SRV=""
#ETCD_DISCOVERY_FALLBACK="proxy"
Expand Down
2 changes: 1 addition & 1 deletion cluster/centos/node/scripts/flannel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.


ETCD_SERVERS=${1:-"http://8.8.8.18:4001"}
ETCD_SERVERS=${1:-"http://8.8.8.18:2379"}
FLANNEL_NET=${2:-"172.16.0.0/16"}


Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/coreos/configure-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function configure-kube-apiserver() {
echo "Configuring kube-apiserver"

# Wait for etcd to be up.
wait-url-up http://127.0.0.1:4001/version
wait-url-up http://127.0.0.1:2379/version

touch /var/log/kube-apiserver.log

Expand Down
10 changes: 5 additions & 5 deletions cluster/gce/coreos/kube-manifests/etcd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ spec:
- -c
- /usr/local/bin/etcd
--listen-peer-urls=http://127.0.0.1:2380
--advertise-client-urls=http://127.0.0.1:4001
--listen-client-urls=http://127.0.0.1:4001
--advertise-client-urls=http://127.0.0.1:2379
--listen-client-urls=http://127.0.0.1:2379
--data-dir=/var/etcd/data
1>>/var/log/etcd.log 2>&1
image: gcr.io/google_containers/etcd:3.0.4
Expand All @@ -20,7 +20,7 @@ spec:
httpGet:
host: 127.0.0.1
path: /health
port: 4001
port: 2379
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 15
Expand All @@ -30,8 +30,8 @@ spec:
hostPort: 2380
name: serverport
protocol: TCP
- containerPort: 4001
hostPort: 4001
- containerPort: 2379
hostPort: 2379
name: clientport
protocol: TCP
resources:
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/coreos/kube-manifests/kube-apiserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- -c
- /usr/local/bin/kube-apiserver
--address=127.0.0.1
--etcd-servers=http://127.0.0.1:4001
--etcd-servers=http://127.0.0.1:2379
--etcd-servers-overrides=/events#http://127.0.0.1:4002
--cloud-provider=gce
--admission-control=${ADMISSION_CONTROL}
Expand Down
4 changes: 2 additions & 2 deletions cluster/gce/gci/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ function start-etcd-servers {
rm -f /etc/init.d/etcd
fi
prepare-log-file /var/log/etcd.log
prepare-etcd-manifest "" "4001" "2380" "200m" "etcd.manifest"
prepare-etcd-manifest "" "2379" "2380" "200m" "etcd.manifest"

prepare-log-file /var/log/etcd-events.log
prepare-etcd-manifest "-events" "4002" "2381" "100m" "etcd-events.manifest"
Expand Down Expand Up @@ -630,7 +630,7 @@ function start-kube-apiserver {
params+=" --basic-auth-file=/etc/srv/kubernetes/basic_auth.csv"
params+=" --cloud-provider=gce"
params+=" --client-ca-file=/etc/srv/kubernetes/ca.crt"
params+=" --etcd-servers=http://127.0.0.1:4001"
params+=" --etcd-servers=http://127.0.0.1:2379"
params+=" --etcd-servers-overrides=/events#http://127.0.0.1:4002"
params+=" --secure-port=443"
params+=" --tls-cert-file=/etc/srv/kubernetes/server.cert"
Expand Down
4 changes: 2 additions & 2 deletions cluster/gce/trusty/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ start_etcd_servers() {
rm -f /etc/init.d/etcd
fi
prepare_log_file /var/log/etcd.log
prepare_etcd_manifest "" "4001" "2380" "200m" "etcd.manifest"
prepare_etcd_manifest "" "2379" "2380" "200m" "etcd.manifest"

prepare_log_file /var/log/etcd-events.log
prepare_etcd_manifest "-events" "4002" "2381" "100m" "etcd-events.manifest"
Expand Down Expand Up @@ -508,7 +508,7 @@ start_kube_apiserver() {
params="${APISERVER_TEST_ARGS:-} ${API_SERVER_TEST_LOG_LEVEL:-"--v=2"} ${CLOUD_CONFIG_OPT}"
params="${params} --cloud-provider=gce"
params="${params} --address=127.0.0.1"
params="${params} --etcd-servers=http://127.0.0.1:4001"
params="${params} --etcd-servers=http://127.0.0.1:2379"
params="${params} --tls-cert-file=/etc/srv/kubernetes/server.cert"
params="${params} --tls-private-key-file=/etc/srv/kubernetes/server.key"
params="${params} --secure-port=443"
Expand Down
4 changes: 2 additions & 2 deletions cluster/images/hyperkube/static-pods/etcd.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"image": "gcr.io/google_containers/etcd-ARCH:3.0.4",
"command": [
"/usr/local/bin/etcd",
"--listen-client-urls=http://127.0.0.1:4001",
"--advertise-client-urls=http://127.0.0.1:4001",
"--listen-client-urls=http://127.0.0.1:2379",
"--advertise-client-urls=http://127.0.0.1:2379",
"--data-dir=/var/etcd/data"
],
"volumeMounts": [
Expand Down
2 changes: 1 addition & 1 deletion cluster/images/hyperkube/static-pods/master-multi.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"apiserver",
"--service-cluster-ip-range=10.0.0.1/24",
"--insecure-bind-address=0.0.0.0",
"--etcd-servers=http://127.0.0.1:4001",
"--etcd-servers=http://127.0.0.1:2379",
"--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota",
"--client-ca-file=/srv/kubernetes/ca.crt",
"--basic-auth-file=/srv/kubernetes/basic_auth.csv",
Expand Down
2 changes: 1 addition & 1 deletion cluster/images/hyperkube/static-pods/master.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"apiserver",
"--service-cluster-ip-range=10.0.0.1/24",
"--insecure-bind-address=127.0.0.1",
"--etcd-servers=http://127.0.0.1:4001",
"--etcd-servers=http://127.0.0.1:2379",
"--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota",
"--client-ca-file=/srv/kubernetes/ca.crt",
"--basic-auth-file=/srv/kubernetes/basic_auth.csv",
Expand Down
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/etcd/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ touch /var/log/etcd-events.log:
- dir_mode: 755
- context:
suffix: ""
port: 4001
port: 2379
server_port: 2380
cpulimit: '"200m"'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{% if pillar['storage_backend'] is defined -%}
{% set storage_backend = "--storage-backend=" + pillar['storage_backend'] -%}
{% endif -%}
{% set etcd_servers = "--etcd-servers=http://127.0.0.1:4001" -%}
{% set etcd_servers = "--etcd-servers=http://127.0.0.1:2379" -%}
{% set etcd_servers_overrides = "--etcd-servers-overrides=/events#http://127.0.0.1:4002" -%}

{% set target_ram_mb = "" -%}
Expand Down
8 changes: 4 additions & 4 deletions docs/admin/high-availability/etcd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ spec:
- --listen-peer-urls
- http://${NODE_IP}:2380
- --advertise-client-urls
- http://${NODE_IP}:4001
- http://${NODE_IP}:2379
- --listen-client-urls
- http://127.0.0.1:4001
- http://127.0.0.1:2379
- --data-dir
- /var/etcd/data
- --discovery
Expand All @@ -27,8 +27,8 @@ spec:
- containerPort: 2380
hostPort: 2380
name: serverport
- containerPort: 4001
hostPort: 4001
- containerPort: 2379
hostPort: 2379
name: clientport
volumeMounts:
- mountPath: /var/etcd
Expand Down
4 changes: 2 additions & 2 deletions examples/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (
func newStorageFactory() genericapiserver.StorageFactory {
config := storagebackend.Config{
Prefix: genericoptions.DefaultEtcdPathPrefix,
ServerList: []string{"http://127.0.0.1:4001"},
ServerList: []string{"http://127.0.0.1:2379"},
}
storageFactory := genericapiserver.NewDefaultStorageFactory(config, "application/json", api.Codecs, genericapiserver.NewDefaultResourceEncodingConfig(), genericapiserver.NewResourceConfig())

Expand All @@ -61,7 +61,7 @@ func Run(serverOptions *genericoptions.ServerRunOptions) error {
// Set ServiceClusterIPRange
_, serviceClusterIPRange, _ := net.ParseCIDR("10.0.0.0/24")
serverOptions.ServiceClusterIPRange = *serviceClusterIPRange
serverOptions.StorageConfig.ServerList = []string{"http://127.0.0.1:4001"}
serverOptions.StorageConfig.ServerList = []string{"http://127.0.0.1:2379"}
genericvalidation.ValidateRunOptions(serverOptions)
genericvalidation.VerifyEtcdServersList(serverOptions)
config := genericapiserver.NewConfig(serverOptions)
Expand Down
2 changes: 1 addition & 1 deletion federation/cmd/federation-apiserver/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestRun(t *testing.T) {
s.InsecurePort = insecurePort
_, ipNet, _ := net.ParseCIDR("10.10.10.0/24")
s.ServiceClusterIPRange = *ipNet
s.StorageConfig.ServerList = []string{"http://localhost:4001"}
s.StorageConfig.ServerList = []string{"http://localhost:2379"}
go func() {
if err := Run(s); err != nil {
t.Fatalf("Error in bringing up the server: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion hack/lib/etcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

ETCD_VERSION=${ETCD_VERSION:-3.0.4}
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-4001}
ETCD_PORT=${ETCD_PORT:-2379}

kube::etcd::start() {
which etcd >/dev/null || {
Expand Down
4 changes: 2 additions & 2 deletions hack/make-rules/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ make -C "${KUBE_ROOT}" WHAT="${BINS[*]}"
kube::etcd::start

ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-4001}
ETCD_PORT=${ETCD_PORT:-2379}
API_PORT=${API_PORT:-8080}
API_HOST=${API_HOST:-127.0.0.1}
KUBELET_PORT=${KUBELET_PORT:-10250}
Expand Down Expand Up @@ -1842,7 +1842,7 @@ __EOF__
kube::test::if_has_string "${output_message}" '\"etcd-server\" exposed'
# Post-condition: generated service has both ports from the exposed pod
kube::test::get_object_assert 'service etcd-server' "{{$port_name}} {{$port_field}}" 'port-1 2380'
kube::test::get_object_assert 'service etcd-server' "{{$second_port_name}} {{$second_port_field}}" 'port-2 4001'
kube::test::get_object_assert 'service etcd-server' "{{$second_port_name}} {{$second_port_field}}" 'port-2 2379'
# Clean-up
kubectl delete svc etcd-server "${kube_flags[@]}"

Expand Down
2 changes: 1 addition & 1 deletion hack/test-update-storage-objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ KUBE_STORAGE_MEDIA_TYPE_JSON="application/json"
KUBE_STORAGE_MEDIA_TYPE_PROTOBUF="application/vnd.kubernetes.protobuf"

ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-4001}
ETCD_PORT=${ETCD_PORT:-2379}
ETCD_PREFIX=${ETCD_PREFIX:-randomPrefix}
API_PORT=${API_PORT:-8080}
API_HOST=${API_HOST:-127.0.0.1}
Expand Down
2 changes: 1 addition & 1 deletion hack/update-swagger-spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ apiserver=$(kube::util::find-binary "kube-apiserver")

TMP_DIR=$(mktemp -d /tmp/update-swagger-spec.XXXX)
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-4001}
ETCD_PORT=${ETCD_PORT:-2379}
API_PORT=${API_PORT:-8050}
API_HOST=${API_HOST:-127.0.0.1}
KUBELET_PORT=${KUBELET_PORT:-10250}
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/deep_copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ var benchmarkPod api.Pod = api.Pod{
Command: []string{
"/usr/local/bin/etcd",
"--addr",
"127.0.0.1:4001",
"127.0.0.1:2379",
"--bind-addr",
"127.0.0.1:4001",
"127.0.0.1:2379",
"--data-dir",
"/var/etcd/data",
},
Expand All @@ -86,8 +86,8 @@ var benchmarkPod api.Pod = api.Pod{
},
{
Name: "clientport",
HostPort: 4001,
ContainerPort: 4001,
HostPort: 2379,
ContainerPort: 2379,
Protocol: "TCP",
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/master/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func (m *Master) getServersToValidate(c *Config) map[string]apiserver.Server {
port, _ = strconv.Atoi(portString)
} else {
addr = etcdUrl.Host
port = 4001
port = 2379
}
// TODO: etcd health checking should be abstracted in the storage tier
serversToValidate[fmt.Sprintf("etcd-%d", ix)] = apiserver.Server{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/etcd_failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ var _ = framework.KubeDescribe("Etcd failure [Disruptive]", func() {
It("should recover from network partition with master", func() {
etcdFailTest(
f,
"sudo iptables -A INPUT -p tcp --destination-port 4001 -j DROP",
"sudo iptables -D INPUT -p tcp --destination-port 4001 -j DROP",
"sudo iptables -A INPUT -p tcp --destination-port 2379 -j DROP",
"sudo iptables -D INPUT -p tcp --destination-port 2379 -j DROP",
)
})

Expand Down
4 changes: 2 additions & 2 deletions test/integration/framework/etcd_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import (

// If you need to start an etcd instance by hand, you also need to insert a key
// for this check to pass (*any* key will do, eg:
//curl -L http://127.0.0.1:4001/v2/keys/message -XPUT -d value="Hello world").
//curl -L http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello world").
func init() {
RequireEtcd()
}

func GetEtcdURLFromEnv() string {
url := env.GetEnvAsStringOrFallback("KUBE_INTEGRATION_ETCD_URL", "http://127.0.0.1:4001")
url := env.GetEnvAsStringOrFallback("KUBE_INTEGRATION_ETCD_URL", "http://127.0.0.1:2379")
glog.V(4).Infof("Using KUBE_INTEGRATION_ETCD_URL=%q", url)
return url
}
Expand Down
6 changes: 3 additions & 3 deletions test/kubemark/start-kubemark-master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ fi
sudo docker run --net=host -v /var/etcd/data:/var/etcd/data -d \
gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
--listen-peer-urls http://127.0.0.1:2380 \
--advertise-client-urls=http://127.0.0.1:4001 \
--listen-client-urls=http://0.0.0.0:4001 \
--advertise-client-urls=http://127.0.0.1:2379 \
--listen-client-urls=http://0.0.0.0:2379 \
--data-dir=/var/etcd/data

# Increase the allowed number of open file descriptors
Expand All @@ -44,7 +44,7 @@ kubernetes/server/bin/kube-scheduler --master=127.0.0.1:8080 $(cat scheduler_fla

kubernetes/server/bin/kube-apiserver \
--address=0.0.0.0 \
--etcd-servers=http://127.0.0.1:4001 \
--etcd-servers=http://127.0.0.1:2379 \
--etcd-servers-overrides=/events#${EVENT_STORE_URL} \
--tls-cert-file=/srv/kubernetes/server.cert \
--tls-private-key-file=/srv/kubernetes/server.key \
Expand Down

0 comments on commit 730fc70

Please sign in to comment.