Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateServiceName ¶ added in v0.6.0
Types ¶
type Client ¶
type Client interface {
api.ContainerClient
api.DNSClient
api.ImageClient
api.MachineClient
api.ServiceClient
api.VolumeClient
}
type ContainerSpecStatus ¶
type ContainerSpecStatus string
const ( ContainerUpToDate ContainerSpecStatus = "up-to-date" ContainerNeedsUpdate ContainerSpecStatus = "needs-update" ContainerNeedsRecreate ContainerSpecStatus = "needs-recreate" )
func EvalContainerSpecChange ¶
func EvalContainerSpecChange(current api.ServiceSpec, new api.ServiceSpec) ContainerSpecStatus
type Deployment ¶
type Deployment struct {
Service *api.Service
Spec api.ServiceSpec
Strategy Strategy
// contains filtered or unexported fields
}
Deployment manages the process of creating or updating a service to match a desired state. It coordinates the validation, planning, and execution of deployment operations.
func NewDeployment ¶
func NewDeployment(cli Client, spec api.ServiceSpec, strategy Strategy) *Deployment
NewDeployment creates a new deployment for the given service specification. If strategy is nil, a default RollingStrategy will be used.
func NewDeploymentWithClusterState ¶ added in v0.15.0
func NewDeploymentWithClusterState( cli Client, spec api.ServiceSpec, strategy Strategy, state *scheduler.ClusterState, ) *Deployment
NewDeploymentWithClusterState creates a new deployment like NewDeployment but also with a provided current cluster state used for scheduling decisions.
func (*Deployment) Plan ¶
func (d *Deployment) Plan(ctx context.Context) (Plan, error)
Plan returns a plan of operations to reconcile the service to the desired state. If a plan has already been created, the same plan will be returned.
func (*Deployment) Run ¶
func (d *Deployment) Run(ctx context.Context) (Plan, error)
Run executes the deployment plan and returns the ID of the created or updated service. It will create a new plan if one hasn't been created yet. The deployment will either create a new service or update the existing one to match the desired specification. TODO: forbid to run the same deployment more than once.
type RollingStrategy ¶
type RollingStrategy struct {
// ForceRecreate indicates whether all containers should be recreated during the deployment,
// regardless of whether their specifications have changed.
ForceRecreate bool
// SkipHealthMonitor skips the monitoring period and health checks for faster emergency deployments.
SkipHealthMonitor bool
// contains filtered or unexported fields
}
RollingStrategy implements a rolling update deployment pattern where containers are updated one at a time to minimize service disruption.
func (*RollingStrategy) Plan ¶
func (s *RollingStrategy) Plan(state *scheduler.ClusterState, svc *api.Service, spec api.ServiceSpec) (Plan, error)
func (*RollingStrategy) Type ¶
func (s *RollingStrategy) Type() string
type ServiceSpecResolver ¶
type ServiceSpecResolver struct {
ClusterDomain string
}
ServiceSpecResolver transforms user-provided service specs into deployment-ready form.
func (*ServiceSpecResolver) Resolve ¶
func (r *ServiceSpecResolver) Resolve(spec api.ServiceSpec) (api.ServiceSpec, error)
Resolve transforms a service spec into its fully resolved form ready for deployment.
type Strategy ¶
type Strategy interface {
// Type returns the type of the deployment strategy, e.g. "rolling", "blue-green".
Type() string
// Plan returns the operation to reconcile the service to the desired state.
// If the service does not exist (new deployment), svc will be nil. state provides the current and planned state
// of the cluster for scheduling decisions.
Plan(state *scheduler.ClusterState, svc *api.Service, spec api.ServiceSpec) (Plan, error)
}
Strategy defines how a service should be deployed or updated. Different implementations can provide various deployment patterns such as rolling updates, blue/green deployments, etc.