Documentation
¶
Index ¶
- func AutomaticUpgrade(ctx context.Context, localEnv, updateEnv *localenv.LocalEnvironment) (err error)
- func ExecutePhase(ctx context.Context, config FSMConfig, params fsm.Params, ...) error
- func GetOperationPlan(b storage.Backend) (*storage.OperationPlan, error)
- func InitOperationPlan(ctx context.Context, updateEnv *localenv.LocalEnvironment, ...) (*storage.OperationPlan, error)
- func NewFSM(ctx context.Context, c FSMConfig) (*fsm.FSM, error)
- func NewGarbageCollectPhase(plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.Remote) (*phaseGC, error)
- func NewOperationPlan(env *localenv.ClusterEnvironment, op storage.SiteOperation) (*storage.OperationPlan, error)
- func NewPhaseCoreDNS(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseCoreDNS, error)
- func NewPhaseDrain(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseDrain, error)
- func NewPhaseElectionChange(plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.Remote, ...) (*phaseElectionChange, error)
- func NewPhaseEndpoints(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseEndpoints, error)
- func NewPhaseKubeletPermissions(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseKubeletPermissions, error)
- func NewPhaseMigrateLinks(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseMigrateLinks, error)
- func NewPhaseMigrateRoles(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseMigrateRoles, error)
- func NewPhaseTaint(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseTaint, error)
- func NewPhaseUncordon(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseUncordon, error)
- func NewPhaseUntaint(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseUntaint, error)
- func NewPhaseUpdateLabels(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseUpdateLabels, error)
- func NewPhaseUpgradeEtcd(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
- func NewPhaseUpgradeEtcdBackup(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
- func NewPhaseUpgradeEtcdRestart(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
- func NewPhaseUpgradeEtcdRestore(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
- func NewPhaseUpgradeEtcdShutdown(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
- func NewPhaseUpgradeGravitySiteRestart(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
- func NewUpdateEngine(c FSMConfig) (*fsmUpdateEngine, error)
- func NewUpdatePhaseApp(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseApp, error)
- func NewUpdatePhaseBeforeApp(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseBeforeApp, error)
- func NewUpdatePhaseBootstrap(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase, ...) (fsm.PhaseExecutor, error)
- func NewUpdatePhaseChecks(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase, ...) (*updatePhaseChecks, error)
- func NewUpdatePhaseConfig(c FSMConfig, p fsm.ExecutorParams, remote fsm.Remote) (*updatePhaseConfig, error)
- func NewUpdatePhaseInit(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseInit, error)
- func NewUpdatePhaseSystem(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase, ...) (*updatePhaseSystem, error)
- func RollbackPhase(ctx context.Context, config FSMConfig, params fsm.Params, ...) error
- func ShutdownClusterAgents(ctx context.Context, remote rpc.AgentRepository) error
- func SyncOperationPlan(src storage.Backend, dst storage.Backend) error
- func SyncOperationPlanToCluster(ctx context.Context, plan storage.OperationPlan, ...) error
- type FSMConfig
- type PhaseUpgradeEtcd
- type PhaseUpgradeEtcdBackup
- type PhaseUpgradeEtcdRestart
- type PhaseUpgradeEtcdRestore
- type PhaseUpgradeEtcdShutdown
- type PhaseUpgradeGravitySiteRestart
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutomaticUpgrade ¶
func AutomaticUpgrade(ctx context.Context, localEnv, updateEnv *localenv.LocalEnvironment) (err error)
AutomaticUpgrade starts automatic upgrade process
func ExecutePhase ¶
func ExecutePhase(ctx context.Context, config FSMConfig, params fsm.Params, skipVersionCheck bool) error
ExecutePhase executes the specified phase
func GetOperationPlan ¶
func GetOperationPlan(b storage.Backend) (*storage.OperationPlan, error)
GetOperationPlan returns an up-to-date operation plan
func InitOperationPlan ¶
func InitOperationPlan( ctx context.Context, updateEnv *localenv.LocalEnvironment, clusterEnv *localenv.ClusterEnvironment) (*storage.OperationPlan, error)
InitOperationPlan will initialize operation plan for an operation
func NewGarbageCollectPhase ¶
func NewGarbageCollectPhase(plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.Remote) (*phaseGC, error)
NewGarbageCollectPhase returns a new executor for the garbage collection phase
func NewOperationPlan ¶
func NewOperationPlan(env *localenv.ClusterEnvironment, op storage.SiteOperation) (*storage.OperationPlan, error)
NewOperationPlan generates a new plan for the provided operation
func NewPhaseCoreDNS ¶
func NewPhaseCoreDNS(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseCoreDNS, error)
NewPhaseCoreDNS creates an upgrade phase to add coredns rbac permissions The normal upgrade sequence is to Rolling update planet, then to update our RBAC settings in the RBAC app However, CoreDNS within planet needs these settings to function, so these settings specifically need to be created before the rolling restart of planet
func NewPhaseDrain ¶
func NewPhaseDrain(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseDrain, error)
NewPhaseDrain returns a new executor for draining a node
func NewPhaseElectionChange ¶
func NewPhaseElectionChange( plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.Remote, operator ops.Operator, ) (*phaseElectionChange, error)
NewPhaseElectionChange is a phase for modifying cluster elections during upgrades
func NewPhaseEndpoints ¶
func NewPhaseEndpoints(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseEndpoints, error)
NewPhaseEndpoints returns a new executor for waiting for endpoints
func NewPhaseKubeletPermissions ¶
func NewPhaseKubeletPermissions(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseKubeletPermissions, error)
NewPhaseKubeletPermissions returns a new executor for bootstrapping additional kubelet permissions
func NewPhaseMigrateLinks ¶
func NewPhaseMigrateLinks(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseMigrateLinks, error)
NewPhaseMigrateLinks returns a new links migration executor
func NewPhaseMigrateRoles ¶
func NewPhaseMigrateRoles(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseMigrateRoles, error)
NewPhaseMigrateRoles returns a new roles migration executor
func NewPhaseTaint ¶
func NewPhaseTaint(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseTaint, error)
NewPhaseTaint returns a new executor for adding a taint to a node
func NewPhaseUncordon ¶
func NewPhaseUncordon(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseUncordon, error)
NewPhaseUncordon returns a new executor for uncordoning a node
func NewPhaseUntaint ¶
func NewPhaseUntaint(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseUntaint, error)
NewPhaseUntaint returns a new executor for removing a taint from a node
func NewPhaseUpdateLabels ¶
func NewPhaseUpdateLabels(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*phaseUpdateLabels, error)
NewPhaseUpdateLabels updates labels during an upgrade
func NewPhaseUpgradeEtcd ¶
func NewPhaseUpgradeEtcd(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
func NewPhaseUpgradeEtcdBackup ¶
func NewPhaseUpgradeEtcdBackup(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
func NewPhaseUpgradeEtcdRestart ¶
func NewPhaseUpgradeEtcdRestart(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
func NewPhaseUpgradeEtcdRestore ¶
func NewPhaseUpgradeEtcdRestore(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
func NewPhaseUpgradeEtcdShutdown ¶
func NewPhaseUpgradeEtcdShutdown(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
NewPhaseUpgradeEtcdShutdown creates a phase for shutting down etcd across the cluster 4. Shutdown etcd (all servers) // API outage starts
func NewPhaseUpgradeGravitySiteRestart ¶
func NewPhaseUpgradeGravitySiteRestart(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (fsm.PhaseExecutor, error)
func NewUpdateEngine ¶
NewUpdateEngine returns a new FSM instance
func NewUpdatePhaseApp ¶
func NewUpdatePhaseApp(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseApp, error)
NewUpdatePhaseApp returns a new app phase executor
func NewUpdatePhaseBeforeApp ¶
func NewUpdatePhaseBeforeApp(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseBeforeApp, error)
NewUpdatePhaseBeforeApp returns a new executor for running application pre-update hook
func NewUpdatePhaseBootstrap ¶
func NewUpdatePhaseBootstrap(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.Remote) (fsm.PhaseExecutor, error)
NewUpdatePhaseBootstrap creates a new bootstrap phase executor
func NewUpdatePhaseChecks ¶
func NewUpdatePhaseChecks( c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.AgentRepository, ) (*updatePhaseChecks, error)
NewUpdatePhaseChecks creates a new preflight checks phase executor
func NewUpdatePhaseConfig ¶
func NewUpdatePhaseConfig(c FSMConfig, p fsm.ExecutorParams, remote fsm.Remote) (*updatePhaseConfig, error)
NewUpdatePhaseConfig returns executor that pulls local configuration packages
func NewUpdatePhaseInit ¶
func NewUpdatePhaseInit(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase) (*updatePhaseInit, error)
NewUpdatePhaseInit creates a new update init phase executor
func NewUpdatePhaseSystem ¶
func NewUpdatePhaseSystem(c FSMConfig, plan storage.OperationPlan, phase storage.OperationPhase, remote fsm.Remote) (*updatePhaseSystem, error)
NewUpdatePhaseNode returns a new node update phase executor
func RollbackPhase ¶
func RollbackPhase(ctx context.Context, config FSMConfig, params fsm.Params, skipVersionCheck bool) error
RollbackPhase rolls back the specified phase, allows fallback to recovery fsm in case etcd is down
func ShutdownClusterAgents ¶
func ShutdownClusterAgents(ctx context.Context, remote rpc.AgentRepository) error
ShutdownClusterAgents fetches all nodes in a cluster and submits a shutdown request
func SyncOperationPlan ¶
SyncOperationPlan will synchronize the operation plan from source backend to the destination
func SyncOperationPlanToCluster ¶
func SyncOperationPlanToCluster(ctx context.Context, plan storage.OperationPlan, clientCreds credentials.TransportCredentials) error
SyncOperationPlanToCluster runs gravity plan --sync on each cluster member, to force syncronization from etcd to the local store
Types ¶
type FSMConfig ¶
type FSMConfig struct {
// Backend is the cluster etcd backend
Backend storage.Backend
// LocalBackend is used as a redundant local storage for cases when etcd goes down
LocalBackend storage.Backend
// HostLocalBackend is the host-local backend that stores bootstrap configuration
// like DNS, logins etc.
HostLocalBackend storage.Backend
// Packages is the local package service
Packages pack.PackageService
// ClusterPackages is the package service that talks to cluster API
ClusterPackages pack.PackageService
// HostLocalPackages is the host-local package service that contains package
// metadata used for updates
HostLocalPackages pack.PackageService
// Apps is the cluster apps service
Apps app.Applications
// Client is the cluster Kubernetes client
Client *kubernetes.Clientset
// Operator is the local cluster operator
Operator ops.Operator
// Users is the cluster identity service
Users users.Identity
// Spec is used to retrieve a phase executor, allows
// plugging different phase executors during tests
Spec fsm.FSMSpecFunc
// Remote allows to create RPC clients
Remote fsm.AgentRepository
}
FSMConfig is the fsm configuration
type PhaseUpgradeEtcd ¶
type PhaseUpgradeEtcd struct {
log.FieldLogger
Server storage.Server
}
PhaseUpgradeEtcd upgrades etcd specifically on the leader
type PhaseUpgradeEtcdBackup ¶
type PhaseUpgradeEtcdBackup struct {
log.FieldLogger
}
PhaseUpgradeEtcdBackup backs up etcd data on all servers
func (*PhaseUpgradeEtcdBackup) Execute ¶
func (p *PhaseUpgradeEtcdBackup) Execute(ctx context.Context) error
func (*PhaseUpgradeEtcdBackup) PostCheck ¶
func (*PhaseUpgradeEtcdBackup) PostCheck(context.Context) error
type PhaseUpgradeEtcdRestart ¶
type PhaseUpgradeEtcdRestart struct {
log.FieldLogger
Server storage.Server
}
PhaseUpgradeEtcdRestart disables the etcd-upgrade service, and starts the etcd service
func (*PhaseUpgradeEtcdRestart) Execute ¶
func (p *PhaseUpgradeEtcdRestart) Execute(ctx context.Context) error
func (*PhaseUpgradeEtcdRestart) PostCheck ¶
func (*PhaseUpgradeEtcdRestart) PostCheck(context.Context) error
type PhaseUpgradeEtcdRestore ¶
type PhaseUpgradeEtcdRestore struct {
log.FieldLogger
Server storage.Server
}
PhaseUpgradeRestore restores etcd data from backup, if it was wiped by the upgrade stage
func (*PhaseUpgradeEtcdRestore) Execute ¶
func (p *PhaseUpgradeEtcdRestore) Execute(ctx context.Context) error
Execute restores the etcd data from backup 7. Restore the /registry (kubernetes) data to etcd, including automatic migration to v3 datastore for kubernetes 10. Restart etcd on the correct ports on first node // API outage ends
func (*PhaseUpgradeEtcdRestore) PostCheck ¶
func (*PhaseUpgradeEtcdRestore) PostCheck(context.Context) error
type PhaseUpgradeEtcdShutdown ¶
type PhaseUpgradeEtcdShutdown struct {
log.FieldLogger
Client *kubeapi.Clientset
// contains filtered or unexported fields
}
PhaseUpgradeEtcdShutdown shuts down etcd across the cluster
func (*PhaseUpgradeEtcdShutdown) Execute ¶
func (p *PhaseUpgradeEtcdShutdown) Execute(ctx context.Context) error
func (*PhaseUpgradeEtcdShutdown) PostCheck ¶
func (*PhaseUpgradeEtcdShutdown) PostCheck(context.Context) error
type PhaseUpgradeGravitySiteRestart ¶
type PhaseUpgradeGravitySiteRestart struct {
log.FieldLogger
Client *kubeapi.Clientset
}
PhaseUpgradeGravitySiteRestart restarts gravity-site pod
func (*PhaseUpgradeGravitySiteRestart) Execute ¶
func (p *PhaseUpgradeGravitySiteRestart) Execute(ctx context.Context) error
func (*PhaseUpgradeGravitySiteRestart) PostCheck ¶
func (*PhaseUpgradeGravitySiteRestart) PostCheck(context.Context) error