Skip to content

Commit

Permalink
Bump version to 0.1.1
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Jausovec <peter.jausovec@gmail.com>
  • Loading branch information
peterj committed May 2, 2018
1 parent 1662dcc commit d9d45bf
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 30 deletions.
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Contributing to Create Kubernetes App
# Contributing to `kapp`

TODO
creating a new release

1. `make bump-version`
2. `make all`
3. `make release`
4. `make tag`
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CURRENT_DIR?=$(shell pwd)
BUILDDIR:=$(CURRENT_DIR)/release

NAME:=kapp
PKG:=github.com/peterj/kapp
PKG:=github.com/peterj/$(NAME)
GOOSARCHES=darwin/amd64
VERSION_FILE:=VERSION.txt

Expand Down Expand Up @@ -69,3 +72,24 @@ bump-version:
echo $(NEW_VERSION) > VERSION.txt
git add VERSION.txt README.md
git commit -vsam "Bump version to $(NEW_VERSION)"

# Create a new git tag to prepare to build a release
.PHONY: tag
tag:
git tag -sa $(VERSION) -m "$(VERSION)"
@echo "Run git push origin $(VERSION) to push your new tag to GitHub and trigger build."

define buildrelease
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=1 go build \
-o $(BUILDDIR)/$(NAME)-$(1)-$(2) \
-a -tags "$(BUILDTAGS) static_build netgo" \
-installsuffix netgo ${GO_LDFLAGS_STATIC} .;
md5sum $(BUILDDIR)/$(NAME)-$(1)-$(2) > $(BUILDDIR)/$(NAME)-$(1)-$(2).md5;
shasum -a 256 $(BUILDDIR)/$(NAME)-$(1)-$(2) > $(BUILDDIR)/$(NAME)-$(1)-$(2).sha256;
endef

# Builds the cross-compiled binaries, naming them in such a way for release (eg. binary-GOOS-GOARCH)
.PHONY: release
release: *.go VERSION.txt
@echo "+ $@"
$(foreach GOOSARCH,$(GOOSARCHES), $(call buildrelease,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH))))
70 changes: 44 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Create Go apps/services that run on Kubernetes with minimal configuration.
Inspiration for this project came from
[create-react-app](https://github.com/facebook/create-react-app) project.

* [Prerequisites](#prerequisites)
* [Creating an App](#creating-an-app) - How to create a new Kubernetes app
* [Development Workflow](#development-workflow)

Tool was developed and tested on macOS. There's no guarantee that it works on
other platforms. If you run into any issues, please
Expand Down Expand Up @@ -37,6 +39,18 @@ Run the app with `./helloworld` and access it at http://localhost:8080/.

![kapp demo GIT](img/kapp-create.gif)

# Prerequisites

* [Go](https://golang.org/dl/)
* [Docker](https://www.docker.com/docker-mac)
* [Helm](https://helm.sh/)
* [Dep](https://github.com/golang/dep)
* [Git](https://git-scm.com/)
* Kubernetes cluster - you can also use Kubernetes support in
[Docker for Mac](https://www.docker.com/docker-mac),
[Minikube](https://github.com/kubernetes/minikube) or an actual cluster from
one of the cloud providers

## Creating an app

To create a new Kubernetes app, run the following command:
Expand Down Expand Up @@ -76,44 +90,44 @@ helloworld
The inital workflow for getting your app running in Kubernetes involves these
steps:

1. Build the app image
2. Push the app image to the registry
3. Create intial app release
4. Interact with the app
1. [Build the app image](#build-the-image)
2. [Push the app image to the registry](#push-the-image)
3. [Create intial app release (first deployment)](#first-deployment)
4. [Interact with the app](#interact-with-the-app)
5. Deploy app updates

After you've create the inital release you will be following a similar workflow
where you make some changes to your app, bump the version (or not), deploy the
updated app and interact with it.
After you have created the inital release (step #3) you will be

#### Build the image

Makefile task `build.image` can be used to build and tag the Docker image with
your app. Before running `make build.image`, make sure you login to the image
registry you want to use and set the `DOCKER_REGISTRY` environment variable.
Makefile task `build.image` can be used to build the Docker image that contains
your app and tag that image. Note that before you run `make build.image`, you
have to do these two things:

Here's an example on how to set the image registry (note: if you're using a
different registry, you can provide the URL to the registry by running
`docker login [registry]`):
1. Login to the image registry you want to use
2. Set the `DOCKER_REGISTRY` environment variable to that registry

Below is an example on how to set the image registry and run the `build.image`
task:

```bash
$ cd helloworld

# Login to the hub.docker.com
# Login to the hub.docker.com (or any other image registry)
$ docker login

# Replace 'kubeapp' with your hub.docker.com username
$ export DOCKER_REGISTRY=kubeapp

# Builds the image in format: kubeapp/helloworld:0.1.0
# Build the image in format: kubeapp/helloworld:0.1.0
$ make build.image
-> build.image
docker build -f Dockerfile -t kubeapp/helloworld:0.1.0 .
... (Docker build output) ...
Successfully tagged kubeapp/helloworld:0.1.0
```

#### Push the image to registry
#### Push the image

With image built, you can use `make push.image` task to push the built image to
the registry:
Expand All @@ -127,10 +141,12 @@ The push refers to repository [docker.io/kubeapp/helloworld]
0.1.0: digest: sha256:b13772ff86c9f2691bfd56a6cbdc73d3456886f8b85385a43699706f0471c866 size: 1156
```

#### Create initial app release
#### First deployment

Task `install.app` is used to create an inital installation/deployment of your
app to Kubernetes.
app to Kubernetes. Before running this task, you need to ensure you have Helm
installed and initialized on the cluster and your current cluster context is set
to the cluster you want to deploy the app to.

```bash
$ make install.app
Expand All @@ -156,19 +172,20 @@ helloworld-65b5fdc94f-42664 0/1 ContainerCreating 0 0s
```

The `install.app` task will install your application in `helloworld` namespace.
The initial installation creates a deployment as well as a service you can use
to access the application. You can run the following Helm command to check make
sure your app is installed:
The initial installation creates a Kubernetes deployment as well as a Kubernetes
service you can use to access the application.

To double check your app is deployed, run the following Helm command:

```bash
$ helm list
NAME REVISION UPDATED STATUS CHART NAMESPACE
helloworld 1 Tue May 1 16:25:54 2018 DEPLOYED helloworld-0.1.0 helloworld
```

Alternatively, you can use `kubectl` to check the resources that were created
(below we are getting all services and deployments from the `helloworld`
namespace that have a label called `app` set to `helloworld`):
Alternatively, you can use `kubectl` to check the created resources. With the
command in the example below, we are getting all services and deployments from
the `helloworld` namespace that have a label called `app` set to `helloworld`:

```bash
$ kubectl get svc,deploy -l app=helloworld -n helloworld
Expand All @@ -181,8 +198,9 @@ deploy/helloworld 1 1 1 1 2m

#### Interact with the app

Now that the app is deployed we can interact with it. The simples way is to use
Kubernetes proxy to create a connection to the cluster:
Now that your app is deployed and running in Kubernetes, you can interact with
it. There are a couple of different ways you could interact with the app, the
simplest being Kubernetes proxy to create a connection to the cluster:

```bash
# Create a proxy to the cluster and run it in the background
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1

0 comments on commit d9d45bf

Please sign in to comment.