Documentation
¶
Index ¶
- func EncodeKubeControllerSchedule(schedule types.AgentUpgradeSchedule) (string, error)
- func EncodeSystemdUnitSchedule(schedule types.AgentUpgradeSchedule) (string, error)
- type Driver
- type ExportFunc
- type Exporter
- type ExporterConfig
- type KubeControllerDriverConfig
- type KubernetesBackend
- type SystemdUnitDriverConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeKubeControllerSchedule ¶
func EncodeKubeControllerSchedule(schedule types.AgentUpgradeSchedule) (string, error)
EncodeKubeControllerSchedule converts an agent upgrade schedule to the file format expected by the kuberenets upgrade controller.
func EncodeSystemdUnitSchedule ¶
func EncodeSystemdUnitSchedule(schedule types.AgentUpgradeSchedule) (string, error)
EncodeSystemdUnitSchedule converts an agent upgrade schedule to the file format expected by the teleport-upgrade script.
Types ¶
type Driver ¶
type Driver interface {
// Kind gets the upgrader kind associated with this export driver.
Kind() string
// Sync exports the appropriate maintenance window schedule if one is present, or
// resets/clears the maintenance window if the schedule response returns no viable scheduling
// info.
Sync(ctx context.Context, rsp proto.ExportUpgradeWindowsResponse) error
// Reset forcibly clears any previously exported maintenance window values. This should be
// called if teleport experiences prolonged loss of auth connectivity, which may be an indicator
// that the control plane has been upgraded s.t. this agent is no longer compatible.
Reset(ctx context.Context) error
}
Driver represents a type capable of exporting the maintenance window schedule to an external upgrader, such as the teleport-upgrade systemd timer or the kube-updater controller.
func NewDriver ¶
NewDriver sets up a new export driver corresponding to the specified upgrader kind.
func NewKubeControllerDriver ¶
func NewKubeControllerDriver(cfg KubeControllerDriverConfig) (Driver, error)
func NewSystemdUnitDriver ¶
func NewSystemdUnitDriver(cfg SystemdUnitDriverConfig) (Driver, error)
type ExportFunc ¶
type ExportFunc func(ctx context.Context, req proto.ExportUpgradeWindowsRequest) (proto.ExportUpgradeWindowsResponse, error)
ExportFunc represents the ExportUpgradeWindows rpc exposed by auth servers.
type Exporter ¶
type Exporter[C contextLike] struct {
// contains filtered or unexported fields
}
Exporter is a helper used to export maintenance window schedule values to external upgraders.
func NewExporter ¶
func NewExporter[C contextLike](cfg ExporterConfig[C]) (*Exporter[C], error)
NewExporter builds an exporter. Start must be called in order to begin export operations.
type ExporterConfig ¶
type ExporterConfig[C contextLike] struct {
// Driver is the underlying export driver.
Driver Driver
// ExportFunc gets the current maintenance window.
ExportFunc ExportFunc
// AuthConnectivitySentinel is a channel that yields context-like values indicating the current health of
// auth connectivity. When connectivity to auth is established, a context-like value should be sent over
// the channel. If auth connectivity is subsequently lost, that context-like value must be canceled.
// During normal runtime, this should use DownstreamInventoryHandle.Sender(). During tests
// it can just be a stream of context.Context values.
AuthConnectivitySentinel <-chan C
// UnhealthyThreshold is the threshold after which failure to export
// is treated as an unhealthy event.
UnhealthyThreshold time.Duration
// ExportInterval is the interval at which exports are attempted
ExportInterval time.Duration
// FirstExport is a custom duration used for firt export attempt.
FirstExport time.Duration
// contains filtered or unexported fields
}
ExporterConfig configures a maintenance window exporter.
func (*ExporterConfig[C]) CheckAndSetDefaults ¶
func (c *ExporterConfig[C]) CheckAndSetDefaults() error
type KubeControllerDriverConfig ¶
type KubeControllerDriverConfig struct {
// Backend is an optional backend. Must be an instance of the kuberenets shared-state backend
// if not nil.
Backend KubernetesBackend
}
type KubernetesBackend ¶
type KubernetesBackend interface {
// Put puts value into backend (creates if it does not
// exists, updates it otherwise)
Put(ctx context.Context, i backend.Item) (*backend.Lease, error)
}
KubernetesBackend interface for kube shared storage backend.
type SystemdUnitDriverConfig ¶
type SystemdUnitDriverConfig struct {
// ConfigDir is the directory from which the teleport-upgrade periodic loads its
// configuration parameters. Most notably, the 'schedule' file.
ConfigDir string
}