A Kubernetes Operator to allow applications to request a Crate Cluster
259
https://projects.limbicly.com/k8s/floss/crate-operator
A Kubernetes operator to allow applications to request a managed crate cluster.
An operator is a type of Kubernetes addon that creates a new Kubernetes resource type (A Custom Resource Definition) and then listens for instances of that resource type to be created, modified or deleted and then takes an action.
In this case, the crate-operator creates a very simple CRD that defines
the simplest of details about a Crate DB cluster.
Crate is a NoSQL, self clustering, self healing database with a PostreSQL compatibility layer.
apiVersion: v1
kind: Namespace
metadata:
labels:
app: crate-operator
name: crate-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cc-clusterrole
labels:
app.kubernetes.io/name: crate-operator
app.kubernetes.io/part-of: crate-operator
rules:
- apiGroups:
- crate-operator.limbicly.com
resources:
- crates
verbs:
- list
- watch
- get
- update
- patch
- create
- delete
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- list
- create
- update
- patch
- get
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cc-binding
namespace: crate-operator
labels:
app.kubernetes.io/name: crate-operator
app.kubernetes.io/part-of: crate-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cc-clusterrole
subjects:
- kind: ServiceAccount
name: default
namespace: crate-operator
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: crate-operator
namespace: crate-operator
labels:
app: crate-operator
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
app: crate-operator
strategy:
type: Recreate
template:
metadata:
labels:
app: crate-operator
spec:
containers:
- image: alehungate/crate-operator:latest
name: crate-operator
You can request a Crate Cluster using the following syntax:
apiVersion: v1
kind: Namespace
metadata:
name: test-crate
---
apiVersion: crate-operator.limbicly.com/v1
kind: Crate
metadata:
name: simple
namespace: test-crate
spec:
clusterSize: "5"
Operator parameters are all string values in the spec: section. The following values are recognised:
cratelatest1Gi3The operator is namespaced meaning that whichever namespace you create the operator object in will be where the Create Cluster will be created.
The operator name (metadata --> name) is the name that is used
for the created objects that together form the Crate Cluster.
Content type
Image
Digest
Size
28.1 MB
Last updated
over 5 years ago
docker pull alehungate/crate-operator