application

package
v0.0.0-...-dc9ea58 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationFinalizer = "apps.rocket.io/finalizer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationReconciler

type ApplicationReconciler struct {
	client.Client
	Scheme             *runtime.Scheme
	ClientManager      *cluster.ClientManager
	Recorder           record.EventRecorder
	RolloutCoordinator *RolloutCoordinator
	RolloutStatusAggr  *RolloutStatusAggregator
}

ApplicationReconciler reconciles a Application object

func (*ApplicationReconciler) Reconcile

func (r *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

func (*ApplicationReconciler) SetupWithManager

func (r *ApplicationReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ClusterReplicaAssignment

type ClusterReplicaAssignment struct {
	// ClusterName is the name of the cluster
	ClusterName string
	// TotalReplicas is the total desired replicas for this cluster
	TotalReplicas int32
	// CanaryReplicas is the number of canary replicas for this cluster
	CanaryReplicas int32
	// StableReplicas is the number of stable replicas for this cluster
	StableReplicas int32
	// ClusterIndex is the index of this cluster in the topology
	ClusterIndex int
}

ClusterReplicaAssignment represents the replica assignment for a cluster

type GlobalReplicaCalculator

type GlobalReplicaCalculator struct{}

GlobalReplicaCalculator calculates replica distribution across clusters

func NewGlobalReplicaCalculator

func NewGlobalReplicaCalculator() *GlobalReplicaCalculator

NewGlobalReplicaCalculator creates a new GlobalReplicaCalculator

func (*GlobalReplicaCalculator) CalculateGlobalProgress

func (c *GlobalReplicaCalculator) CalculateGlobalProgress(
	assignments map[string]ClusterReplicaAssignment,
	totalReplicas int32,
) int32

CalculateGlobalProgress calculates the global progress percentage across all clusters This is used to determine when to move to the next step

func (*GlobalReplicaCalculator) CalculateReplicas

func (c *GlobalReplicaCalculator) CalculateReplicas(
	globalPercent int32,
	totalReplicas int32,
	topology []appsv1alpha1.ClusterTopology,
	distribution *appsv1alpha1.GlobalReplicaDistribution,
) (map[string]ClusterReplicaAssignment, error)

CalculateReplicas calculates replica distribution across clusters based on global canary percentage globalPercent: the global percentage of pods to update (e.g., 20 means 20% globally) totalReplicas: total desired replicas across all clusters topology: cluster topology with replica distribution distribution: global replica distribution configuration Returns a map of cluster name to its replica assignment

type RolloutBuilder

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

RolloutBuilder builds Rollout resources for kruise-rollout

func NewRolloutBuilder

func NewRolloutBuilder() *RolloutBuilder

NewRolloutBuilder creates a new RolloutBuilder

func (*RolloutBuilder) BuildEmptyRollout

func (b *RolloutBuilder) BuildEmptyRollout(app *appsv1alpha1.Application) *unstructured.Unstructured

BuildEmptyRollout builds an empty Rollout for deletion

func (*RolloutBuilder) BuildRollout

func (b *RolloutBuilder) BuildRollout(
	app *appsv1alpha1.Application,
	clusterName string,
	assignment *ClusterReplicaAssignment,
) (*unstructured.Unstructured, error)

BuildRollout builds a Rollout resource for the given application and cluster assignment: the replica assignment for this cluster (canary/stable replicas)

type RolloutCoordinator

type RolloutCoordinator struct {
	ClientManager clientManager
	Builder       *RolloutBuilder
	Calculator    *GlobalReplicaCalculator
}

RolloutCoordinator coordinates rollout across multiple clusters

func NewRolloutCoordinator

func NewRolloutCoordinator(cm clientManager) *RolloutCoordinator

NewRolloutCoordinator creates a new RolloutCoordinator

func (*RolloutCoordinator) DeleteRollout

func (c *RolloutCoordinator) DeleteRollout(ctx context.Context, app *appsv1alpha1.Application, clusters []string) error

DeleteRollout deletes rollout resources from all clusters

func (*RolloutCoordinator) ReconcileRollout

func (c *RolloutCoordinator) ReconcileRollout(ctx context.Context, app *appsv1alpha1.Application, topology []appsv1alpha1.ClusterTopology) error

ReconcileRollout reconciles rollout resources across clusters It calculates global replica distribution and applies Rollout CR to each cluster

type RolloutStatusAggregator

type RolloutStatusAggregator struct {
	ClientManager clientManager
}

RolloutStatusAggregator aggregates rollout status from multiple clusters

func NewRolloutStatusAggregator

func NewRolloutStatusAggregator(cm clientManager) *RolloutStatusAggregator

NewRolloutStatusAggregator creates a new RolloutStatusAggregator

func (*RolloutStatusAggregator) AggregateRolloutStatus

func (a *RolloutStatusAggregator) AggregateRolloutStatus(ctx context.Context, app *appsv1alpha1.Application, clusters []string) error

AggregateRolloutStatus collects rollout status from all clusters and updates Application status

type StatusReconciler

type StatusReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	ClientManager *cluster.ClientManager
	ShardManager  *sharding.ShardManager
	// contains filtered or unexported fields
}

StatusReconciler reconciles the status of Application objects

func (*StatusReconciler) Reconcile

func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reads that state of the cluster for a Application object and makes changes based on the state read

func (*StatusReconciler) SetupWithManager

func (r *StatusReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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