Documentation ¶
Index ¶
- Constants
- func ClearJobId(object client.Object)
- func CreateOrUpdateK8sCR(ctx context.Context, c client.Client, newObject client.Object, ...) (err error)
- 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 FindNodeInList(nodelist hwmgmtv1alpha1.NodeList, hwMgrId, nodeId string) string
- 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 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 GetHardwareManagerValidationCondition(hwmgr *pluginv1alpha1.HardwareManager) *metav1.Condition
- func GetJobId(object client.Object) string
- func GetNode(ctx context.Context, logger *slog.Logger, c client.Client, ...) (*hwmgmtv1alpha1.Node, 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 GetTransportWithCaBundle(config OAuthClientConfig, insecureSkipTLSVerify, logMessages bool) (http.RoundTripper, 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 NodepoolAddFinalizer(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- func NodepoolRemoveFinalizer(ctx context.Context, c client.Client, nodepool *hwmgmtv1alpha1.NodePool) error
- 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 SetJobId(object client.Object, jobId string)
- 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"
)
Variables ¶
This section is empty.
Functions ¶
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 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 FindNodeInList ¶
func FindNodeInList(nodelist hwmgmtv1alpha1.NodeList, hwMgrId, nodeId string) string
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 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 GetHardwareManagerValidationCondition ¶
func GetHardwareManagerValidationCondition(hwmgr *pluginv1alpha1.HardwareManager) *metav1.Condition
func GetNode ¶
func GetNode( ctx context.Context, logger *slog.Logger, c client.Client, namespace, nodename string) (*hwmgmtv1alpha1.Node, error)
GetNode get a node resource for a provided name
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 GetTransportWithCaBundle ¶
func GetTransportWithCaBundle(config OAuthClientConfig, insecureSkipTLSVerify, logMessages bool) (http.RoundTripper, error)
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 NodepoolAddFinalizer ¶
func NodepoolRemoveFinalizer ¶
func RequeueImmediately ¶
func RequeueWithLongInterval ¶
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.