Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c156835f
Commit
c156835f
authored
Jan 07, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19216 from luxas/etcd_cross_platform
Auto commit by PR queue bot
parents
0e36747d
c77d6f7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
22 deletions
+104
-22
.gitignore
cluster/images/etcd/.gitignore
+0
-4
Dockerfile
cluster/images/etcd/Dockerfile
+3
-3
Makefile
cluster/images/etcd/Makefile
+43
-15
build-etcd.sh
cluster/images/etcd/build-etcd.sh
+58
-0
No files found.
cluster/images/etcd/.gitignore
deleted
100644 → 0
View file @
0e36747d
etcd
etcdctl
etcd-*-linux-amd64.tar.gz
etcd-*-linux-amd64/
cluster/images/etcd/Dockerfile
View file @
c156835f
FROM
busybox
FROM
BASEIMAGE
MAINTAINER
Dawn Chen <dawnchen@google.com>
MAINTAINER
Dawn Chen <dawnchen@google.com>
ADD
./etcd /usr/local/bin/etcd
COPY
./etcd /usr/local/bin/etcd
ADD
./etcdctl /usr/local/bin/etcdctl
COPY
./etcdctl /usr/local/bin/etcdctl
cluster/images/etcd/Makefile
View file @
c156835f
.PHONY
:
clean build push
# Build the etcd image
#
# Usage:
# [TAG=2.2.1] [REGISTRY=gcr.io/google_containers] [ARCH=amd64] [BASEIMAGE=busybox] make (build|push)
IMAGE
=
etcd
TAG
?=
2.2.1
TAG
=
2.2.1
ARCH
?=
amd64
ETCD_VERSION
=
2.2.1
REGISTRY
?=
gcr.io/google_containers
OUTPUT_DIR
=
$(IMAGE)
-v
$(ETCD_VERSION)
-linux-amd64
TEMP_DIR
:=
$(
shell
mktemp
-d
)
clean
:
# Default base images for different architectures
rm
-rf
$(OUTPUT_DIR)
$(IMAGE)
-v
$(ETCD_VERSION)
-linux-amd64
.tar.gz etcd etcdctl
# '/' in images has to be written as '\\/'
ifeq
($(ARCH),amd64)
BASEIMAGE
?=
busybox
endif
ifeq
($(ARCH),arm)
BASEIMAGE
?=
hypriot
\\
/armhf-busybox
endif
build
:
clean
build
:
curl
-L
-O
https://github.com/coreos/etcd/releases/download/v
$(ETCD_VERSION)
/
$(IMAGE)
-v
$(ETCD_VERSION)
-linux-amd64
.tar.gz
# Download etcd source in a golang container and cross-compile it statically
tar
xzvf
$(IMAGE)
-v
$(ETCD_VERSION)
-linux-amd64
.tar.gz
# or download official binaries if the ARCH is amd64
cp
$(OUTPUT_DIR)
/etcd .
./build-etcd.sh
${
TAG
}
${
ARCH
}
${
TEMP_DIR
}
cp
$(OUTPUT_DIR)
/etcdctl .
docker build
-t
gcr.io/google_containers/
$(IMAGE)
:
$(TAG)
.
# Copy the content in this dir to the temp dir
cp
./*
${TEMP_DIR}
# Replace BASEIMAGE with the real base image
cd
${TEMP_DIR}
&&
sed
-i
"s/BASEIMAGE/${BASEIMAGE}/g"
Dockerfile
# And build the image
docker build -t ${REGISTRY}/etcd-${ARCH}
:
${TAG} ${TEMP_DIR}
ifeq
($(ARCH),amd64)
# Backward compatability. TODO: deprecate this image tag
docker tag -f ${REGISTRY}/etcd-${ARCH}
:
${TAG} ${REGISTRY}/etcd:${TAG}
endif
push
:
build
push
:
build
gcloud docker push gcr.io/google_containers/
$(IMAGE)
:
$(TAG)
gcloud docker push
${
REGISTRY
}
/etcd-
${
ARCH
}
:
${
TAG
}
# Backward compatability. TODO: deprecate this image tag
ifeq
($(ARCH),amd64)
gcloud docker push ${REGISTRY}/etcd
:
${TAG}
endif
all
:
push
all
:
build
.PHONY
:
build push
\ No newline at end of file
cluster/images/etcd/build-etcd.sh
0 → 100755
View file @
c156835f
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Build etcd from source in a docker container
# Require three arguments
if
[[
$#
!=
3
]]
;
then
echo
"Usage: ./build-etcd.sh TAG ARCH TARGET_DIR"
exit
fi
# Example tag should be 2.2.1, not v2.2.1
TAG
=
$1
ARCH
=
$2
TARGET_DIR
=
$3
GOLANG_VERSION
=
${
GOLANG_VERSION
:-
1
.5.2
}
GOARM
=
6
# Create the ${TARGET_DIR} directory, if it doesn't exist
mkdir
-p
${
TARGET_DIR
}
# Do not compile if we should make an image for amd64, use the "official" etcd binaries instead
if
[[
${
ARCH
}
==
"amd64"
]]
;
then
# Just download the binaries to ${TARGET_DIR}
curl
-sSL
https://github.com/coreos/etcd/releases/download/v
${
TAG
}
/etcd-v
${
TAG
}
-linux-amd64
.tar.gz |
tar
-xz
-C
${
TARGET_DIR
}
--strip-components
=
1
else
# Download etcd in a golang container and cross-compile it statically
CID
=
$(
docker run
-d
golang:
${
GOLANG_VERSION
}
/bin/sh
-c
\
"mkdir /etcd
\
&& curl -sSL https://github.com/coreos/etcd/archive/v
${
TAG
}
.tar.gz | tar -C /etcd -xz --strip-components=1
\
&& cd /etcd
\
&& GOARM=
${
GOARM
}
GOARCH=
${
ARCH
}
./build"
)
# Wait until etcd has compiled
docker
wait
${
CID
}
# Copy out the bin folder to ${TARGET_DIR}
docker
cp
${
CID
}
:/etcd/bin
${
TARGET_DIR
}
# Move the contents in bin to the target directory
mv
${
TARGET_DIR
}
/bin/
*
${
TARGET_DIR
}
fi
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment