Skip to main content

Deckhouse module SDK

This package is discontinued in favor of deckhouse-sdk and will be deleted soon

Deckhouse module SDK simplifies writing module hooks for operators:

NOTE:

  • The API is in alpha stage
  • The name will change from shell-operator to something more deckhouse-related, probably, deckhouse-sdk

Install

pip install shell-operator

Sample hook

# hello.py
from shell_operator import hook

def main(ctx: hook.Context):
    # Manipulate kubernetes state
    # ... object = { "kind" : "Pod", "apiVersion" : "v1", ... }
    ctx.kubernetes.create_or_update(object)

    # Export metrics
    # ... metric = { "name" : "power", "group": "my_hook", "set" : 9000, ... }
    ctx.metrics.collect(metric)

    # Use in-memory values for helm chart. Shell Operator does not support values, but Addon Operator and Deckhouse do.
    ctx.values.myModule.deployment.replicas = 5


if __name__ == "__main__":
    hook.run(main, configpath="hello.yaml") # 'config' arg is also supported for raw string
# hello.yaml
configVersion: v1
onStartup: 10

How to test

An example for pytest

# hello_test.py

from hello import main
from shell_operator import hook

# Inputs
#   initial_values = { ... }
#   binding_context = [ { ... } ]
# Outputs
#   expected_metrics = [ ... ]
#   expected_kube_operations = [ ... ]
#   expected_values_patches = [ ... ]
#   expected_values = { ... }

def test_hello():
    out = hook.testrun(main, binding_context, initial_values)

    assert out.metrics.data == expected_metrics
    assert out.kube_operations.data == expected_kube_operations
    assert out.values_patches.data == expected_values_patches

    assert out.values.myModule.deployment.repicas == 5

Metadata

Release files for shell-operator 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shell-operator 0.1.3
File Size Uploaded Provenance Actions
shell_operator-0.1.3.tar.gz 11.6 kB Without provenance Details for shell_operator-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shell-operator 0.1.3
File Interpreter ABI Platform Actions
shell_operator-0.1.3-py3-none-any.whl Python 3 none any Details for shell_operator-0.1.3-py3-none-any.whl

Total release size: 24.3 kB

Release files / shell_operator-0.1.3.tar.gz

Download URL shell_operator-0.1.3.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
04852369853dc4608a526d2783dc0121d53e4654ba754145f495073fddb813d9
BLAKE2b-256 checksum
How to use checksums
3482e7dfb528b5060661727deb418ddf8a345a360e12f53d51cd7b9f286c0db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.7 Darwin/22.2.0

Release files / shell_operator-0.1.3-py3-none-any.whl

Download URL shell_operator-0.1.3-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5f2f75745e0a568a295a0064024e2c9511ded20771ed1fe20a02b7b7f3d77f4
BLAKE2b-256 checksum
How to use checksums
6312b14aa5fa0b36416307ca32779154aac2ecbe9d400bc06ccdec1cac122002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.7 Darwin/22.2.0

Security for shell-operator 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page