state

package
v1.8.3-0...-69ba9c3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AppComponentLabelKey indicates the label key of the component
	AppComponentLabelKey = "app.kubernetes.io/component"
	// AppComponentLabelValue indicates the label values of the nvidia-gpu-driver component
	AppComponentLabelValue = "nvidia-driver"
)
View Source
const (
	InfoTypeClusterInfo = iota
	InfoTypeClusterPolicyCR
)
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

Variables

View Source
var CertConfigPathMap = map[string]string{
	"centos":   "/etc/pki/ca-trust/extracted/pem",
	"debian":   "/usr/local/share/ca-certificates",
	"ubuntu":   "/usr/local/share/ca-certificates",
	"rhcos":    "/etc/pki/ca-trust/extracted/pem",
	"rhel":     "/etc/pki/ca-trust/extracted/pem",
	"rocky":    "/etc/pki/ca-trust/extracted/pem",
	"sles":     "/etc/pki/trust/anchors",
	"sl-micro": "/etc/pki/trust/anchors",
}

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 RepoConfigPathMap = map[string]string{
	"centos":   "/etc/yum.repos.d",
	"debian":   "/etc/apt/sources.list.d",
	"ubuntu":   "/etc/apt/sources.list.d",
	"rhcos":    "/etc/yum.repos.d",
	"rhel":     "/etc/yum.repos.d",
	"rocky":    "/etc/yum.repos.d",
	"sles":     "/etc/zypp/repos.d",
	"sl-micro": "/etc/zypp/repos.d",
}

RepoConfigPathMap indicates standard OS specific paths for repository configuration files

View Source
var SubscriptionPathMap = map[string]MountPathToVolumeSource{
	"rhel": {
		"/run/secrets/etc-pki-entitlement": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/pki/entitlement",
				Type: ptr.To(corev1.HostPathDirectory),
			},
		},
		"/run/secrets/redhat.repo": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/yum.repos.d/redhat.repo",
				Type: ptr.To(corev1.HostPathFile),
			},
		},
		"/run/secrets/rhsm": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/rhsm",
				Type: ptr.To(corev1.HostPathDirectory),
			},
		},
	},
	"rhcos": {
		"/run/secrets/etc-pki-entitlement": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/pki/entitlement",
				Type: ptr.To(corev1.HostPathDirectory),
			},
		},
		"/run/secrets/redhat.repo": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/yum.repos.d/redhat.repo",
				Type: ptr.To(corev1.HostPathFile),
			},
		},
		"/run/secrets/rhsm": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/rhsm",
				Type: ptr.To(corev1.HostPathDirectory),
			},
		},
	},
	"sles": {
		"/etc/zypp/credentials.d": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/zypp/credentials.d",
				Type: ptr.To(corev1.HostPathDirectory),
			},
		},
		"/etc/SUSEConnect": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/SUSEConnect",
				Type: ptr.To(corev1.HostPathFileOrCreate),
			},
		},
	},
	"sl-micro": {
		"/etc/zypp/credentials.d": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/zypp/credentials.d",
				Type: ptr.To(corev1.HostPathDirectory),
			},
		},
		"/etc/SUSEConnect": corev1.VolumeSource{
			HostPath: &corev1.HostPathVolumeSource{
				Path: "/etc/SUSEConnect",
				Type: ptr.To(corev1.HostPathFileOrCreate),
			},
		},
	},
}

SubscriptionPathMap contains information on OS-specific paths that provide entitlements/subscription details on the host. These are used to enable Driver Container's access to packages controlled by the distro through their subscription and support program.

Functions

This section is empty.

Types

type InfoCatalog

type InfoCatalog interface {
	// Add an infoSource of InfoType to the catalog
	Add(InfoType, InfoSource)
	// Get an InfoSource of InfoType
	Get(InfoType) InfoSource
}

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(ctrlManager) []SyncingSource
	SyncState(ctx context.Context, customResource interface{}, infoCatalog InfoCatalog) Results
}

func NewManager

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

type MountPathToVolumeSource

type MountPathToVolumeSource map[string]corev1.VolumeSource

MountPathToVolumeSource maps a container mount path to a VolumeSource

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() string
	Description() string
	Sync(ctx context.Context, customResource interface{}, infoCatalog InfoCatalog) (SyncState, error)
	GetWatchSources(ctrlManager) map[string]SyncingSource
}

func NewStateDriver

func NewStateDriver(
	k8sClient client.Client,
	namespace string,
	scheme *runtime.Scheme,
	manifestDir string) (State, error)

type SyncState

type SyncState string

type SyncingSource

type SyncingSource source.SyncingSource

Jump to

Keyboard shortcuts

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