Documentation
¶
Index ¶
- Constants
- func ClearDeletionJobId(object client.Object)
- func ClearJobId(object client.Object)
- func CreateOrUpdateK8sCR(ctx context.Context, c client.Client, newObject client.Object, ...) (err error)
- func DeriveNodePoolStatusFromNodes(ctx context.Context, reader client.Reader, logger *slog.Logger, ...) (metav1.ConditionStatus, string, string)
- func DoNotRequeue() ctrl.Result
- func DoesK8SResourceExist(ctx context.Context, c client.Client, name, namespace string, ...) (resourceExists bool, err error)
- func ExtractDataFromConfigMap[T any](cm *corev1.ConfigMap, expectedKey string) (T, error)
- func FindNextNodeToUpdate(nodelist *hwmgmtv1alpha1.NodeList, groupname, newHwProfile string) *hwmgmtv1alpha1.Node
- func FindNodeConfigInProgress(nodelist *hwmgmtv1alpha1.NodeList) *hwmgmtv1alpha1.Node
- func FindNodeInList(nodelist hwmgmtv1alpha1.NodeList, hwMgrId, nodeId string) string
- func FindNodeInProgress(nodelist *hwmgmtv1alpha1.NodeList) *hwmgmtv1alpha1.Node
- func FindNodeUpdateInProgress(nodelist *hwmgmtv1alpha1.NodeList) *hwmgmtv1alpha1.Node
- func GenerateNodeName() string
- func GetAdaptorIdFromHwMgrId(hwMgrId string) string
- func GetChildNodes(ctx context.Context, logger *slog.Logger, c client.Client, ...) (*hwmgmtv1alpha1.NodeList, error)
- func GetConfigAnnotation(object client.Object) string
- func GetConfigMapField(cm *corev1.ConfigMap, fieldName string) (string, error)
- func GetConfigmap(ctx context.Context, c client.Client, name, namespace string) (*corev1.ConfigMap, error)
- func GetDefaultBackendTransport(insecureSkipTLSVerify bool) (http.RoundTripper, error)
- func GetDefaultTLSConfig(config *tls.Config, insecureSkipTLSVerify bool) (*tls.Config, error)
- func GetDeletionJobId(object client.Object) string
- func GetHardwareManagerValidationCondition(hwmgr *pluginv1alpha1.HardwareManager) *metav1.Condition
- func GetJobId(object client.Object) string
- func GetNode(ctx context.Context, logger *slog.Logger, client client.Reader, ...) (*hwmgmtv1alpha1.Node, error)
- func GetNodePool(ctx context.Context, client client.Reader, key client.ObjectKey, ...) error
- func GetNodePoolProvisionedCondition(nodepool *hwmgmtv1alpha1.NodePool) *metav1.Condition
- func GetResourceTypeId(nodepool *hwmgmtv1alpha1.NodePool) string
- func GetSecret(ctx context.Context, c client.Client, name, namespace string) (*corev1.Secret, error)
- func GetSecretField(secret *corev1.Secret, fieldName string) (string, error)
- func GetServerTLSConfig(ctx context.Context, certFile, keyFile string) (*tls.Config, error)
- func GetTransportWithCaBundle(config OAuthClientConfig, insecureSkipTLSVerify, logMessages bool) (http.RoundTripper, error)
- func InitNodepoolUtils(scheme *runtime.Scheme) error
- func IsHardwareManagerLogMessagesEnabled(hwmgr *pluginv1alpha1.HardwareManager) bool
- func IsHardwareManagerValidationCompleted(hwmgr *pluginv1alpha1.HardwareManager) bool
- func IsHardwareManagerValidationFailed(hwmgr *pluginv1alpha1.HardwareManager) bool
- func IsNodePoolProvisionedCompleted(nodepool *hwmgmtv1alpha1.NodePool) bool
- func IsNodePoolProvisionedFailed(nodepool *hwmgmtv1alpha1.NodePool) bool
- func IsValidURL(u string) bool
- func NodepoolAddFinalizer(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- func NodepoolRemoveFinalizer(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- func RemoveConfigAnnotation(object client.Object)
- func RequeueImmediately() ctrl.Result
- func RequeueWithCustomInterval(interval time.Duration) ctrl.Result
- func RequeueWithLongInterval() ctrl.Result
- func RequeueWithMediumInterval() ctrl.Result
- func RequeueWithShortInterval() ctrl.Result
- func RetryOnConflictOrRetriable(backoff wait.Backoff, fn func() error) error
- func RetryOnConflictOrRetriableOrNotFound(backoff wait.Backoff, fn func() error) error
- func SetConfigAnnotation(object client.Object, reason string)
- func SetDeletionJobId(object client.Object, jobId string)
- func SetJobId(object client.Object, jobId string)
- func SetNodeConditionStatus(ctx context.Context, c client.Client, nodename, namespace string, ...) error
- func SetStatusCondition(existingConditions *[]metav1.Condition, conditionType, conditionReason string, ...)
- func SetupOAuthClient(ctx context.Context, config OAuthClientConfig, ...) (*http.Client, error)
- func UpdateHardwareManagerStatusCondition(ctx context.Context, c client.Client, hwmgr *pluginv1alpha1.HardwareManager, ...) error
- func UpdateK8sCRStatus(ctx context.Context, c client.Client, object client.Object) error
- func UpdateNodePoolPluginStatus(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- func UpdateNodePoolProperties(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- func UpdateNodePoolSelectedPools(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- func UpdateNodePoolStatusCondition(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool, ...) error
- type LoggingRoundTripper
- type OAuthClientConfig
Constants ¶
const ( LogMessagesAnnotation = "hwmgr-plugin.oran.openshift.io/logMessages" LogMessagesEnabled = "enabled" )
const ( HwMgrNodeId = "hwmgrNodeId" NodeSpecNodePoolKey = "spec.nodePool" )
const ( NodepoolFinalizer = "oran-hwmgr-plugin/nodepool-finalizer" ResourceTypeIdKey = "resourceTypeId" )
const ( UPDATE = "Update" PATCH = "Patch" )
Resource operations
const ( JobIdAnnotation = "hwmgr-plugin.oran.openshift.io/jobId" DeletionJobIdAnnotation = "hwmgr-plugin.oran.openshift.io/deletionJobId" ConfigAnnotation = "hwmgr-plugin.oran.openshift.io/config-in-progress" )
Variables ¶
This section is empty.
Functions ¶
func ClearDeletionJobId ¶
func ClearJobId ¶
func CreateOrUpdateK8sCR ¶
func CreateOrUpdateK8sCR(ctx context.Context, c client.Client, newObject client.Object, ownerObject client.Object, operation string) (err error)
CreateOrUpdateK8sCR creates/updates/patches an object.
func DeriveNodePoolStatusFromNodes ¶
func DeriveNodePoolStatusFromNodes( ctx context.Context, reader client.Reader, logger *slog.Logger, nodelist *hwmgmtv1alpha1.NodeList, ) (metav1.ConditionStatus, string, string)
DeriveNodePoolStatusFromNodes evaluates all child nodes and returns an appropriate NodePool Configured condition status and reason.
func DoNotRequeue ¶
func DoesK8SResourceExist ¶
func FindNextNodeToUpdate ¶
func FindNextNodeToUpdate(nodelist *hwmgmtv1alpha1.NodeList, groupname, newHwProfile string) *hwmgmtv1alpha1.Node
FindNextNodeToUpdate scans the nodelist to find the first node with stale HwProfile
func FindNodeConfigInProgress ¶
func FindNodeConfigInProgress(nodelist *hwmgmtv1alpha1.NodeList) *hwmgmtv1alpha1.Node
FindNodeConfigInProgress scans the nodelist to find the first node with config-in-progress annotation
func FindNodeInList ¶
func FindNodeInList(nodelist hwmgmtv1alpha1.NodeList, hwMgrId, nodeId string) string
func FindNodeInProgress ¶
func FindNodeInProgress(nodelist *hwmgmtv1alpha1.NodeList) *hwmgmtv1alpha1.Node
FindNodeInProgress scans the nodelist to find the first node in InProgress
func FindNodeUpdateInProgress ¶
func FindNodeUpdateInProgress(nodelist *hwmgmtv1alpha1.NodeList) *hwmgmtv1alpha1.Node
FindNodeUpdateInProgress scans the nodelist to find the first node with jobId annotation
func GetAdaptorIdFromHwMgrId ¶
func GetChildNodes ¶
func GetChildNodes( ctx context.Context, logger *slog.Logger, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) (*hwmgmtv1alpha1.NodeList, error)
GetChildNodes gets a list of nodes allocated to a NodePool
func GetConfigAnnotation ¶
func GetConfigMapField ¶
GetConfigMapField attempts to retrieve the value of the field using the provided field name
func GetConfigmap ¶
func GetDefaultBackendTransport ¶
func GetDefaultBackendTransport(insecureSkipTLSVerify bool) (http.RoundTripper, error)
GetDefaultBackendTransport returns an HTTP transport with the proper TLS defaults set.
func GetDefaultTLSConfig ¶
GetDefaultTLSConfig sets the TLS configuration attributes appropriately to enable communication between internal services and accessing the public facing API endpoints.
func GetDeletionJobId ¶
func GetHardwareManagerValidationCondition ¶
func GetHardwareManagerValidationCondition(hwmgr *pluginv1alpha1.HardwareManager) *metav1.Condition
func GetNode ¶
func GetNode( ctx context.Context, logger *slog.Logger, client client.Reader, namespace, nodename string) (*hwmgmtv1alpha1.Node, error)
GetNode get a node resource for a provided name
func GetNodePool ¶
func GetNodePoolProvisionedCondition ¶
func GetNodePoolProvisionedCondition(nodepool *hwmgmtv1alpha1.NodePool) *metav1.Condition
func GetResourceTypeId ¶
func GetResourceTypeId(nodepool *hwmgmtv1alpha1.NodePool) string
func GetSecret ¶
func GetSecret(ctx context.Context, c client.Client, name, namespace string) (*corev1.Secret, error)
GetSecret attempts to retrieve a Secret object for the given name
func GetSecretField ¶
GetSecretField attempts to retrieve the value of the field using the provided field name
func GetServerTLSConfig ¶
GetServerTLSConfig creates a tls.Config that uses a dynamic loader to handle updates to the certificate and/or key.
func GetTransportWithCaBundle ¶
func GetTransportWithCaBundle(config OAuthClientConfig, insecureSkipTLSVerify, logMessages bool) (http.RoundTripper, error)
func InitNodepoolUtils ¶
func IsHardwareManagerLogMessagesEnabled ¶
func IsHardwareManagerLogMessagesEnabled(hwmgr *pluginv1alpha1.HardwareManager) bool
func IsHardwareManagerValidationCompleted ¶
func IsHardwareManagerValidationCompleted(hwmgr *pluginv1alpha1.HardwareManager) bool
func IsHardwareManagerValidationFailed ¶
func IsHardwareManagerValidationFailed(hwmgr *pluginv1alpha1.HardwareManager) bool
func IsNodePoolProvisionedCompleted ¶
func IsNodePoolProvisionedCompleted(nodepool *hwmgmtv1alpha1.NodePool) bool
func IsNodePoolProvisionedFailed ¶
func IsNodePoolProvisionedFailed(nodepool *hwmgmtv1alpha1.NodePool) bool
func IsValidURL ¶
func NodepoolAddFinalizer ¶
func NodepoolRemoveFinalizer ¶
func RemoveConfigAnnotation ¶
func RequeueImmediately ¶
func RequeueWithLongInterval ¶
func SetConfigAnnotation ¶
func SetDeletionJobId ¶
func SetNodeConditionStatus ¶
func SetNodeConditionStatus( ctx context.Context, c client.Client, nodename, namespace string, conditionType string, conditionStatus metav1.ConditionStatus, reason, message string, ) error
SetNodeConditionStatus sets a condition on the node status with the provided condition type
func SetStatusCondition ¶
func SetStatusCondition(existingConditions *[]metav1.Condition, conditionType, conditionReason string, conditionStatus metav1.ConditionStatus, message string)
SetStatusCondition is a convenience wrapper for meta.SetStatusCondition that takes in the types defined here and converts them to strings
func SetupOAuthClient ¶
func SetupOAuthClient(ctx context.Context, config OAuthClientConfig, insecureSkipTLSVerify, logMessages bool) (*http.Client, error)
SetupOAuthClient creates an HTTP client capable of acquiring an OAuth token used to authorize client requests. If the config excludes the OAuth specific sections then the client produced is a simple HTTP client without OAuth capabilities.
func UpdateHardwareManagerStatusCondition ¶
func UpdateHardwareManagerStatusCondition( ctx context.Context, c client.Client, hwmgr *pluginv1alpha1.HardwareManager, conditionType pluginv1alpha1.ConditionType, conditionReason pluginv1alpha1.ConditionReason, conditionStatus metav1.ConditionStatus, message string) error
func UpdateK8sCRStatus ¶
func UpdateNodePoolStatusCondition ¶
func UpdateNodePoolStatusCondition( ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool, conditionType hwmgmtv1alpha1.ConditionType, conditionReason hwmgmtv1alpha1.ConditionReason, conditionStatus metav1.ConditionStatus, message string) error
Types ¶
type LoggingRoundTripper ¶
TODO: Determine whether to remove the message tracing altogether. Currently this writes debug logs, but the level is hardcoded. Seeing these debug logs requires setting the loglevel of the utilsLog logger, so this needs some work here.
type OAuthClientConfig ¶
type OAuthClientConfig struct {
// Defines a PEM encoded set of CA certificates used to validate server certificates. If not provided then the
// default root CA bundle will be used.
CaBundle []byte
// Defines the OAuth client-id attribute to be used when acquiring a token. If not provided (for debug/testing)
// then a normal HTTP client without OAuth capabilities will be created
ClientId string
ClientSecret string
// The absolute URL of the API endpoint to be used to acquire a token
// (e.g., http://example.com/realms/oran/protocol/openid-connect/token)
TokenUrl string
// The list of OAuth scopes requested by the client. These will be dictated by what the SMO is expecting to see in
// the token.
Scopes []string
// The grant type.
GrantType pluginv1alpha1.OAuthGrantType
// Username, for Password grant type
Username string
// Password, for Password grant type
Password string
}
OAuthClientConfig defines the parameters required to establish an HTTP Client capable of acquiring an OAuth Token from an OAuth capable authorization server.