host

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: Apache-2.0 Imports: 41 Imported by: 1

Documentation

Index

Constants

View Source
const ControllerName = "host-controller"
View Source
const FinalizerName = "host.finalizers.windriver.com"

Variables

View Source
var AdminLocked = hosts.AdminLocked

DefaultHostProfile contains mandatory default values for a host profile. This is intentionally sparsely populated because the system API defaults are preferred for any attributes not specified by the user. Only attributes that are absolutely required for the proper functioning of this controller should be specified here.

View Source
var DefaultHostProfile = starlingxv1beta1.HostProfileSpec{
	ProfileBaseAttributes: starlingxv1beta1.ProfileBaseAttributes{
		AdministrativeState: &AdminLocked,
		ProvisioningMode:    &DynamicProvisioningMode,
	},
}
View Source
var DynamicProvisioningMode = starlingxv1beta1.ProvioningModeDynamic

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new Host Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller and Start it when the Manager is Started.

func MergeProfiles

MergeProfiles invokes the mergo.Merge API with our desired modifiers.

Types

type ReconcileHost

type ReconcileHost struct {
	client.Client

	titaniumManager.TitaniumManager
	common.ReconcilerErrorHandler
	common.ReconcilerEventLogger
	// contains filtered or unexported fields
}

ReconcileHostByState reconciles a Host object

func (*ReconcileHost) AllControllerNodesEnabled

func (r *ReconcileHost) AllControllerNodesEnabled() bool

AllControllerNodesEnabled determines whether the system is ready for additional nodes to be unlocked. To avoid issues with provisioning storage resources we need to wait for both controllers to be unlocked/enabled.

func (*ReconcileHost) AnyStorageNodesEnabled

func (r *ReconcileHost) AnyStorageNodesEnabled() bool

AnyStorageNodesEnabled determines whether the system is ready for additional worker nodes to be unlocked. To satisfy storage dependencies we need to wait for storage nodes to be enabled if they are present.

func (*ReconcileHost) BuildCompositeProfile

func (r *ReconcileHost) BuildCompositeProfile(host *starlingxv1beta1.Host) (*starlingxv1beta1.HostProfileSpec, error)

BuildCompositeProfile combines the default profile, the profile inheritance chain, and host specific overrides to form a final composite profile that will be applied to the host at configuration time.

func (*ReconcileHost) BuildHostDefaults

func (r *ReconcileHost) BuildHostDefaults(instance *starlingxv1beta1.Host, host *v1info.HostInfo) (*starlingxv1beta1.HostProfileSpec, error)

BuildHostDefaults takes the current set of host attributes and builds a fake host profile that can be used as a reference for the current settings applied to the host. The default settings are saved on the host status.

func (*ReconcileHost) CompareAttributes

func (r *ReconcileHost) CompareAttributes(in *starlingxv1beta1.HostProfileSpec, other *starlingxv1beta1.HostProfileSpec, namespace, personality string) bool

CompareAttributes determines if two profiles are identical for the purpose of reconciling a current host configuration to its desired host profile.

func (*ReconcileHost) CompareDisabledAttributes

func (r *ReconcileHost) CompareDisabledAttributes(in *starlingxv1beta1.HostProfileSpec, other *starlingxv1beta1.HostProfileSpec, namespace, personality string) bool

CompareEnabledAttributes determines if two profiles are identical for the purpose of reconciling any attributes that can only be applied when the host is enabled.

func (*ReconcileHost) CompareEnabledAttributes

func (r *ReconcileHost) CompareEnabledAttributes(in *starlingxv1beta1.HostProfileSpec, other *starlingxv1beta1.HostProfileSpec, namespace, personality string) bool

CompareEnabledAttributes determines if two profiles are identical for the purpose of reconciling any attributes that can only be applied when the host is enabled. The only attributes that we can reconcile while enabled are the storage OSD resources therefore return false if there are any differences in the storage OSD list.

func (*ReconcileHost) CompareOSDs

CompareOSDs determine if there has been a change to the list of OSDs between two profile specs. This method takes into consideration that the storage section may be completely empty on either side of the comparison.

func (*ReconcileHost) DeleteHostProfile

func (r *ReconcileHost) DeleteHostProfile(namespace, profile string) error

DeleteHostProfile deletes a HostProfile from the kubernetes API

func (*ReconcileHost) GetHostDefaults

func (r *ReconcileHost) GetHostDefaults(instance *starlingxv1beta1.Host) (*starlingxv1beta1.HostProfileSpec, error)

GetHostDefaults retrieves the default attributes for a host. The set of default attributes are collected from the host before any user configurations are applied.

func (*ReconcileHost) GetHostProfile

func (r *ReconcileHost) GetHostProfile(namespace, profile string) (*starlingxv1beta1.HostProfileSpec, error)

GetHostProfile retrieves a HostProfileSpec from the kubernetes API

func (*ReconcileHost) HTTPSRequired

func (r *ReconcileHost) HTTPSRequired() bool

HTTPSRequired determines whether an HTTPS connection is required for the purpose of configuring host BMC attributes.

func (*ReconcileHost) MonitorsEnabled

func (r *ReconcileHost) MonitorsEnabled(required int) bool

MonitorsEnabled determines whether the required number of monitors are enabled or not. Provisioning certain storage resources requires that a certain number of monitors be enabled.

func (*ReconcileHost) OSDProvisioningAllowed

func (r *ReconcileHost) OSDProvisioningAllowed(instance *starlingxv1beta1.Host, osdInfo starlingxv1beta1.OSDInfo, tierUUID *string, host *v1info.HostInfo) error

OSDProvisioningAllowed is a utility function which determines whether OSD provisioning is allowed based on the node type, the current cluster deployment model, and the current state of the controllers.

func (*ReconcileHost) OSDProvisioningState

func (r *ReconcileHost) OSDProvisioningState(namespace string, personality string) RequiredState

OSDProvisioningState determines at what time the system permits OSD resources to be added to a host.

func (*ReconcileHost) ProvisioningAllowed

func (r *ReconcileHost) ProvisioningAllowed() bool

ProvisioningAllowed determines whether the system will allow creating or configuring new hosts. The primary controller must be enabled for these actions to be allowed.

func (*ReconcileHost) Reconcile

func (r *ReconcileHost) Reconcile(request reconcile.Request) (result reconcile.Result, err error)

Reconcile reads that state of the cluster for a Host object and makes changes based on the state read and what is in the Host.Spec +kubebuilder:rbac:groups="",resources=events,verbs=create;patch +kubebuilder:rbac:groups=starlingx.windriver.com,resources=hosts,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=starlingx.windriver.com,resources=hosts/status,verbs=get;update;patch

func (*ReconcileHost) ReconcileAddresses

func (r *ReconcileHost) ReconcileAddresses(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileAttributes

func (r *ReconcileHost) ReconcileAttributes(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *hosts.Host) error

ReconcileAttributes is responsible for reconciling the basic attributes for a host resource.

func (*ReconcileHost) ReconcileBondInterfaces

func (r *ReconcileHost) ReconcileBondInterfaces(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileDeletedHost

func (r *ReconcileHost) ReconcileDeletedHost(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, host *hosts.Host) (err error)

ReconcileExistingHost is responsible for dealing with the provisioning of an existing host.

func (*ReconcileHost) ReconcileDisabledHost

func (r *ReconcileHost) ReconcileDisabledHost(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileHostByState is responsible for reconciling each individual sub-domain of a host resource.

func (*ReconcileHost) ReconcileEnabledHost

func (r *ReconcileHost) ReconcileEnabledHost(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileEthernetInterfaces

func (r *ReconcileHost) ReconcileEthernetInterfaces(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileEthernetInterfaces will update system interfaces to align with the desired configuration. It is assumed that the configuration will apply; meaning that prior to invoking this function stale interfaces and stale interface configurations have been resolved so that the intended list of ethernet interface configuration will apply cleanly here.

func (*ReconcileHost) ReconcileExistingHost

func (r *ReconcileHost) ReconcileExistingHost(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *hosts.Host) error

ReconcileExistingHost is responsible for dealing with the provisioning of an existing host.

func (*ReconcileHost) ReconcileFinalState

func (r *ReconcileHost) ReconcileFinalState(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileFinalState is intended to be run as the last step. Once all configuration changes have been applied it is safe to change the state of the host if the desired state is different than the current state.

func (*ReconcileHost) ReconcileHostByState

ReconcileHostByState is responsible for differentiating between an enabled host and a disabled host. Most attributes only support being updated when the host is in a certain state therefore those differences are discriminated here.

func (*ReconcileHost) ReconcileInitialState

func (r *ReconcileHost) ReconcileInitialState(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileInitialState is intended to be run before any other changes are reconciled on the host. Its purpose is to set the administrative state to Locked if that is the intended state. Attribute changes may require this and if the operator knows this then they may have set the state to Locked in order to change certain attributes.

func (*ReconcileHost) ReconcileLabels

func (r *ReconcileHost) ReconcileLabels(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileAttributes is responsible for reconciling the labels on each host.

func (*ReconcileHost) ReconcileMemory

func (r *ReconcileHost) ReconcileMemory(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileMemory is responsible for reconciling the Memory configuration of a host resource.

func (*ReconcileHost) ReconcileMonitor

func (r *ReconcileHost) ReconcileMonitor(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileMonitor is responsible for reconciling the Ceph storage monitor configuration of a compute host resource.

func (*ReconcileHost) ReconcileNetworking

func (r *ReconcileHost) ReconcileNetworking(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileNetworking is responsible for reconciling the Memory configuration of a host resource.

func (*ReconcileHost) ReconcileNewHost

func (r *ReconcileHost) ReconcileNewHost(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *hosts.Host) (*hosts.Host, error)

ReconcileNewHost is responsible for dealing with the initial provisioning of a host. This handles both static and dynamic provisioning of hosts. If a new host is created then the 'host' return parameter will be updated with a pointer to the new host object.

func (*ReconcileHost) ReconcileOSDs

func (r *ReconcileHost) ReconcileOSDs(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileOSDs is responsible for reconciling the storage OSD configuration of a host resource.

func (*ReconcileHost) ReconcileOSDsByType

func (r *ReconcileHost) ReconcileOSDsByType(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo, function string) error

ReconcileOSDsByType is responsible for reconciling the storage OSD configuration of a host resource for a specific type of OSD function.

func (*ReconcileHost) ReconcilePartitions

ReconcileMonitor is responsible for reconciling the disk partitions configuration on a host.

func (*ReconcileHost) ReconcilePhysicalVolumes

func (r *ReconcileHost) ReconcilePhysicalVolumes(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo, group starlingxv1beta1.VolumeGroupInfo) error

ReconcilePhysicalVolumes is responsible for reconciling the physical volume configuration on a host.

func (*ReconcileHost) ReconcilePowerState

func (r *ReconcileHost) ReconcilePowerState(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileInitialState is intended to be run before any other changes are reconciled on the host. Its purpose is to set the administrative state to Locked if that is the intended state. Attribute changes may require this and if the operator knows this then they may have set the state to Locked in order to change certain attributes.

func (*ReconcileHost) ReconcileProcessors

func (r *ReconcileHost) ReconcileProcessors(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileProcessors is responsible for reconciling the CPU configuration of a host resource.

func (*ReconcileHost) ReconcileResource

func (r *ReconcileHost) ReconcileResource(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host) (err error)

ReconcileResource interacts with the system API in order to reconcile the state of a data network with the state stored in the k8s database.

func (*ReconcileHost) ReconcileRoutes

func (r *ReconcileHost) ReconcileRoutes(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileStaleAddresses

func (r *ReconcileHost) ReconcileStaleAddresses(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileStaleInterfaces

func (r *ReconcileHost) ReconcileStaleInterfaces(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileStaleInterfaces will examine the current set of system interfaces and determine if any of them need to be deleted. An interface needs to be deleted if:

A) it no longer exists in the list of interfaces to be configured
B) it still exists as a VLAN, but has a different vlan-id value
C) it still exists as a Bond, but has no members in common with the system
   interface.

func (*ReconcileHost) ReconcileStaleOSDs

func (r *ReconcileHost) ReconcileStaleOSDs(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileStaleOSDs is responsible for removing any OSD resources that are either no longer in the configured list or their function or journal has changed.

func (*ReconcileHost) ReconcileStaleRoutes

func (r *ReconcileHost) ReconcileStaleRoutes(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileStorage

func (r *ReconcileHost) ReconcileStorage(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileStorage is responsible for reconciling the Storage configuration of a host resource.

func (*ReconcileHost) ReconcileVLANInterfaces

func (r *ReconcileHost) ReconcileVLANInterfaces(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

func (*ReconcileHost) ReconcileVolumeGroups

func (r *ReconcileHost) ReconcileVolumeGroups(client *gophercloud.ServiceClient, instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, host *v1info.HostInfo) error

ReconcileVolumeGroups is responsible for reconciling the volume group configuration of a host resource.

func (*ReconcileHost) StopAfterInSync

func (r *ReconcileHost) StopAfterInSync() bool

StopAfterInSync determines whether the reconciler should continue processing change requests after the purpose of configuring host BMC attributes.

func (*ReconcileHost) UpdateRequired

func (r *ReconcileHost) UpdateRequired(instance *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec, h *hosts.Host) (opts hosts.HostOpts, result bool, err error)

UpdateRequired determines if any of the configured attributes mismatch with those in the running system. If there are mismatches then true is returned in the result and opts is configured with only those values that need to change.

func (*ReconcileHost) ValidateProfile

func (r *ReconcileHost) ValidateProfile(host *starlingxv1beta1.Host, profile *starlingxv1beta1.HostProfileSpec) error

ValidateProfile examines a composite profile and performs basic validation to ensure that all required attributes have been supplied. This must be done at runtime rather than at schema validation time because most fields are marked as optional in the schema so that profile inheritance can be used to specify only subsets of attributes at each profile level (e.g., an interface profile does not need to set personality or administrative state, but some profile in the inheritance chain must). Therefore each individual profile itself may not be valid but when attached to a host the full chain of profiles must produce a valid set of attributes.

type RequiredState

type RequiredState string

RequiredState defines an alias that represents in which host state(s) is a resource allowed to be provisioned.

const (
	RequiredStateNone     RequiredState = "none"
	RequiredStateAny      RequiredState = "any"
	RequiredStateEnabled  RequiredState = "enabled"
	RequiredStateDisabled RequiredState = "disabled"
)

Defines the value values for the RequiredState type alias.

Jump to

Keyboard shortcuts

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