MCPcopy Index your code
hub / github.com/flant/shell-operator

github.com/flant/shell-operator @v1.20.1 sqlite

repository ↗ · DeepWiki ↗ · release v1.20.1 ↗
2,237 symbols 6,883 edges 198 files 990 documented · 44%
README

shell-operator logo

docker pull flant/shell-operator GH Discussions

Shell-operator is a tool for running event-driven scripts in a Kubernetes cluster.

This operator is not an operator for a particular software product such as prometheus-operator or kafka-operator. Shell-operator provides an integration layer between Kubernetes cluster events and shell scripts by treating scripts as hooks triggered by events. Think of it as an operator-sdk but for scripts.

Shell-operator is used as a base for more advanced addon-operator that supports Helm charts and value storages.

Shell-operator provides:

  • Ease of management of a Kubernetes cluster: use the tools that Ops are familiar with. It can be bash, python, kubectl, etc.
  • Kubernetes object events: hook can be triggered by add, update or delete events. Learn more about hooks.
  • Object selector and properties filter: shell-operator can monitor a particular set of objects and detect changes in their properties.
  • Simple configuration: hook binding definition is a JSON or YAML document on script's stdout.
  • Validating webhook machinery: hook can handle validating for Kubernetes resources.
  • Conversion webhook machinery: hook can handle version conversion for Kubernetes resources.

Documentation

Please see the docs for more in-depth information and supported features.

Examples and notable users

More examples of how you can use shell-operator are available in the examples directory.

Prominent shell-operator use cases include:

  • Deckhouse Kubernetes platform where both projects, shell-operator and addon-operator, are used as the core technology to configure & extend K8s features;
  • KubeSphere Kubernetes platform's installer;
  • Kafka DevOps solution from Confluent.

Please find out & share more examples in Show & tell discussions.

Articles & talks

Shell-operator has been presented during KubeCon + CloudNativeCon Europe 2020 Virtual (Aug'20). Here is the talk called "Go? Bash! Meet the shell-operator":

Official publications on shell-operator: * "shell-operator v1.0.0: the long-awaited release of our tool to create Kubernetes operators" (Apr'21); * "shell-operator & addon-operator news: hooks as admission webhooks, Helm 3, OpenAPI, Go hooks, and more!" (Feb'21); * "Kubernetes operators made easy with shell-operator: project status & news" (Jul'20); * "Announcing shell-operator to simplify creating of Kubernetes operators" (May'19).

Other languages: * Chinese: "介绍一个不太小的工具:Shell Operator"; "使用shell-operator实现Operator"; * Dutch: "Een operator om te automatiseren – Hoe pak je dat aan?"; * Russian: "shell-operator v1.0.0: долгожданный релиз нашего проекта для Kubernetes-операторов"; "Представляем shell-operator: создавать операторы для Kubernetes стало ещё проще".

Community

Please feel free to reach developers/maintainers and users via GitHub Discussions for any questions regarding shell-operator.

You're also welcome to follow @flant_com to stay informed about all our Open Source initiatives.

License

Apache License 2.0, see LICENSE.

Extension points exported contracts — how you extend this code

DebugShutdowner (Interface)
DebugShutdowner is the subset of *debug.Server that ShellOperator needs at shutdown time. Using an interface avoids impo [8 …
pkg/shell-operator/operator.go
ScheduleManager (Interface)
(no doc) [6 implementers]
pkg/schedule_manager/schedule_manager.go
VersionedConverter (Interface)
VersionedConverter converts raw config bytes into a HookConfig for a specific config version. Implement this interface a [3 …
pkg/hook/config/config.go
MetadataDescriptionGetter (Interface)
(no doc) [4 implementers]
pkg/task/task.go
Registerer (Interface)
(no doc) [4 implementers]
pkg/app/log.go
CompiledFilter (Interface)
CompiledFilter is a pre-compiled filter ready to be applied to data. Compile the filter expression once and reuse it acr [2 …
pkg/filter/filter.go
KubeEventEmitter (Interface)
KubeEventEmitter emits kubernetes events. ManagerEventsHandler only needs this subset of KubeEventsManager. [2 implementers]
pkg/kube_events_manager/kube_events_manager.go
ProcessTracker (Interface)
ProcessTracker is a read-only view into the process registry. It is intended for consumers (such as a PID-1 zombie reape [1 …
pkg/executor/registry.go

Core symbols most depended-on inside this repo

Expect
called by 566
pkg/metric/storage_mock.go
Error
called by 121
pkg/debug/server.go
String
called by 98
pkg/config/config.go
String
called by 96
pkg/kube_events_manager/types/types.go
NewTask
called by 79
pkg/task/task.go
Length
called by 66
pkg/task/queue/task_queue.go
String
called by 60
pkg/task/queue/task_queue.go
GetId
called by 55
pkg/task/task.go

Shape

Method 1,210
Function 661
Struct 309
Interface 32
TypeAlias 16
FuncType 9

Languages

Go100%

Modules by API surface

pkg/metric/storage_mock.go353 symbols
pkg/metric/grouped_storage_mock.go157 symbols
pkg/task/queue/task_queue_benchmark_test.go53 symbols
pkg/task/queue/task_queue.go50 symbols
pkg/task/task.go49 symbols
pkg/utils/json/bench_compare_test.go37 symbols
pkg/hook/controller/kubernetes_bindings_controller.go37 symbols
pkg/kube/object_patch/operation.go36 symbols
pkg/hook/hook_manager.go36 symbols
pkg/hook/controller/hook_controller.go34 symbols
pkg/metric/collector.go31 symbols
pkg/kube_events_manager/monitor.go31 symbols

Dependencies from manifests, versioned

github.com/DataDog/gostackparsev0.7.0 · 1×
github.com/Masterminds/semver/v3v3.4.0 · 1×
github.com/aymanbagabas/go-osc52/v2v2.0.1 · 1×
github.com/beorn7/perksv1.0.1 · 1×
github.com/blang/semver/v4v4.0.0 · 1×
github.com/cespare/xxhash/v2v2.3.0 · 1×
github.com/davecgh/go-spewv1.1.2-0.20180830191 · 1×
github.com/deckhouse/deckhouse/pkg/logv0.2.0 · 1×
github.com/deckhouse/deckhouse/pkg/metrics-storagev0.3.0 · 1×
github.com/deckhouse/module-sdkv0.11.1 · 1×

For agents

$ claude mcp add shell-operator \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact