Skip to content

Commit

Permalink
Merge branch 'master' of github.com:engapa/zookeeper-k8s-openshift
Browse files Browse the repository at this point in the history
� Conflicts:
�	k8s/README.md
�	openshift/README.md
  • Loading branch information
engapa committed May 13, 2020
2 parents b16b003 + 32b5d36 commit d7f8349
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 48 deletions.
66 changes: 47 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ jobs:
docker:
- image: docker
steps:
- setup_remote_docker:
docker_layer_caching: true
- setup_remote_docker
- checkout
- run:
name: Docker login
Expand All @@ -16,26 +15,22 @@ jobs:
command: |
apk add --no-cache --virtual .build-deps make gcc
- run:
name: build docker image
name: build, test and push images
command: |
make docker-build
- run:
name: test of docker image
command: |
make docker-test
- run:
name: publish docker image
command: |
make docker-push
if [ "$CIRCLE_BRANCH" == "master" ]; then
docker build -t ${DOCKER_USERNAME}/zookeeper:latest .;
docker push ${DOCKER_USERNAME}/zookeeper:latest;
else
make docker-build docker-test docker-push;
fi
k8s:
machine:
image: circleci/classic:201808-01
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: update pkgs
command: sudo apt-get update && sudo apt-get install -f -y conntrack
- run:
name: install minikube and kubectl
command: make minikube-install
Expand All @@ -56,7 +51,7 @@ jobs:
command: make minikube-delete
openshift:
machine:
image: circleci/classic:201808-01
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
Expand All @@ -77,6 +72,27 @@ jobs:
- run:
name: delete local openshift cluster
command: make oc-cluster-clean
gh-tag-release:
docker:
- image: cibuilds/github:0.12.2
steps:
- checkout
- run:
name: Install essentials
command: |
apk add --no-cache --virtual .build-deps make gcc curl
- run:
name: Create a new tag
command: |
VERSION=v$(make version)
git tag -f ${VERSION}
git remote set-url origin https://${CIRCLE_PROJECT_USERNAME}:${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
git push -f --tags
- run:
name: Create a tag release on github
command: |
VERSION=v$(make version)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -b "Zookeeper version ${VERSION}" -delete ${VERSION} ./k8s
workflows:
version: 2
Expand All @@ -85,16 +101,28 @@ workflows:
- docker:
filters:
branches:
only: master
only:
- /^\d+\.\d+$/
- master
- k8s:
requires:
- docker
- docker
filters:
branches:
only: master
only:
- /^\d+\.\d+$/
- openshift:
requires:
- docker
- docker
filters:
branches:
only:
- /^\d+\.\d+$/
- gh-tag-release:
requires:
- k8s
- openshift
filters:
branches:
only: master
only:
- /^\d+\.\d+$/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER Enrique Garcia <[email protected]>
ARG ZOO_HOME=/opt/zookeeper
ARG ZOO_USER=zookeeper
ARG ZOO_GROUP=zookeeper
ARG ZOO_VERSION="3.5.5"
ARG ZOO_VERSION="3.6.1"

ENV ZOO_HOME=$ZOO_HOME \
ZOO_VERSION=$ZOO_VERSION \
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DOCKER_ORG ?= engapa
DOCKER_IMAGE ?= zookeeper

ZK_VERSION ?= 3.5.5
ZK_VERSION ?= 3.6.1

.PHONY: help
help: ## Show this help
Expand Down Expand Up @@ -86,4 +86,8 @@ oc-cluster-test-persistent: ## Launch tests on our local openshift cluster with
oc-cluster-clean: ## Remove openshift cluster
@openshift/main.sh oc-cluster-clean

.PHONY: version
version: ## Get version
@echo $(ZK_VERSION)

## TODO: helm, ksonnet for deploy on kubernetes
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Zookeeper Docker Image
[![Build status](https://circleci.com/gh/engapa/zookeeper-k8s-openshift/tree/master.svg?style=svg "Build status")](https://circleci.com/gh/engapa/zookeeper-k8s-openshift/tree/master)
[![License status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fengapa%2Fzookeeper-k8s-openshift.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fengapa%2Fzookeeper-k8s-openshift?ref=badge_shield)
[![Docker Pulls](https://img.shields.io/docker/pulls/engapa/zookeeper.svg)](https://hub.docker.com/r/engapa/zookeeper/)
[![Docker Layering](https://images.microbadger.com/badges/image/engapa/zookeeper.svg)](https://microbadger.com/images/engapa/zookeeper)
[![Docker image version](https://images.microbadger.com/badges/version/engapa/zookeeper.svg)](https://microbadger.com/images/engapa/zookeeper)
![OSS](https://badges.frapsoft.com/os/v1/open-source.svg?v=103 "We love OpenSource")

This project aims to provide zookeeper docker images and prepare them to be deployed as 'statefulsets' on kubernetes.
This project aims to provide zookeeper docker images and prepare them to be deployed as 'statefulsets' on kubernetes (openshift).

These scripts are used to build/run the docker image/container:

Expand All @@ -16,7 +14,7 @@ These scripts are used to build/run the docker image/container:

## Build and push the docker image

Set env variables DOCKER_ORG (defaults to engapa), DOCKER_IMAGE (defaults to zookeeper) and ZOO_VERSION (the real zookeeper version that will be downloaded into the docker image)
Set env variables DOCKER_ORG (defaults to `engapa`), DOCKER_IMAGE (defaults to `zookeeper`) and ZOO_VERSION (the real zookeeper version that will be downloaded into the docker image)
to tag docker image as you wish and then build, test and push:

```bash
Expand Down Expand Up @@ -66,10 +64,6 @@ Thanks to kubernetes team for the [contrib](https://github.com/kubernetes/contri

In [openshift directory](openshift) you can find some Openshift templates.

## License

[![License status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fengapa%2Fzookeeper-k8s-openshift.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fengapas%2Fzookeeper-k8s-openshift?ref=badge_large)

## Author

Enrique Garcia **[email protected]**
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Here we have some examples of resources that may be deployed on your kubernetes
## Requirements

- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
- Kubernetes (tested with version 1.17.0)
- Kubernetes

## Launch a cluster

Expand Down
2 changes: 1 addition & 1 deletion k8s/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Apache ZooKeeper enables highly reliable distributed coordination system.
name: zookeeper
version: 3.5.5
version: 3.6.1
keywords:
- zookeeper
home: https://zookeeper.apache.org/
Expand Down
8 changes: 4 additions & 4 deletions k8s/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ namespace:

```bash
$ helm repo add engapa http://storage.googleapis.com/kubernetes-charts-incubator
$ helm install --name zookeeper-3.5.5 engapa/zookeeper
$ helm install --name zookeeper-3.6.1 engapa/zookeeper
```

If you're using a dedicated namespace (recommended) then make sure the namespace
exists:

```bash
$ kubectl create ns zookeeper
$ helm install --name zookeeper-3.5.5 --set global.namespace=zookeeper engapa/zookeeper
$ helm install --name zookeeper-3.6.1 --set global.namespace=zookeeper engapa/zookeeper
```

The chart can be customized using the
Expand All @@ -31,7 +31,7 @@ following configurable parameters:
| ----------------------- | ----------------------------------- | ---------------------------------------------------------- |
| `Name` | Zookeeper resource names | `zk` |
| `Image` | Zookeeper container image name | `engapa/zookeeper` |
| `ImageTag` | Zookeeper container image tag | `3.5.5` |
| `ImageTag` | Zookeeper container image tag | `3.6.1` |
| `ImagePullPolicy` | Zookeeper container pull policy | `IfNotPresent` |
| `Replicas` | Zookeeper replicas | `3` |
| `Component` | Zookeeper k8s selector key | `zk` |
Expand All @@ -45,6 +45,6 @@ Specify parameters using `--set key=value[,key=value]` argument to `helm install
Alternatively a YAML file that specifies the values for the parameters can be provided like this:

```bash
$ helm install --name zookeeper-3.5.5 -f values.yaml engapa/zookeeper
$ helm install --name zookeeper-3.6.1 -f values.yaml engapa/zookeeper
```

2 changes: 1 addition & 1 deletion k8s/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: "zk"
Replicas: 1
Image: "engapa/zookeeper"
ImageTag: "3.5.5"
ImageTag: "3.6.1"
ImagePullPolicy: "IfNotPresent"
Cpu: "1"
Memory: "512M"
Expand Down
4 changes: 2 additions & 2 deletions k8s/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

MINIKUBE_VERSION=${MINIKUBE_VERSION:-"v1.2.0"}
KUBE_VERSION=${KUBE_VERSION:-"v1.15.0"}
MINIKUBE_VERSION=${MINIKUBE_VERSION:-"v1.10.1"}
KUBE_VERSION=${KUBE_VERSION:-"v1.18.2"}

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand Down
2 changes: 1 addition & 1 deletion k8s/zk-persistent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
containers:
- name: zk-persistent
imagePullPolicy: IfNotPresent
image: engapa/zookeeper:3.5.5
image: engapa/zookeeper:3.6.1
resources:
requests:
memory: 512M
Expand Down
2 changes: 1 addition & 1 deletion k8s/zk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
containers:
- name: zk
imagePullPolicy: IfNotPresent
image: engapa/zookeeper:3.5.5
image: engapa/zookeeper:3.6.1
resources:
requests:
memory: 512M
Expand Down
8 changes: 4 additions & 4 deletions openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It isn't necessary to clone this repo, you can use directly resource URLs.
## Requirements

- [oc](https://github.com/openshift/origin/releases) (v3.11)
- [minishift](https://github.com/minishift/minishift) (v1.34.2)
- [minishift](https://github.com/minishift/minishift) (v1.33.0)

### DEV environment

Expand Down Expand Up @@ -71,7 +71,7 @@ To build local docker images of zookeeper in your private Openshift registry jus

```bash
$ oc create -f buildconfig.yaml
$ oc new-app zk-builder -p GITHUB_REF="v3.5.5" -p IMAGE_STREAM_VERSION="v3.5.5"
$ oc new-app zk-builder -p GITHUB_REF="v3.6.1" -p IMAGE_STREAM_VERSION="v3.6.1"
```

If you want to get an image from another git commit:
Expand All @@ -85,15 +85,15 @@ Or build a local docker image from source directly:
$ ./main build_local_image
```

**NOTE**: If you want to use this local/private image from containers on other projects then use the "\<project\>/NAME" value as `SOURCE_IMAGE` parameter value, and use one value of "TAGS" as `ZOO_VERSION` parameter value (e.g: test/zookeeper:3.5.5).
**NOTE**: If you want to use this local/private image from containers on other projects then use the "\<project\>/NAME" value as `SOURCE_IMAGE` parameter value, and use one value of "TAGS" as `ZOO_VERSION` parameter value (e.g: test/zookeeper:3.6.1).

## Deploying zookeeper cluster

Just type next command to create a zookeeper cluster by using a statefulset on Openshift:

```bash
$ oc create -f zk[-persistent].yaml
$ oc new-app zk -p ZOO_REPLICAS=1 -p SOURCE_IMAGE="172.30.1.1:5000/myproject/zookeeper" -p ZOO_VERSION="3.5.7"
$ oc new-app zk -p ZOO_REPLICAS=1 -p SOURCE_IMAGE="172.30.1.1:5000/myproject/zookeeper" -p ZOO_VERSION="3.6.1"
```
> NOTE: select zk.yaml or zk-persistence.yaml, and set parameter values
Expand Down
2 changes: 1 addition & 1 deletion openshift/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

ZK_VERSION=${ZK_VERSION:-"3.5.5"}
ZK_VERSION=${ZK_VERSION:-"3.6.1"}
ZK_IMAGE="engapa/zookeeper:${ZK_VERSION}"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
2 changes: 1 addition & 1 deletion openshift/zk-persistent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ parameters:
required: true
- name: ZOO_VERSION
description: Version
value: "3.5.5"
value: "3.6.1"
required: true
- name: ZOO_REPLICAS
description: Number of nodes
Expand Down
2 changes: 1 addition & 1 deletion openshift/zk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ parameters:
required: true
- name: ZOO_VERSION
description: Version
value: "3.5.5"
value: "3.6.1"
required: true
- name: ZOO_REPLICAS
description: Number of nodes
Expand Down

0 comments on commit d7f8349

Please sign in to comment.