msk

package
v0.0.1-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package msk provides emulation of Amazon MSK (Managed Streaming for Kafka).

Implemented operations: CreateCluster, DescribeCluster, ListClusters, DeleteCluster, GetBootstrapBrokers, CreateConfiguration, DescribeConfiguration, ListConfigurations, DeleteConfiguration, ListKafkaVersions, TagResource, UntagResource, ListTagsForResource.

On CreateCluster, a real Redpanda container is started (same pattern as ElastiCache). The cluster reaches "ACTIVE" state once the TCP health check succeeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokerNodeGroupInfo

type BrokerNodeGroupInfo struct {
	InstanceType         string   `json:"instanceType,omitempty"`
	ClientSubnets        []string `json:"clientSubnets,omitempty"`
	SecurityGroups       []string `json:"securityGroups,omitempty"`
	BrokerAZDistribution string   `json:"brokerAZDistribution,omitempty"`
}

BrokerNodeGroupInfo describes broker node configuration.

type Cluster

type Cluster struct {
	ClusterArn          string              `json:"clusterArn"`
	ClusterName         string              `json:"clusterName"`
	ClusterType         string              `json:"clusterType,omitempty"`
	State               string              `json:"state"`
	CreationTime        time.Time           `json:"creationTime"`
	CurrentVersion      string              `json:"currentVersion"`
	BrokerNodeGroupInfo BrokerNodeGroupInfo `json:"brokerNodeGroupInfo"`
	NumberOfBrokerNodes int                 `json:"numberOfBrokerNodes"`
	KafkaVersion        string              `json:"kafkaVersion"`
	Tags                map[string]string   `json:"tags,omitempty"`
	// Internal — not in API responses.
	DockerContainerID string `json:"_dockerContainerID,omitempty"`
	HostPort          int    `json:"_hostPort,omitempty"`
}

Cluster represents an MSK cluster.

type ClusterConfiguration

type ClusterConfiguration struct {
	Arn            string    `json:"arn"`
	Name           string    `json:"name"`
	Description    string    `json:"description,omitempty"`
	KafkaVersions  []string  `json:"kafkaVersions,omitempty"`
	CreationTime   time.Time `json:"creationTime"`
	LatestRevision Revision  `json:"latestRevision"`
	State          string    `json:"state"`
}

ClusterConfiguration represents an MSK configuration.

type Handler

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

Handler handles MSK REST JSON requests.

type Revision

type Revision struct {
	CreationTime time.Time `json:"creationTime"`
	Revision     int64     `json:"revision"`
}

Revision represents a configuration revision.

type Service

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

Service implements router.Service for MSK.

func New

func New(cfg *config.Config, store state.Store, logger *zap.Logger, clk clock.Clock) *Service

New returns a configured MSK Service.

func (*Service) Dispatch

func (s *Service) Dispatch(w http.ResponseWriter, r *http.Request)

Dispatch satisfies router.TargetDispatcher.

func (*Service) InitBus

func (s *Service) InitBus(bus *events.Bus)

InitBus wires the event bus for MSK lifecycle events.

func (*Service) Name

func (s *Service) Name() string

Name satisfies router.Service.

func (*Service) Operations

func (s *Service) Operations() []op.Operation

func (*Service) ReconcileContainers

func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)

ReconcileContainers satisfies router.ContainerReconciler.

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(r chi.Router)

RegisterRoutes satisfies router.Service.

ARNs in path parameters contain forward slashes. We use chi wildcard catch-all routes (/*) and dispatch to specific handlers based on the path suffix.

func (*Service) SetDocker

func (s *Service) SetDocker(dc *docker.Client)

SetDocker wires the Docker client for MSK container management and starts the DockerGC background remove loop.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context)

Stop cancels pending lifecycle transitions, waits for in-flight Docker goroutines, then cleans up all containers via the GC.

func (*Service) SupportedProtocols

func (s *Service) SupportedProtocols() []codec.Codec

func (*Service) TagsRouter

func (s *Service) TagsRouter() chi.Router

TagsRouter returns a chi.Router for the MSK tagging routes that live under /v1/tags. This is mounted by the main router alongside other taggable services' tag routers and dispatched by the resourceArn's service segment, since /v1/tags/{resourceArn} is shared across services (e.g. AppSync) that each own tagging for their own ARNs.

func (*Service) TargetPrefix

func (s *Service) TargetPrefix() string

TargetPrefix satisfies router.TargetDispatcher.

Jump to

Keyboard shortcuts

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