-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #314 from zmerlynn/container_build
CI: Add container build
- Loading branch information
Showing
3 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,46 @@ | ||
.build/ | ||
# OSX leaves these everywhere on SMB shares | ||
._* | ||
|
||
# IntelliJ | ||
*.iml | ||
# OSX trash | ||
.DS_Store | ||
|
||
# Eclipse files | ||
.classpath | ||
.project | ||
.settings/** | ||
|
||
# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA | ||
.idea/ | ||
*.iml | ||
|
||
# Vscode files | ||
.vscode | ||
|
||
# Emacs save files | ||
*~ | ||
\#*\# | ||
.\#* | ||
|
||
# Vim-related files | ||
[._]*.s[a-w][a-z] | ||
[._]s[a-w][a-z] | ||
*.un~ | ||
Session.vim | ||
.netrwhist | ||
|
||
# Go test binaries | ||
*.test | ||
|
||
# Mercurial files | ||
**/.hg | ||
**/.hg* | ||
|
||
# Vagrant | ||
.vagrant | ||
network_closure.sh | ||
|
||
# make-related metadata | ||
/.make/ | ||
|
||
# Terraform plans get put here | ||
/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM golang:1.6-alpine | ||
|
||
# KOPS_GITISH: Modify to build at an explicit tag/gitish | ||
ARG KOPS_GITISH=HEAD | ||
|
||
# KUBECTL_SOURCE: Change to kubernetes-dev/ci for CI | ||
ARG KUBECTL_SOURCE=kubernetes-release/release | ||
|
||
# KUBECTL_TRACK: Currently latest from KUBECTL_SOURCE. Change to latest-1.3.txt, etc. if desired. | ||
ARG KUBECTL_TRACK=latest.txt | ||
|
||
ARG KUBECTL_ARCH=linux/amd64 | ||
|
||
RUN apk add --no-cache --update build-base curl git mercurial --virtual .kops-deps && \ | ||
go get -d k8s.io/kops && \ | ||
cd "${GOPATH}/src/k8s.io/kops" && git fetch origin && git reset --hard "${KOPS_GITISH}" && git clean -xdf && go get -d . && \ | ||
make && \ | ||
MODELS=$(readlink "${GOPATH}/bin/models") && rm "${GOPATH}/bin/models" && mv "${MODELS}" "${GOPATH}/bin/models" && \ | ||
GITISH=$(git show-ref -s --abbrev HEAD) && \ | ||
KUBECTL_VERSION=${KUBECTL_VERSION:-$(curl -SsL --retry 5 "https://storage.googleapis.com/${KUBECTL_SOURCE}/${KUBECTL_TRACK}")} && \ | ||
echo "=== Fetching kubectl ${KUBECTL_VERSION} ===" && \ | ||
curl -SsL --retry 5 "https://storage.googleapis.com/${KUBECTL_SOURCE}/${KUBECTL_VERSION}/${KUBECTL_ARCH}/kubectl" > /usr/local/bin/kubectl && \ | ||
chmod +x /usr/local/bin/kubectl && \ | ||
/usr/local/bin/kubectl version --client && \ | ||
cd / && rm -rf "${GOPATH}/src" && rm -rf "${GOPATH}/pkg" && rm -rf "/usr/local/go" && apk del .kops-deps && \ | ||
echo "=== Built kops at ${GITISH}, fetched kubectl ${KUBECTL_VERSION} ===" | ||
|
||
CMD "/go/bin/kops" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Running Kops in Docker | ||
|
||
The Dockerfile here is offered primarily as a way to build continuous | ||
integration versions of `kops` until we figure out how we want to | ||
release/package it. | ||
|
||
To use it, e.g. (assumes your `$HOME` is correct and that `$KOPS_STATE_STORE` is correct): | ||
```shell | ||
$ docker build -t kops . | ||
$ KOPS="docker run -v $HOME/.aws:/root/.aws:ro -v $HOME/.ssh:/root/.ssh:ro -v $HOME/.kube:/root/.kube -it kops kops --state=$KOPS_STATE_STORE" | ||
``` | ||
|
||
This creates a shell variable that runs the `kops` container with `~/.aws` mounted in (for AWS credentials), `~/.ssh` mounted in (for SSH keys, for AWS specifically), and `~/.kube` mounted in (so `kubectl` can add newly created clusters). | ||
|
||
After this, you can just use `$KOPS` where you would generally use `kops`, e.g. `$KOPS get cluster`. |