Sign inSign up

alehungate/crate-operator

By alehungate

•Updated over 5 years ago

A Kubernetes Operator to allow applications to request a Crate Cluster

Image
0

259

alehungate/crate-operator repository overview

⁠crate-operator

https://projects.limbicly.com/k8s/floss/crate-operator⁠

A Kubernetes operator to allow applications to request a managed crate cluster.

⁠What is an operator?

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.

⁠What is Crate?

Crate⁠ is a NoSQL, self clustering, self healing database with a PostreSQL compatibility layer.

⁠How do I deploy the operator?

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

⁠How do I request a Crate Cluster for my project?

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

Operator parameters are all string values in the spec: section. The following values are recognised:

  • image The docker image to use (Not including the version, see below). Default crate
  • version The version of the Crate docker image to run. Default latest
  • dataSize The size of PVC created for each instance in the Crate Cluster. Default 1Gi
  • clusterSize The number of nodes in the Crate Cluster. Default 3

The 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.

Tag summary

Content type

Image

Digest

Size

28.1 MB

Last updated

over 5 years ago

docker pull alehungate/crate-operator