state

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyncStateReady    = "ready"
	SyncStateNotReady = "notReady"
	SyncStateIgnore   = "ignore"
	SyncStateReset    = "reset"
	SyncStateError    = "error"
)

Represents the Sync state of a specific State or a collection of States

View Source
const (
	InfoTypeNodeInfo = iota
)

Variables

View Source
var CertConfigPathMap = map[string]string{
	"ubuntu": "/etc/ssl/certs",
	"rhcos":  "/etc/pki/ca-trust/extracted/pem",
}

CertConfigPathMap indicates standard OS specific paths for ssl keys/certificates. Where Go looks for certs: https://golang.org/src/crypto/x509/root_linux.go Where OCP mounts proxy certs on RHCOS nodes: https://access.redhat.com/documentation/en-us/openshift_container_platform/4.3/html/authentication/ocp-certificates#proxy-certificates_ocp-certificates

View Source
var ConfigMapKeysOverride = map[string]map[string]string{
	// contains filtered or unexported fields
}

ConfigMapKeysOverride contains static key override rules for ConfigMaps now the only use-case is to override key name in the ConfigMap which automatically populated by Openshift format is the following: {"<configMapName>": {"<keyNameInConfigMap>": "<dstFileNameInContainer>"}}

View Source
var RepoConfigPathMap = map[string]string{
	"ubuntu": "/etc/apt/sources.list.d",
	"rhcos":  "/etc/yum.repos.d",
}

RepoConfigPathMap indicates standard OS specific paths for repository configuration files

Functions

This section is empty.

Types

type CNIPluginsManifestRenderData added in v0.2.0

type CNIPluginsManifestRenderData struct {
	CrSpec       *mellanoxv1alpha1.ImageSpec
	NodeAffinity *v1.NodeAffinity
	RuntimeSpec  *runtimeSpec
}

type Group

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

Group Represents a set of disjoint States that are Synced (Reconciled) together

func NewStateGroup

func NewStateGroup(states []State) Group

NewStateGroup returns a new group of states

func (*Group) Results

func (sg *Group) Results() []Result

Results return []Result of the last SyncGroup() invocation

func (*Group) States

func (sg *Group) States() []State

States returns the States in the State group

func (*Group) Sync

func (sg *Group) Sync(customResource interface{}, infoCatalog InfoCatalog) (results []Result)

SyncGroup sync and update status for a list of states

func (*Group) SyncDone

func (sg *Group) SyncDone() (done bool, err error)

GroupDone returns whether or not all states in the group are ready, error in second arg in case one of the states returned with error

type HostDeviceManifestRenderData added in v0.4.0

type HostDeviceManifestRenderData struct {
	HostDeviceNetworkName string
	CrSpec                mellanoxv1alpha1.HostDeviceNetworkSpec
	RuntimeSpec           *runtimeSpec
	ResourceName          string
}

type IBKubernetesManifestRenderData added in v1.4.0

type IBKubernetesManifestRenderData struct {
	CrSpec                      *mellanoxv1alpha1.IBKubernetesSpec
	PeriodicUpdateSecondsString string
	NodeAffinity                *v1.NodeAffinity
	DeployInitContainer         bool
	RuntimeSpec                 *IBKubernetesSpec
}

type IBKubernetesSpec added in v1.4.0

type IBKubernetesSpec struct {
	OSName string
	// contains filtered or unexported fields
}

type IPoIBCNIRuntimeSpec added in v1.4.0

type IPoIBCNIRuntimeSpec struct {
	OSName string
	// contains filtered or unexported fields
}

type IPoIBManifestRenderData added in v1.3.0

type IPoIBManifestRenderData struct {
	CrSpec       *mellanoxv1alpha1.ImageSpec
	NodeAffinity *v1.NodeAffinity
	RuntimeSpec  *IPoIBCNIRuntimeSpec
}

type InfoCatalog

type InfoCatalog interface {
	// Add an infoSource of InfoType to the catalog
	Add(InfoType, InfoSource)
	// GetNodeInfoProvider returns a reference nodeinfo.Provider from catalog or nil if provider does not exist
	GetNodeInfoProvider() nodeinfo.Provider
}

InfoCatalog is an information catalog to be used to retrieve infoSources. used for State implementation that require additional helping functionality to perfrom the Sync operation. As more States are added, more infoSources may be added to aid them. for any infoSource if not present in the catalog, nil will be returned.

func NewInfoCatalog

func NewInfoCatalog() InfoCatalog

type InfoSource

type InfoSource interface{}

InfoSource represents an object that is a souce of information

type InfoType

type InfoType uint

type Manager

type Manager interface {
	// GetWatchSources gets Resources that should be watched by a Controller for this state manager
	GetWatchSources() []*source.Kind
	// SyncState reconciles the state of the system and returns a list of status of the applied states
	// InfoCatalog is provided to optionally provide a State additional information sources required for it to perform
	// the Sync operation.
	SyncState(customResource interface{}, infoCatalog InfoCatalog) (Results, error)
}

StateManager manages a collection of states and handles transitions from State to State. A state manager invokes states in order to get the system to its desired state

func NewManager

func NewManager(crdKind string, k8sAPIClient client.Client, scheme *runtime.Scheme) (Manager, error)

NewStateManager creates a state.Manager for the given CRD Kind

type MultusManifestRenderData added in v0.2.0

type MultusManifestRenderData struct {
	CrSpec       *mellanoxv1alpha1.MultusSpec
	NodeAffinity *v1.NodeAffinity
	RuntimeSpec  *runtimeSpec
}

type Result

type Result struct {
	StateName string
	Status    SyncState
	// if SyncStateError then ErrInfo will contain additional error information
	ErrInfo error
}

Represent a Result of a single State.Sync() invocation

type Results

type Results struct {
	Status       SyncState
	StatesStatus []Result
}

Represent the Results of a collection of State.Sync() invocations, Status reflects the global status of all states. If all are SyncStateReady then Status is SyncStateReady, if one is SyncStateNotReady, Status is SyncStateNotReady

type State

type State interface {
	// Name provides the State name
	Name() string
	// Description provides the State description
	Description() string
	// Sync attempt to get the system to match the desired state as depicted in the custom resource
	// for the bits related to the specific state, State represents.
	// a sync operation must be relatively short and must not block the execution thread.
	// InfoCatalog is provided to optionally provide a State additional infoSources required for it to perform
	// the Sync operation.
	Sync(customResource interface{}, infoCatalog InfoCatalog) (SyncState, error)
	// Get a map of source kinds that should be watched for the state keyed by the source kind name
	GetWatchSources() map[string]*source.Kind
}

State Represents a single State that requires a set of k8s API operations to be performed. A state is associated with a set of resources, it checks the system state against the given set of resources and reconciles accordingly. It basically reconciles the system to the given state.

func NewStateCNIPlugins added in v0.2.0

func NewStateCNIPlugins(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateCNIPlugins creates a new state for secondary container networking CNI plugins

func NewStateHostDeviceNetwork added in v0.4.0

func NewStateHostDeviceNetwork(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateHostDeviceNetwork creates a new state for HostDeviceNetwork CR

func NewStateIBKubernetes added in v1.4.0

func NewStateIBKubernetes(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateIBKubernetes creates a new ib-kubernetes state

func NewStateIPoIBCNI added in v1.3.0

func NewStateIPoIBCNI(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateIPoIBCNI creates a new state for IPoIB NI

func NewStateIPoIBNetwork added in v1.3.0

func NewStateIPoIBNetwork(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateIPoIBNetwork creates a new state for IPoIBNetwork CR

func NewStateMacvlanNetwork added in v0.2.0

func NewStateMacvlanNetwork(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateMacvlanNetwork creates a new state for MacvlanNetwork CR

func NewStateMultusCNI added in v0.2.0

func NewStateMultusCNI(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateMultusCNI creates a new state for Multus

func NewStateNVPeer

func NewStateNVPeer(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateNVPeer creates a new NVPeer driver state

func NewStateOFED

func NewStateOFED(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateOFED creates a new OFED driver state

func NewStatePodSecurityPolicy added in v1.1.0

func NewStatePodSecurityPolicy(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStatePodSecurityPolicy creates a new pod security policy state

func NewStateSharedDp

func NewStateSharedDp(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateSharedDp creates a new shared device plugin state

func NewStateSriovDp added in v0.4.0

func NewStateSriovDp(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateSriovDp creates a new shared device plugin state

func NewStateWhereaboutsCNI added in v0.2.0

func NewStateWhereaboutsCNI(k8sAPIClient client.Client, scheme *runtime.Scheme, manifestDir string) (State, error)

NewStateWhereaboutsCNI creates a new state for Whereabouts

type SyncState

type SyncState string

type WhereaboutsManifestRenderData added in v0.2.0

type WhereaboutsManifestRenderData struct {
	CrSpec       *mellanoxv1alpha1.ImageSpec
	NodeAffinity *v1.NodeAffinity
	RuntimeSpec  *runtimeSpec
}

Jump to

Keyboard shortcuts

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