Git Product home page Git Product logo

zookeeper-operator's Introduction

ZooKeeper Operator

License Language GoDoc Go Report Card Average time to resolve an issue Percentage of issues still open

Overview

ZooKeeper Operator is to manage ZooKeeper service instances deployed on the Kubernetes cluster. It is built using the Kubebuilder SDK, which is part of the Kubebuilder.

Features

With this operator, you're able to deploy and manage a HA Zookeeper Cluster:

  • Provision a Zookeeper cluster in a scalable and high-available way.
  • Update the spec of the deployed Zookeeper cluster to do adjustments like replicas (scalability) and resources.
    • ScaleUp
    • ScaleDown
    • Rollout
    • Observe
  • Create Prometheus target for the Zookeeper node.
  • Delete the Zookeeper cluster and all the related resources owned by the instance.

Design

Diagram below shows the overall design of this operator,

架构图

For more design details, check the architecture document.

Installation

You can follow the installation guide to deploy this operator to your K8s clusters.

Additionally, follow sample deployment guide to have a try of deploying the sample to your K8s clusters.

Versioning & Dependencies

Component \ Versions 0.5.0 1.0.0 1.1.0
Zookeeper 3.5.6 [TBD] [TBD]
agent 0.0.1 [TBD] [TBD]

Compatibilities

Kubernetes / Versions 0.5.0 1.0.0 1.1.0
1.17 + [TBD] [TBD]
1.18 + [TBD] [TBD]
1.19 + [TBD] [TBD]

Notes: += verified -= not verified

Development

Interested in contributions? Follow the CONTRIBUTING guide to start on this project. Your contributions will be highly appreciated and creditable.

Community

Documents

See documents here.

Additional Documents

License

Apache-2.0

zookeeper-operator's People

Contributors

ghostbaby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zookeeper-operator's Issues

[BUG] mutate webhook not work

Describe the bug

apiVersion: zk.cache.ghostbaby.io/v1alpha1
kind: Workload
metadata:
  name: workload-sample
spec:
  version: v3.5.6
  replicas: 3
  cluster:
    name: test
    exporter:
      exporter: true
      exporterImage: ghostbaby/zookeeper_exporter
      exporterVersion: v3.5.6
      disableExporterProbes: false
    storage:
      persistentVolumeClaim:
        metadata:
          name: zookeeper-data
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi

when I use this YAML file to create zk cluster, mutate webhook not work .

[BUG]zookeeper-operator-controller-manager NPE

│ manager [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14cee5a]                                                                                                                                                                            │
│ manager goroutine 347 [running]:                                                                                                                                                                                                                           │
│ manager k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)                                                                                                                                                                                    │
│ manager     /go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:55 +0x105                                                                                                                                                                  │
│ manager panic(0x164d380, 0x2681ac0)                                                                                                                                                                                                                        │
│ manager     /usr/local/go/src/runtime/panic.go:679 +0x1b2                                                                                                                                                                                                  │
│ manager github.com/ghostbaby/zookeeper-operator/controllers/workload/rollout.(*Rollout).RollingUpgrades(0xc00030df20, 0xc0008773c0, 0xc00053c000)                                                                                                          │
│ manager     /workspace/controllers/workload/rollout/rollingupdate.go:37 +0x12a                                                                                                                                                                             │
│ manager github.com/ghostbaby/zookeeper-operator/controllers/workload/rollout.(*Rollout).Reconcile(0xc00030df20, 0x1aa6840, 0xc0000c4008)                                                                                                                   │
│ manager     /workspace/controllers/workload/rollout/rollout.go:34 +0x8e                                                                                                                                                                                    │
│ manager github.com/ghostbaby/zookeeper-operator/controllers/workload.(*ReconcileWorkload).Reconcile(0xc0007000b0, 0x1aa6840, 0xc0000c4008)                                                                                                                 │
│ manager     /workspace/controllers/workload/workload.go:55 +0x2e6                                                                                                                                                                                          │
│ manager github.com/ghostbaby/zookeeper-operator/controllers.(*WorkloadReconciler).Reconcile(0xc00087fb00, 0xc0003487f9, 0x7, 0xc0003487ec, 0x4, 0xc00087a900, 0x0, 0x0, 0x0)                                                                               │
│ manager     /workspace/controllers/workload_controller.go:116 +0x617                                                                                                                                                                                       │
│ manager sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0000fb710, 0x16a9040, 0xc000668c60, 0x0)                                                                                                                  │
│ manager     /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:235 +0x27d                                                                                                               │
│ manager sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0000fb710, 0x0)                                                                                                                                        │
│ manager     /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:209 +0xcb                                                                                                                │
│ manager sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker(0xc0000fb710)                                                                                                                                                          │
│ manager     /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:188 +0x2b                                                                                                                │
│ manager k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc00087a8e0)                                                                                                                                                                                 │
│ manager     /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155 +0x5e                                                                                                                                                                        │
│ manager k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc00087a8e0, 0x1a692a0, 0xc0008544e0, 0x1, 0xc0000447e0)                                                                                                                                           │
│ manager     /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156 +0xa3                                                                                                                                                                        │
│ manager k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc00087a8e0, 0x3b9aca00, 0x0, 0xc0003dac01, 0xc0000447e0)                                                                                                                                           │
│ manager     /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133 +0xaa                                                                                                                                                                        │
│ manager k8s.io/apimachinery/pkg/util/wait.Until(0xc00087a8e0, 0x3b9aca00, 0xc0000447e0)                                                                                                                                                                    │
│ manager     /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:90 +0x4d                                                                                                                                                                         │
│ manager created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1                                                                                                                                                        │
│ manager     /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:170 +0x431                                                                                                               │
│ manager stream closed

[Feature]Add observedGeneration to represent Workload has reconciled

Is your feature request related to a problem? Please describe.
observedGeneration field of status in K8s object is widely used in K8s built-in resource. It reflects the generation of the most recently observed Object.

With the help of observedGeneration field, user can recognize whether a CR is reconciled by controller.

A workflow will like below:

apiVersion: cache.ghostbaby.io/v1alpha1
kind: Workload
metadata:
  name: workload-sample
  namespace: pg
spec:
  version: v3.5.6
  replicas: 5
  ...

After the controller reconciled, the observedGeneration will appear and align with generation in metadata:

apiVersion: cache.ghostbaby.io/v1alpha1
kind: Workload
metadata:
  name: workload-sample
  namespace: pg
  generation: 1
spec:
  version: v3.5.6
  replicas: 5
  ...
status:
  observedGeneration: 1

Later, we have another change, it will be:

apiVersion: cache.ghostbaby.io/v1alpha1
kind: Workload
metadata:
  name: workload-sample
  namespace: pg
  generation: 2
spec:
  version: v3.5.7
  replicas: 5
  ...
status:
  observedGeneration: 1

And after reconciled, it will be:

apiVersion: cache.ghostbaby.io/v1alpha1
kind: Workload
metadata:
  name: workload-sample
  namespace: pg
  generation: 2
spec:
  version: v3.5.7
  replicas: 5
  ...
status:
  observedGeneration: 2

[Feature]Add zookeeper-agent

Is your feature request related to a problem? Please describe.
The zookeeper agent wraps a layer on the zookeeper API and provides the following functions:

  • get zookeeper status
  • check zookeeper is run ok
  • heartbeat API
  • get zookeeper cluster member
  • add zookeeper member to the cluster

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.