Skip to content

Commit

Permalink
various bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Schooss committed Aug 24, 2018
1 parent 83722c6 commit f7387a8
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ifeq ($(LINUX_BUILD), 1)
endif

.PHONY: all
all: clean build-docker
all: clean code-gen build-docker

.PHONY: help
help:
Expand Down
74 changes: 62 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,89 @@
# m3db-operator

### Help
```
>make help
## Project Status: pre-Alpha

Usage:
make <target>
### Kubernetes cluster prerequisites

Targets:
build-bin Build m3db-operator binary
build-docker Build m3db-operator docker image with go binary
code-gen Generate boilerplate code for kubernetes packages
dep-ensure Run dep ensure to generate vendor directory
dep-install Ensure dep is installed
When running on GKE, the user applying the manifests will need the ability to
allow `cluster-admin-binding` during the installation. Use the following
`ClusterRoleBinding` with the user name provided by gloud

```
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=<[email protected]>
```

### Build and Deploy
### Build and Deploy M3 Cluster

Generate Go linux binary and push to a Docker registry

```
make -e IMAGE=<registry>/<repo>/m3db-operator -e LINUX_BUILD=1 build-docker
```

Update the [operator manifest](https://github.com/m3db/m3db-operator/blob/master/manifests/operator.yaml#L93) to include image location
```
... <snip>
spec:
containers:
- name: m3db-operator
image: <registry>/<repository>/m3db-operator:<gitsha>
ports:
- containerPort: 60000
... <snip>
```


Apply the persistent disk storage resource

```
kubectl apply -f example/storage-fast-gcp.yaml
```

Apply the `m3db-operator` operator

```
kubectl apply -f manifests/operator.yaml
```

Apply the `etcd` cluster

```
kubectl apply -f example/etcd.yaml
```

Apply the `m3db` cluster

```
kubectl apply -f example/example-m3db-cluster-gke.yaml
```

### Delete M3 Cluster

Delete M3 Cluster

```
kubectl delete -f example/example-m3db-cluster-gke.yaml
```

Delete M3DB Operator

```
kubectrl delete -f manifests/operator.yaml
```

### Help
```
>make help
Usage:
make <target>
Targets:
build-bin Build m3db-operator binary
build-docker Build m3db-operator docker image with go binary
code-gen Generate boilerplate code for kubernetes packages
dep-ensure Run dep ensure to generate vendor directory
dep-install Ensure dep is installed
```


4 changes: 2 additions & 2 deletions example/example-m3db-cluster-gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ spec:
data-volume-size: 10Gi
resources:
requests:
memory: 15Gi
memory: 6Gi
cpu: '1'
limits:
memory: 20Gi
memory: 8Gi
cpu: '2'
7 changes: 7 additions & 0 deletions example/storage-fast-gcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: fast
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
80 changes: 31 additions & 49 deletions manifests/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,35 @@ metadata:
labels:
name: operator
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: m3db-operator
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: m3db-operator
rules:
- apiGroups:
- extensions
resources:
- deployments
- replicasets
- daemonsets
verbs:
- create
- get
- update
- delete
- list
- apiGroups:
- operator.m3db.io
resources:
- "*"
verbs:
- "*"
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- configmaps
- secrets
verbs:
- "*"
- apiGroups:
- apps
resources:
- deployments
- statefulsets
verbs:
- "*"
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- "*"
- apiGroups: ["extensions"]
resources: ["deployments", "replicasets", "daemonsets"]
verbs: ["create", "get", "update", "delete", "list"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create", "get", "update", "delete", "list"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "create", "delete", "deletecollection"]
- apiGroups: [""]
resources: ["persistentvolumes", "persistentvolumeclaims", "services", "secrets", "configmaps"]
verbs: ["create", "get", "update", "delete", "list"]
- apiGroups: ["batch"]
resources: ["cronjobs", "jobs"]
verbs: ["create", "get", "deletecollection", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "get", "watch"]
- apiGroups: ["apps"]
resources: ["statefulsets", "deployments"]
verbs: ["*"]
- apiGroups: ["operator.m3db.io"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
Expand All @@ -73,6 +49,12 @@ subjects:
name: m3db-operator
namespace: operator
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: m3db-operator
namespace: operator
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -90,7 +72,7 @@ spec:
spec:
containers:
- name: m3db-operator
image: <registry>/<repo>/m3db-operator:latest
image: <registry>/<repository>/m3db-operator:<gitsha>
ports:
- containerPort: 60000
name: metrics
Expand Down
13 changes: 9 additions & 4 deletions pkg/k8sops/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,27 @@ func (k *K8sops) BuildM3DBNodeSvcPorts() []v1.ServicePort {
return []v1.ServicePort{
v1.ServicePort{
Name: "client",
Port: 9200,
Port: 9000,
Protocol: v1.ProtocolTCP,
},
v1.ServicePort{
Name: "cluster",
Port: 9201,
Port: 9001,
Protocol: v1.ProtocolTCP,
},
v1.ServicePort{
Name: "http-node",
Port: 9202,
Port: 9002,
Protocol: v1.ProtocolTCP,
},
v1.ServicePort{
Name: "http-cluster",
Port: 9003,
Protocol: v1.ProtocolTCP,
},
v1.ServicePort{
Name: "debug",
Port: 9204,
Port: 9004,
Protocol: v1.ProtocolTCP,
},
v1.ServicePort{
Expand Down
13 changes: 9 additions & 4 deletions pkg/k8sops/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,27 @@ func (k *K8sops) BuildM3DBNodePorts() []v1.ContainerPort {
return []v1.ContainerPort{
v1.ContainerPort{
Name: "client",
ContainerPort: 9200,
ContainerPort: 9000,
Protocol: v1.ProtocolTCP,
},
v1.ContainerPort{
Name: "cluster",
ContainerPort: 9201,
ContainerPort: 9001,
Protocol: v1.ProtocolTCP,
},
v1.ContainerPort{
Name: "http-node",
ContainerPort: 9202,
ContainerPort: 9002,
Protocol: v1.ProtocolTCP,
},
v1.ContainerPort{
Name: "http-cluster",
ContainerPort: 9003,
Protocol: v1.ProtocolTCP,
},
v1.ContainerPort{
Name: "debug",
ContainerPort: 9204,
ContainerPort: 9004,
Protocol: v1.ProtocolTCP,
},
v1.ContainerPort{
Expand Down

0 comments on commit f7387a8

Please sign in to comment.