manager

package
v2.0.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 26 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// Expected Secret data and string data keys
	AuthUrlKey                     = "OS_AUTH_URL"
	UsernameKey                    = "OS_USERNAME"
	UserIDKey                      = "OS_USERID"
	PasswordKey                    = "OS_PASSWORD"
	TenantIDKey                    = "OS_TENANT_ID"
	TenantNameKey                  = "OS_TENANT_NAME"
	DomainIDKey                    = "OS_PROJECT_DOMAIN_ID"
	DomainNameKey                  = "OS_PROJECT_DOMAIN_NAME"
	RegionNameKey                  = "OS_REGION_NAME"
	KeystoneRegionNameKey          = "OS_KEYSTONE_REGION_NAME"
	ApplicationCredentialIDKey     = "OS_APPLICATION_CREDENTIAL_ID"
	ApplicationCredentialNameKey   = "OS_APPLICATION_CREDENTIAL_NAME"
	ApplicationCredentialSecretKey = "OS_APPLICATION_CREDENTIAL_SECRET"
	ProjectIDKey                   = "OS_PROJECT_ID"
	ProjectNameKey                 = "OS_PROJECT_NAME"
	InterfaceKey                   = "OS_INTERFACE"
	DebugKey                       = "OS_DEBUG"
)
View Source
const (
	// Well-known openstack API attribute values for the system API
	SystemEndpointName = "sysinv"
	SystemEndpointType = "platform"
)
View Source
const (
	// Defines HTTP and HTTPS URL prefixes.
	HTTPSPrefix = "https://"
	HTTPPrefix  = "http://"
)
View Source
const (
	// Defines annotation keys for resources.
	NotificationCountKey = "deployment-manager/notifications"
	ReconcileAfterInSync = "deployment-manager/reconcile-after-insync"
)
View Source
const HTTPSNotEnabled = "server gave HTTP response to HTTPS client"
View Source
const SystemEndpointSecretName = "system-endpoint"

Well-known name of the secret which holds the system API endpoint attributes (e.g., OS_USERNAME, OS_*)

Variables

This section is empty.

Functions

func BuildMonitorKey added in v1.0.0

func BuildMonitorKey(object runtime.Object) string

BuildMonitorKey is a utility function that formats a string to be used as a unique key for a monitor

func GetAuthOptionsFromEnv

func GetAuthOptionsFromEnv() (gophercloud.AuthOptions, error)

func GetAuthOptionsFromSecret

func GetAuthOptionsFromSecret(endpointSecret *v1.Secret) ([]gophercloud.AuthOptions, error)

Builds the client authentication options from a given secret which should contain environment variable like values. For example, OS_AUTH_URL, OS_USERNAME, etc...

func NewClientError added in v1.0.0

func NewClientError(msg string) error

NewClientError defines a wrapper to correctly instantiate a manager client error.

func NewWaitForMonitor added in v1.0.0

func NewWaitForMonitor(msg string) error

NewWaitForMonitor defines a constructor for the WaitForMonitor error type.

Types

type BaseError added in v1.0.0

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

BaseError defines a common Error implementation for all manager errors that derive from this structure.

func (BaseError) Error added in v1.0.0

func (in BaseError) Error() string

Error implements the Error interface for all structures that derive from BaseError.

type ClientError added in v1.0.0

type ClientError struct {
	BaseError
}

ClientError defines an error to be used on an semantic error encountered while attempting to build a platform client object.

type CloudManager added in v1.0.0

type CloudManager interface {
	ResetPlatformClient(namespace string) error
	GetPlatformClient(namespace string) *gophercloud.ServiceClient
	GetKubernetesClient() client.Client
	BuildPlatformClient(namespace string) (*gophercloud.ServiceClient, error)
	NotifySystemDependencies(namespace string) error
	NotifyResource(object runtime.Object) error
	SetSystemReady(namespace string, value bool)
	GetSystemReady(namespace string) bool
	SetSystemType(namespace string, value SystemType)
	GetSystemType(namespace string) SystemType
	StartMonitor(monitor *Monitor, message string) error
	CancelMonitor(object runtime.Object)
}

CloudManager wraps a runtime manager and provides the ability to coordinate certain function across different controllers.

func GetInstance

func GetInstance(mgr manager.Manager) CloudManager

GetInstance returns a singleton instance of the platform manager

func NewPlatformManager

func NewPlatformManager(manager manager.Manager) CloudManager

type CommonMonitorBody added in v1.0.0

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

CommonMonitorBody is a common struct that can be inherited by all MonitorBody implementations

func (*CommonMonitorBody) SetState added in v1.0.0

func (in *CommonMonitorBody) SetState(messageFmt string, args ...interface{})

SetState sets the current state of the monitor body.

func (*CommonMonitorBody) State added in v1.0.0

func (in *CommonMonitorBody) State() string

State retrieves the current state of the monitor body.

type Monitor

type Monitor struct {
	// MonitorBody is a reference to an actual monitored workload.  It is
	// responsible for all type specific monitoring actions while the Monitor
	// structure is responsible for the generic monitor framework.
	MonitorBody

	// Logger allows a base monitor to implement a logging interface so that
	// it can supply its own custom log "name" when generating logs that are
	// a subset of whatever log stream that is being used by the controller that
	// instantiated this monitor.
	logr.Logger

	// manager is a reference to the Cloud Platform Manager that has been
	// instantiated to oversee all of the controller objects.
	Manager CloudManager

	// interval defines the number of seconds between each polling attempt.
	Interval time.Duration

	// object is the kubernetes resource object that is the source of the
	// monitoring event.
	Object runtime.Object
	// contains filtered or unexported fields
}

Monitor defines the common behaviour of all monitors. Since the Monitor implementation is simple and can be written generically for all monitors that implementation is encapsulated within a base class type structure.

func (*Monitor) GetKey added in v1.0.0

func (m *Monitor) GetKey() string

BuildMonitorKey is a utility function that formats a string to be used as a unique key for a monitor

func (*Monitor) GetNamespace added in v1.0.0

func (m *Monitor) GetNamespace() string

GetNamespace returns the namespace to which the object being monitored is associated.

func (*Monitor) Start added in v1.0.0

func (m *Monitor) Start(manager CloudManager)

Start is responsible for stating the Go routine that will monitor a resource or set of resources.

func (*Monitor) Stop added in v1.0.0

func (m *Monitor) Stop()

Stop is responsible for stopping the monitor Go routine. It does so by signaling thru the stop channel.

type MonitorBody added in v1.0.0

type MonitorBody interface {
	// Run is responsible for starting a Go routine to monitor a resource
	Run(client *gophercloud.ServiceClient) (stop bool, err error)

	// State is how the monitor body reports its current state to the monitor.
	State() string
}

Monitor defines the interface which must be implemented by all concrete monitor structures. A monitor object should be capable of spawning a Go routine on Start and stopping that routing on Stop.

type MonitorManager added in v1.0.0

type MonitorManager interface {
	SetManager(manager CloudManager)
}

MonitorManager defines an interface for monitors that need access to the manager reference.

type PlatformManager

type PlatformManager struct {
	manager.Manager
	// contains filtered or unexported fields
}

func (*PlatformManager) BuildPlatformClient

func (m *PlatformManager) BuildPlatformClient(namespace string) (*gophercloud.ServiceClient, error)

func (*PlatformManager) CancelMonitor added in v1.0.0

func (m *PlatformManager) CancelMonitor(object runtime.Object)

CancelMonitor stops any monitor currently running against the resource being reconciled.

func (*PlatformManager) GetKubernetesClient added in v1.0.0

func (m *PlatformManager) GetKubernetesClient() client.Client

GetKubernetesClient returns a reference to the Kubernetes client

func (*PlatformManager) GetPlatformClient

func (m *PlatformManager) GetPlatformClient(namespace string) *gophercloud.ServiceClient

GetPlatformClient returns the instance of the platform manager for a given namespace. It is has not been created yet then false is returned in the second return parameter.

func (*PlatformManager) GetSystemReady

func (m *PlatformManager) GetSystemReady(namespace string) bool

GetSystemReady returns whether the system for the specified namespace is ready for all controllers to reconcile their resources.

func (*PlatformManager) GetSystemType

func (m *PlatformManager) GetSystemType(namespace string) SystemType

GetSystemReady returns whether the system for the specified namespace is ready for all controllers to reconcile their resources.

func (*PlatformManager) NotifyResource added in v1.0.0

func (m *PlatformManager) NotifyResource(object runtime.Object) error

func (*PlatformManager) NotifySystemController

func (m *PlatformManager) NotifySystemController(namespace string) error

func (*PlatformManager) NotifySystemDependencies

func (m *PlatformManager) NotifySystemDependencies(namespace string) error

func (*PlatformManager) ResetPlatformClient

func (m *PlatformManager) ResetPlatformClient(namespace string) error

ResetPlatformClient deletes the instance of the platform manager for a given namespace.

func (*PlatformManager) SetSystemReady

func (m *PlatformManager) SetSystemReady(namespace string, value bool)

SetSystemReady allows setting the readiness state for a given namespace.

func (*PlatformManager) SetSystemType

func (m *PlatformManager) SetSystemType(namespace string, value SystemType)

SetSystemReady allows setting the readiness state for a given namespace.

func (*PlatformManager) StartMonitor added in v1.0.0

func (m *PlatformManager) StartMonitor(monitor *Monitor, message string) error

StartMonitor starts the specified monitor, generates an event, and then return an error suitable to stop the reconciler from running until the monitor has explicitly triggered a new reconcilable event.

type SystemMode

type SystemMode string
const (
	SystemModeSimplex SystemMode = "simplex"
	SystemModeDuplex  SystemMode = "duplex"
)

Defines the current list of system modes

type SystemNamespace

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

type SystemType

type SystemType string
const (
	SystemTypeAllInOne SystemType = "all-in-one"
	SystemTypeStandard SystemType = "standard"
)

Defines the current list of system types.

type WaitForMonitor added in v1.0.0

type WaitForMonitor struct {
	BaseError
}

WaitForMonitor defines a special error object that signals to the common error handler that a monitor has been launched to trigger another reconciliation attempt only when certain criteria have been met.

Jump to

Keyboard shortcuts

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