deployer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LastAppliedResourceSpec = "controller.greptime.io/last-applied-resource-spec"
	ConfigHash              = "controller.greptime.io/config-hash"
)
View Source
const (
	EnvPodIP        = "POD_IP"
	EnvPodName      = "POD_NAME"
	EnvPodNamespace = "POD_NAMESPACE"
	EnvRole         = "ROLE"
	EnvEnableIPv6   = "ENABLE_IPV6"
)

Variables

View Source
var (
	ErrSyncNotReady = fmt.Errorf("the sync process is not ready")
)

Functions

This section is empty.

Types

type Builder

type Builder interface {
	// BuildService builds a K8s service.
	BuildService() Builder

	// BuildDeployment builds a K8s deployment.
	BuildDeployment() Builder

	// BuildStatefulSet builds a K8s statefulset.
	BuildStatefulSet() Builder

	// BuildConfigMap builds a K8s configmap.
	BuildConfigMap() Builder

	// BuildPodMonitor builds a Prometheus podmonitor.
	BuildPodMonitor() Builder

	// BuildGreptimeDBStandalone builds a GreptimeDBStandalone.
	BuildGreptimeDBStandalone() Builder

	// SetControllerAndAnnotation sets the controller reference and annotation for the object.
	SetControllerAndAnnotation() Builder

	// Generate returns the generated K8s resources.
	Generate() ([]client.Object, error)
}

Builder is the interface for building K8s resources.

type ComponentOperator

type ComponentOperator interface {
	// Generate generates the multiple Kubernetes objects base on the CRD object.
	Generate(crdObject client.Object) ([]client.Object, error)

	// Apply creates or update the Kubernetes objects that generated by Render().
	// If the object is not existed, it will be created.
	// If the object is existed, it will be updated if the object is different.
	Apply(ctx context.Context, crdObject client.Object, objects []client.Object) error

	// CleanUp cleans up the resources that created by the deployer.
	CleanUp(ctx context.Context, crdObject client.Object) error

	// CheckAndUpdateStatus checks if the status of Kubernetes objects are ready and update the status.
	CheckAndUpdateStatus(ctx context.Context, crdObject client.Object) (bool, error)

	// PreSyncHooks returns the hooks that will be executed before the core login of Sync().
	PreSyncHooks() []Hook

	// PostSyncHooks returns the hooks that will be executed after the core login of Sync().
	PostSyncHooks() []Hook
}

ComponentOperator is the interface that define the behaviors of a deployer.

type DefaultBuilder

type DefaultBuilder struct {
	Scheme  *runtime.Scheme
	Objects []client.Object
	Owner   client.Object

	// record error for builder pattern.
	Err error
}

DefaultBuilder is the default implementation of Builder.

func (*DefaultBuilder) BuildConfigMap

func (b *DefaultBuilder) BuildConfigMap() Builder

func (*DefaultBuilder) BuildDeployment

func (b *DefaultBuilder) BuildDeployment() Builder

func (*DefaultBuilder) BuildGreptimeDBStandalone added in v0.1.1

func (b *DefaultBuilder) BuildGreptimeDBStandalone() Builder

func (*DefaultBuilder) BuildPodMonitor

func (b *DefaultBuilder) BuildPodMonitor() Builder

func (*DefaultBuilder) BuildService

func (b *DefaultBuilder) BuildService() Builder

func (*DefaultBuilder) BuildStatefulSet

func (b *DefaultBuilder) BuildStatefulSet() Builder

func (*DefaultBuilder) Generate

func (b *DefaultBuilder) Generate() ([]client.Object, error)

func (*DefaultBuilder) SetControllerAndAnnotation

func (b *DefaultBuilder) SetControllerAndAnnotation() Builder

type DefaultDeployer

type DefaultDeployer struct {
	client.Client
}

DefaultDeployer implement some common behaviors of the ComponentOperator interface.

func (*DefaultDeployer) Apply

func (d *DefaultDeployer) Apply(ctx context.Context, _ client.Object, objects []client.Object) error

func (*DefaultDeployer) CheckAndUpdateStatus

func (d *DefaultDeployer) CheckAndUpdateStatus(_ context.Context, _ client.Object) (bool, error)

func (*DefaultDeployer) CleanUp

func (d *DefaultDeployer) CleanUp(_ context.Context, _ client.Object) error

func (*DefaultDeployer) Generate

func (d *DefaultDeployer) Generate(_ client.Object) ([]client.Object, error)

func (*DefaultDeployer) PostSyncHooks

func (d *DefaultDeployer) PostSyncHooks() []Hook

func (*DefaultDeployer) PreSyncHooks

func (d *DefaultDeployer) PreSyncHooks() []Hook

func (*DefaultDeployer) Sync

func (d *DefaultDeployer) Sync(ctx context.Context, crdObject client.Object, operator ComponentOperator) error

type Deployer

type Deployer interface {
	Syncer
	ComponentOperator
}

Deployer is the interface that abstracts the deployment of a component.

type Hook

type Hook func(ctx context.Context, crdObject client.Object) error

Hook is a function that will be executed before or after the Sync().

type Syncer

type Syncer interface {
	Sync(ctx context.Context, crdObject client.Object, operator ComponentOperator) error
}

Syncer use the deployer to sync the CRD object.

Jump to

Keyboard shortcuts

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