cluster

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package cluster implements the DevOps reference workload's deterministic tools as a webhook-backed tool endpoint behind the Fenced Tool Gateway:

kubernetes.get@1.0.0       inspect a service's pod health
kubernetes.logs@1.0.0      recent log lines for a service
kubernetes.restart@1.0.0   restart a service's pods (heals the incident)
kubernetes.scale@1.0.0     scale a service's replicas
server.exec@1.0.0          run a shell command on the target host

The fake cluster carries one in-memory service ("checkout") that starts in an unhealthy state; restart heals it unless the scenario marks the cluster as stubborn (restart fails to heal), which exercises the rollback path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelfSignedTLSListener

func SelfSignedTLSListener(handler http.Handler) (net.Listener, *http.Client, string, error)

SelfSignedTLSListener mirrors the research webtools helper: serves the handler on a loopback HTTPS listener trusted only by the returned client.

Types

type Cluster

type Cluster struct {

	// Stubborn makes restart fail to heal, forcing the rollback path.
	Stubborn bool
	// contains filtered or unexported fields
}

Cluster is the deterministic in-memory target of the DevOps tools.

func New

func New(stubborn bool) *Cluster

New builds a cluster with a checkout service that starts unhealthy.

func (*Cluster) Exec

func (c *Cluster) Exec(command string) (string, error)

Exec implements server.exec.

func (*Cluster) Get

func (c *Cluster) Get(service string) (State, error)

Get implements kubernetes.get.

func (*Cluster) Logs

func (c *Cluster) Logs(service string, lines int) ([]string, error)

Logs implements kubernetes.logs.

func (*Cluster) Restart

func (c *Cluster) Restart(service string) (State, error)

Restart implements kubernetes.restart. It heals the service unless the cluster is stubborn (the rollback acceptance uses this).

func (*Cluster) Scale

func (c *Cluster) Scale(service string, replicas int) (State, error)

Scale implements kubernetes.scale (used by rollback to restore replicas).

func (*Cluster) Snapshot

func (c *Cluster) Snapshot() State

Snapshot returns a copy of the current state.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves the tool contract over HTTP(S).

func NewServer

func NewServer(cluster *Cluster) *Server

NewServer builds the webhook server over the given cluster.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type State

type State struct {
	Service       string `json:"service"`
	Healthy       bool   `json:"healthy"`
	Replicas      int    `json:"replicas"`
	ReadyReplicas int    `json:"readyReplicas"`
	RestartCount  int    `json:"restartCount"`
	Reason        string `json:"reason,omitempty"`
	ExecCalls     int    `json:"execCalls"`
}

State is one snapshot of the fake cluster service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL