juju: github.com/juju/juju/worker/upgradesteps Index | Files

package upgradesteps

import "github.com/juju/juju/worker/upgradesteps"

Index

Package Files

manifold.go worker.go

Variables

var (
    PerformUpgrade = upgrades.PerformUpgrade // Allow patching

    // The maximum time a master controller will wait for other
    // controllers to come up and indicate they are ready to begin
    // running upgrade steps.
    UpgradeStartTimeoutMaster = time.Minute * 15

    // The maximum time a secondary controller will wait for other
    // controllers to come up and indicate they are ready to begin
    // running upgrade steps. This is effectively "forever" because we
    // don't really want secondaries to ever give up once they've
    // indicated that they're ready to upgrade. It's up to the master
    // to abort the upgrade if required.
    //
    // This should get reduced when/if master re-elections are
    // introduce in the case a master that failing to come up for
    // upgrade.
    UpgradeStartTimeoutSecondary = time.Hour * 4
)
var IsMachineMaster = func(pool *state.StatePool, machineId string) (bool, error) {
    if pool == nil {

        return false, nil
    }

    st := pool.SystemState()
    machine, err := st.Machine(machineId)
    if err != nil {

        return false, errors.Trace(err)
    }
    isMaster, err := mongo.IsMaster(st.MongoSession(), machine)
    if err != nil {
        return false, errors.Trace(err)
    }
    return isMaster, nil
}

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs an upgrader worker, using the resource names defined in the supplied config.

func NewLock Uses

func NewLock(agentConfig agent.Config) gate.Lock

NewLock creates a gate.Lock to be used to synchronise workers which need to start after upgrades have completed. The returned Lock should be passed to NewWorker. If the agent has already upgraded to the current version, then the lock will be returned in the released state.

func NewWorker Uses

func NewWorker(
    upgradeComplete gate.Lock,
    agent agent.Agent,
    apiConn api.Connection,
    isController bool,
    openState func() (*state.StatePool, error),
    preUpgradeSteps func(st *state.StatePool, agentConf agent.Config, isController, isMasterServer, isCaas bool) error,
    entity StatusSetter,
    isCaas bool,
) (worker.Worker, error)

NewWorker returns a new instance of the upgradesteps worker. It will run any required steps to upgrade to the currently running Juju version.

type ManifoldConfig Uses

type ManifoldConfig struct {
    AgentName            string
    APICallerName        string
    UpgradeStepsGateName string
    OpenStateForUpgrade  func() (*state.StatePool, error)
    PreUpgradeSteps      func(*state.StatePool, agent.Config, bool, bool, bool) error
    NewAgentStatusSetter func(apiConn api.Connection) (StatusSetter, error)
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

type StatusSetter Uses

type StatusSetter interface {
    SetStatus(setableStatus status.Status, info string, data map[string]interface{}) error
}

StatusSetter defines the single method required to set an agent's status.

Package upgradesteps imports 21 packages (graph) and is imported by 51 packages. Updated 2019-08-26. Refresh now. Tools for package owners.