Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
diagnose pod handling

ATM we can't create a cluster b/c the couchdb pods aren't ready
  • Loading branch information
nicolai86 committed Sep 2, 2017
0 parents commit f4fd080
Show file tree
Hide file tree
Showing 4,290 changed files with 1,950,518 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.9-alpine3.6

RUN apk add --no-cache --update git && \
go get -u github.com/golang/dep/cmd/dep
RUN git clone https://github.com/nicolai86/couchdb-operator /go/src/github.com/nicolai86/couchdb-operator && \
cd /go/src/github.com/nicolai86/couchdb-operator && \
dep ensure && \
go install github.com/nicolai86/couchdb-operator

FROM alpine:3.6

RUN apk --no-cache --update add ca-certificates && update-ca-certificates

COPY --from=0 /go/bin/couchdb-operator /

ENTRYPOINT ["/couchdb-operator"]
231 changes: 231 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"


[[constraint]]
branch = "master"
name = "github.com/nicolai86/couchdb-go"

[[override]]
name = "k8s.io/apimachinery"
branch = "release-1.7"

[[constraint]]
name = "k8s.io/client-go"
version = "4.0.0"
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# couchdb operator

this k8s operator allows you to run a 2.1 couchdb cluster on top of k8s.

## status

- [ ] operator
- [ ] CRD (CouchDB)
- [x] definition
- [ ] management custom object add (spawn cluster)
- [ ] management custom object update (update cluster)
- [ ] management custom object delete (delete cluster)
- [ ] deployment template (port, readyness, livelyness)
- [ ] cluster management
- [ ] new pod -> join cluster
- [ ] old pod gone -> leave cluster
- [x] operator definition
- [x] README

## guiding notes

see 7 principles taken from coreOS post: https://coreos.com/blog/introducing-operators.html and https://github.com/kubernetes/community/blob/master/contributors/devel/controllers.md
## prerequisites

- k8s >= 1.7.0

## usage

```
$ kubectl apply -f k8s/resource-type.yml
$ kubectl apply -f k8s/deployment.yml
```

now, you can deploy a couchdb cluster like this:

```
apiVersion: "stable.couchdb.org/v1"
kind: CouchDB
metadata:
name: my-couchdb-cluster
spec:
version: "2.1.0"
image: "nicolai86/couchdb"
replicas: 3
```
39 changes: 39 additions & 0 deletions example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: "stable.couchdb.org/v1"
kind: CouchDB
metadata:
name: my-couchdb-cluster
namespace: default
spec:
version: "2.1.0"
baseImage: "nicolai86/couchdb"
size: 3
pod:
labels:
app: couchdb
nodeSelector:
app: couchdb
antiAffinity: false
couchdbEnv:
- { name: COUCHDB_USER, value: admin }
- { name: COUCHDB_PASSWORD, value: admin }
---
kind: Service
apiVersion: v1
metadata:
name: couchdb
spec:
selector:
cluster: my-couchdb-cluster
app: couchdb
ports:
- protocol: TCP
port: 5986
name: "node-local"
targetPort: 5986
nodePort: 31986
- protocol: TCP
port: 5984
name: "standalone"
targetPort: 5984
nodePort: 31984
type: NodePort
24 changes: 24 additions & 0 deletions k8s/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: couchdb-operator
spec:
replicas: 1
template:
metadata:
labels:
name: couchdb-operator
spec:
containers:
- name: couchdb-operator
image: nicolai86/couchdb-operator:v0.0.1
imagePullPolicy: Always
env:
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OPERATOR_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
Loading

0 comments on commit f4fd080

Please sign in to comment.