Documentation
¶
Index ¶
- Constants
- Variables
- func AddCABundle(config *tls.Config, caBundle string) error
- func AddObjectContext(ctx context.Context, obj client.Object) context.Context
- func AssignMacAddress(clusterInput map[string]any, hwInterfaces []*pluginsv1alpha1.Interface, ...) error
- func BuildTestClusterInstanceCRD(clusterInstanceSpecStr string) (*unstructured.Unstructured, error)
- func ClearPRCallbackAnnotationsWithPatch(ctx context.Context, c client.Client, object client.Object) error
- func ClearPRCallbackReceivedAnnotation(object client.Object)
- func ClusterIsReadyForPolicyConfig(ctx context.Context, c client.Client, clusterInstanceName string) (bool, error)
- func ConvertFromUnstructured(u *unstructured.Unstructured) (*siteconfig.ClusterInstance, error)
- func ConvertMapAnyToString(input map[string]any) map[string]string
- func ConvertToUnstructured(ci siteconfig.ClusterInstance) (*unstructured.Unstructured, error)
- func CopyBMCSecrets(ctx context.Context, c client.Client, hwNodes map[string][]NodeInfo, ...) error
- func CopyK8sSecret(ctx context.Context, c client.Client, ...) error
- func CopyPullSecret(ctx context.Context, c client.Client, ownerObject client.Object, ...) error
- func CreateConfigMapFromEmbeddedFile(ctx context.Context, c client.Client, ownerObject client.Object, fs embed.FS, ...) error
- func CreateDefaultInventoryCR(ctx context.Context, c client.Client) error
- func CreateHwMgrPluginNamespace(ctx context.Context, c client.Client, name string) error
- func CreateK8sCR(ctx context.Context, c client.Client, newObject client.Object, ...) (err error)
- func CreateSecretFromLiterals(ctx context.Context, c client.Client, ownerObject client.Object, ...) error
- func DeepMergeMaps[K comparable, V any](dst, src map[K]V, checkType bool) error
- func DeepMergeSlices[K comparable, V any](dst, src []V, checkType bool) ([]V, error)
- func DetermineAuthType(callback string) commonapi.AuthType
- func DoesK8SResourceExist(ctx context.Context, c client.Client, name, namespace string, ...) (resourceExists bool, err error)
- func ExtractBeforeDot(s string) string
- func ExtractDataFromConfigMap[T any](cm *corev1.ConfigMap, expectedKey string) (T, error)
- func ExtractPortFromAddress(address string) (int, error)
- func ExtractSchemaRequired(mainSchema []byte) (required []string, err error)
- func ExtractTemplateDataFromConfigMap[T any](cm *corev1.ConfigMap, expectedKey string) (T, error)
- func ExtractTimeoutFromConfigMap(cm *corev1.ConfigMap, key string) (time.Duration, error)
- func GenerateSearchApiUrl(backendURL string) (string, error)
- func GenerateSecretName(nodeMap map[string]interface{}, provisioningRequest string) (string, error)
- func GetBMHNamespace(node *pluginsv1alpha1.AllocatedNode) string
- func GetBackendTokenArg(backendToken string) string
- func GetBareMetalHostForAllocatedNode(ctx context.Context, c client.Client, allocatedNodeID string) *metal3v1alpha1.BareMetalHost
- func GetBareMetalHostFromHostname(ctx context.Context, c client.Client, hostname string) (*metal3v1alpha1.BareMetalHost, error)
- func GetBootMacAddress(interfaces []*pluginsv1alpha1.Interface, bootIfaceLabel string) (string, error)
- func GetClientTLSConfig(ctx context.Context, certFile, keyFile, caFile string) (*tls.Config, error)
- func GetClusterID(ctx context.Context, c client.Client, name string) (string, 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 GetDatabaseHostname() string
- func GetDefaultBackendTransport() (http.RoundTripper, error)
- func GetDefaultTLSConfig(config *tls.Config) (*tls.Config, error)
- func GetDefaultsFromConfigMap(ctx context.Context, c client.Client, configMapName string, ...) (map[string]interface{}, error)
- func GetDefaultsFromMaps[K comparable, V any](mapDefaults map[K]V, mapSchema map[K]V) (map[K]V, map[K]V, error)
- func GetDefaultsFromSlices[K comparable, V any](sliceDefaults []V, mapSchema map[K]V) ([]V, []V, error)
- func GetDeploymentVolumeMounts(serverName string, inventory *inventoryv1alpha1.Inventory) []corev1.VolumeMount
- func GetDeploymentVolumes(serverName string, inventory *inventoryv1alpha1.Inventory) []corev1.Volume
- func GetEnvOrDefault(name, defaultValue string) string
- func GetHardwarePlugin(ctx context.Context, c client.Client, hwPluginName string) (*hwmgmtv1alpha1.HardwarePlugin, error)
- func GetHardwarePluginFromProvisioningRequest(ctx context.Context, c client.Client, ...) (*hwmgmtv1alpha1.HardwarePlugin, error)
- func GetHardwarePluginRefFromProvisioningRequest(ctx context.Context, c client.Client, ...) (string, error)
- func GetHardwareTemplate(ctx context.Context, c client.Client, hwTemplateName string) (*hwmgmtv1alpha1.HardwareTemplate, error)
- func GetHwMgrPluginNS() string
- func GetIBGUFromUpgradeDefaultsConfigmap(ctx context.Context, c client.Client, cmName string, cmNamespace string, ...) (*ibguv1alpha1.ImageBasedGroupUpgrade, error)
- func GetIngressDomain(ctx context.Context, c client.Client) (string, error)
- func GetInternalClientTLSConfig(ctx context.Context) (*tls.Config, error)
- func GetKeyPairFromSecret(ctx context.Context, c client.Client, name, namespace string) ([]byte, []byte, error)
- func GetNarCallbackServiceName() string
- func GetNarCallbackServiceNamespace() string
- func GetParentPolicyNameAndNamespace(childPolicyName string) (policyName, policyNamespace string)
- func GetPasswordOrRandom(envName string) string
- func GetPullSecretName(clusterInstance *unstructured.Unstructured) (string, error)
- func GetSearchAPI(ctx context.Context, c client.Client) (*corev1.Service, error)
- func GetSearchURL(ctx context.Context, c client.Client) (string, error)
- func GetSecret(ctx context.Context, c client.Client, name, namespace string) (*corev1.Secret, error)
- func GetSecretField(secret *corev1.Secret, fieldName string) (string, error)
- func GetServerArgs(inventory *inventoryv1alpha1.Inventory, serverName string) (result []string, err error)
- func GetServerDatabasePasswordName(serverName string) (string, error)
- func GetServerTLSConfig(ctx context.Context, certFile, keyFile string) (*tls.Config, error)
- func GetServiceURL(serverName string) string
- func GetStatusMessage(condition hwmgmtv1alpha1.ConditionType) string
- func GetTLSSkipVerify() bool
- func GetTimeoutFromHWTemplate(ctx context.Context, c client.Client, name string) (time.Duration, error)
- func HandleHardwareTimeout(condition hwmgmtv1alpha1.ConditionType, provisioningStartTime *metav1.Time, ...) (bool, string, string)
- func HasApiEndpoints(serverName string) bool
- func HasDatabase(serverName string) bool
- func HasFatalProvisioningFailure(conditions []metav1.Condition) bool
- func HwMgrPluginNamespaceExists(ctx context.Context, c client.Client, name string) (bool, error)
- func IsClusterConfigCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterProvisionCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterProvisionFailed(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterProvisionInProgress(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterProvisionPresent(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterProvisionTimedOutOrFailed(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterUpgradeCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterUpgradeInProgress(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterUpgradeInitiated(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsClusterZtpDone(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsConditionDoesNotExistsErr(err error) bool
- func IsHardwareConfigCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsInputError(err error) bool
- func IsOAuthEnabled(inventory *inventoryv1alpha1.Inventory) bool
- func IsParentPolicyInZtpClusterTemplateNs(policyNamespace, ctNamespace string) bool
- func IsProvisioningStateFulfilled(cr *provisioningv1alpha1.ProvisioningRequest) bool
- func IsSmoRegistrationCompleted(cr *inventoryv1alpha1.Inventory) bool
- func IsValidURL(u string) bool
- func LogError(ctx context.Context, logger *slog.Logger, msg string, err error, ...)
- func LogOperation(ctx context.Context, logger *slog.Logger, operation, msg string, ...) context.Context
- func LogPhaseComplete(ctx context.Context, logger *slog.Logger, phase string, duration time.Duration)
- func LogPhaseStart(ctx context.Context, logger *slog.Logger, phase string) context.Context
- func LogReconcileStart(ctx context.Context, logger *slog.Logger, req ctrl.Request, ...) context.Context
- func MakeUUIDFromNames(namespace string, cloudID uuid.UUID, names ...string) uuid.UUID
- func MapKeysToSlice(inputMap map[string]bool) []string
- func NeedsOAuthAccess(serverName string) bool
- func RemoveLabelFromInterfaces[T any](data T) error
- func RequiresInternalListener(serverName string) bool
- func RetryOnConflictOrRetriable(backoff wait.Backoff, fn func() error) error
- func RetryOnConflictOrRetriableOrNotFound(backoff wait.Backoff, fn func() error) error
- func SetProvisioningStateDeleting(cr *provisioningv1alpha1.ProvisioningRequest)
- func SetProvisioningStateFailed(cr *provisioningv1alpha1.ProvisioningRequest, message string)
- func SetProvisioningStateFulfilled(cr *provisioningv1alpha1.ProvisioningRequest)
- func SetProvisioningStateInProgress(cr *provisioningv1alpha1.ProvisioningRequest, message string)
- func SetProvisioningStatePending(cr *provisioningv1alpha1.ProvisioningRequest, message string)
- func SetStatusCondition(existingConditions *[]metav1.Condition, ...)
- func SetupOAuthClient(ctx context.Context, logger *slog.Logger, config *OAuthClientConfig) (*http.Client, error)
- func TimeoutExceeded(startTime time.Time, timeout time.Duration) bool
- func UpdateHardwareTemplateStatusCondition(ctx context.Context, c client.Client, ...) error
- func UpdateK8sCRStatus(ctx context.Context, c client.Client, object client.Object) error
- func ValidateConfigmapSchemaAgainstClusterInstanceCRD[T any](ctx context.Context, c client.Client, data T) error
- func ValidateDefaultInterfaces[T any](data T) error
- type AvailableNotification
- type ConditionDoesNotExistsErr
- type InputError
- type InventoryConditionReason
- type InventoryConditionType
- type NarCallbackConfig
- type NodeInfo
- type OAuthClientConfig
- type OAuthConfig
- type StaticKeyPairLoader
- type TLSConfig
Constants ¶
const ( InventoryDatabase = "postgres" InventoryResource = "resource" InventoryAlarms = "alarms" InventoryCluster = "cluster" InventoryArtifacts = "artifacts" InventoryProvisioning = "provisioning" )
Base resource names
const ( InventoryDatabaseServerName = InventoryDatabase + serverSuffix InventoryResourceServerName = InventoryResource + serverSuffix InventoryAlarmServerName = InventoryAlarms + serverSuffix InventoryClusterServerName = InventoryCluster + serverSuffix InventoryArtifactsServerName = InventoryArtifacts + serverSuffix InventoryProvisioningServerName = InventoryProvisioning + serverSuffix )
Deployment names
const ( HardwarePluginManager = "hardwareplugin-manager" HardwarePluginManagerServerName = HardwarePluginManager + serverSuffix )
const ( Metal3Plugin = "metal3-hardwareplugin" Metal3PluginServerName = Metal3Plugin + serverSuffix )
HardwarePlugins
const ( UPDATE = "Update" PATCH = "Patch" )
Resource operations
const ( SearchApiLabelKey = "search-monitor" SearchApiLabelValue = "search-api" )
Search API attributes
const ( DefaultHardwareProvisioningTimeout = 90 * time.Minute DefaultClusterInstallationTimeout = 90 * time.Minute DefaultClusterConfigurationTimeout = 30 * time.Minute )
Default timeout values
const ( HardwareProvisioningTimeoutConfigKey = "hardwareProvisioningTimeout" ClusterInstallationTimeoutConfigKey = "clusterInstallationTimeout" ClusterConfigurationTimeoutConfigKey = "clusterConfigurationTimeout" )
These are optional keys in the respective ConfigMaps defined in ClusterTemplate spec.templates, used to configure the timeout values for each operation. If not specified, the default timeout values will be applied.
const ( TemplateParamNodeClusterName = "nodeClusterName" TemplateParamOCloudSiteId = "oCloudSiteId" TemplateParamClusterInstance = "clusterInstanceParameters" TemplateParamPolicyConfig = "policyTemplateParameters" )
Required template schema parameters
const ( ClusterInstanceTemplateName = "ClusterInstance" ClusterInstanceTemplateDefaultsConfigmapKey = "clusterinstance-defaults" ClusterInstanceCrdName = "clusterinstances" )
ClusterInstance template constants
const ( PolicyTemplateDefaultsConfigmapKey = "policytemplate-defaults" ClusterVersionLabelKey = "cluster-version" )
PolicyTemplate constants
const ( ClusterZtpDone = "ZTP Done" ClusterZtpNotDone = "ZTP Not Done" )
Cluster status
const ( HwTemplatePluginMgr = "hardwarePluginRef" HwTemplateNodeAllocationRequest = "node-group-data" HwTemplateBootIfaceLabel = "bootInterfaceLabel" HwTemplateExtensions = "extensions" )
Hardeware template constants
const ( OperationTypeCreated = "created" OperationTypeUpdated = "updated" OperationTypeDryRun = "validated with dry-run" )
const ( TLSSkipVerifyEnvName = "INSECURE_SKIP_VERIFY" TLSSkipVerifyDefaultValue = false )
Environment variable names
const ( ChildPolicyRootPolicyLabel = "policy.open-cluster-management.io/root-policy" ChildPolicyClusterNameLabel = "policy.open-cluster-management.io/cluster-name" ChildPolicyClusterNamespaceLabel = "policy.open-cluster-management.io/cluster-namespace" )
Label specific to ACM child policies.
const ( UnitTestHwPluginRef = "hwmgr" UnitTestHwmgrNamespace = "hwmgr" DefaultPluginNamespace = constants.DefaultNamespace )
Hardware Manager plugin constants
const ( DefaultServiceTargetPort = "https" DatabaseTargetPort = "database" )
POD Port Values
const ( AdminPasswordEnvName = "POSTGRESQL_ADMIN_PASSWORD" // nolint: gosec AlarmsPasswordEnvName = "ORAN_O2IMS_ALARMS_PASSWORD" // nolint: gosec ResourcesPasswordEnvName = "ORAN_O2IMS_RESOURCES_PASSWORD" // nolint: gosec ClustersPasswordEnvName = "ORAN_O2IMS_CLUSTERS_PASSWORD" // nolint: gosec DatabaseHostnameEnvVar = "POSTGRES_HOSTNAME" )
Postgres values
const ( ClusterModelExtension = "model" ClusterVersionExtension = "version" ClusterVendorExtension = "vendor" ClusterAlarmDictionaryIDExtension = "alarmDictionaryID" ClusterModelHubCluster = "hub-cluster" ClusterModelManagedCluster = "managed-cluster" OpenshiftVersionLabelName = "openshiftVersion" ClusterIDLabelName = "clusterID" LocalClusterLabelName = "local-cluster" ClusterTemplateArtifactsLabel = "clustertemplates.clcm.openshift.io/templateId" HardwarePluginRefLabel = "clcm.openshift.io/hardwarePluginRef" HardwareManagerNodeIdLabel = "clcm.openshift.io/hwMgrNodeId" )
NodeCluster/ClusterResource extensions
const ( AlertmanagerObjectName = "alertmanager" OpenClusterManagementObservabilityNamespace = "open-cluster-management-observability" AlertmanagerSA = "alertmanager" )
Alertmanager values
const ( OAuthClientIDEnvName = "SMO_OAUTH_CLIENT_ID" OAuthClientSecretEnvName = "SMO_OAUTH_CLIENT_SECRET" // nolint: gosec )
SMO OAuth specific environment variables. These values are stored in environment variables to avoid them being visible in the command line arguments.
const ( OAuthClientIDField = "client-id" OAuthClientSecretField = "client-secret" )
OAuth Secret fields
const ( CallbackReceivedAnnotation = "callback.received" CallbackStatusAnnotation = "callback.status" CallbackNodeAllocationRequestIdAnnotation = "callback.nodeAllocationRequestId" )
Callback annotation keys used by both the NAR callback server and provisioning request controller
const ( LogAttrResource = "resource" LogAttrNamespace = "namespace" LogAttrResourceVersion = "resourceVersion" LogAttrGeneration = "generation" LogAttrError = "error" LogAttrDuration = "duration" LogAttrPhase = "phase" LogAttrAction = "action" LogAttrOperation = "operation" )
Standard logging attribute names
const AlarmDefinitionSeverityField = "severity"
AlarmDefinitionSeverityField severity field within additional fields of alarm definition
const AllocatedNodeLabel = "clcm.openshift.io/allocated-node"
const ClusterInstanceParamsSubSchemaForNoHWTemplate = `` /* 871-byte string literal not displayed */
ClusterInstanceParamsSubSchemaForNoHWTemplate is the expected subschema for the ClusterInstanceParams when no hardware template is provided.
const ClusterVersionName = "version"
ClusterVersionName is the name given to the default ClusterVersion object
const HardwarePluginValidationEndpoint = "/hardware-manager/provisioning/api_versions"
HardwarePluginValidationEndpoint is the endpoint that the HardwarePlugin manager will try to reach for the plugin being registered.
const (
HwMgrPluginNameSpace = "HWMGR_PLUGIN_NAMESPACE"
)
Environment values
const IngressClassName = "openshift-default"
IngressClassName defines the ingress controller class to be used
const IngressName = "oran-o2ims-ingress"
IngressName defines the name of our ingress controller
const IngressPortName = "api"
IngressPortName defines the name of service port to which our ingress controller directs traffic to
const (
InventoryNamespace = constants.DefaultNamespace
)
Default namespace
const (
PropertiesString = "properties"
)
const ( // ProvisioningRequestFieldManager is the unique identifier for the ProvisioningRequest controller // when performing Server-Side Apply operations. This name is used by the Kubernetes API server // to track field ownership for SSA. ProvisioningRequestFieldManager = "provisioning-request-reconciler" )
Field Manager Names for Server-Side Apply
const ( // SkipClusterImageSetValidationAnnotation when set to "true" (case-insensitive), // skips the validation that ensures the ClusterImageSet referenced in the // ClusterInstanceDefaults matches the release version specified in the ClusterTemplate. // This is useful in scenarios where the ClusterImageSet validation needs to be bypassed, // such as during testing or when using custom image sets that don't follow standard naming. SkipClusterImageSetValidationAnnotation = "clcm.openshift.io/skip-clusterimageset-validation" )
ClusterTemplate annotation keys
const TestClusterInstancePropertiesRequiredRemoval = `` /* 847-byte string literal not displayed */
const TestClusterInstanceSpecNoVersions = `` /* 478-byte string literal not displayed */
const TestClusterInstanceSpecOk = `` /* 2431-byte string literal not displayed */
const TestClusterInstanceSpecServedFalse = `
group: siteconfig.open-cluster-management.io
scope: Namespaced
versions:
- name: v1alpha1
served: false
storage: true
`
const (
UpgradeDefaultsConfigmapKey = "ibgu"
)
Upgrade constants
const ValidationMessage = "Validating and preparing resources"
Status message constants
Variables ¶
var ( AlarmServerArgs = []string{ constants.AlarmsServerCmd, constants.ServeSubcommand, fmt.Sprintf("--api-listener-address=0.0.0.0:%d", constants.DefaultContainerPort), fmt.Sprintf("--tls-server-cert=%s/%s", constants.TLSServerMountPath, constants.TLSCertField), fmt.Sprintf("--tls-server-key=%s/%s", constants.TLSServerMountPath, constants.TLSKeyField), } ArtifactsServerArgs = []string{ constants.ArtifactsServerCmd, constants.ServeSubcommand, fmt.Sprintf("--api-listener-address=0.0.0.0:%d", constants.DefaultContainerPort), fmt.Sprintf("--tls-server-cert=%s/%s", constants.TLSServerMountPath, constants.TLSCertField), fmt.Sprintf("--tls-server-key=%s/%s", constants.TLSServerMountPath, constants.TLSKeyField), } ResourceServerArgs = []string{ constants.ResourceServerCmd, constants.ServeSubcommand, fmt.Sprintf("--api-listener-address=0.0.0.0:%d", constants.DefaultContainerPort), fmt.Sprintf("--tls-server-cert=%s/%s", constants.TLSServerMountPath, constants.TLSCertField), fmt.Sprintf("--tls-server-key=%s/%s", constants.TLSServerMountPath, constants.TLSKeyField), } ClusterServerArgs = []string{ constants.ClusterServerCmd, constants.ServeSubcommand, fmt.Sprintf("--api-listener-address=0.0.0.0:%d", constants.DefaultContainerPort), fmt.Sprintf("--tls-server-cert=%s/%s", constants.TLSServerMountPath, constants.TLSCertField), fmt.Sprintf("--tls-server-key=%s/%s", constants.TLSServerMountPath, constants.TLSKeyField), } ProvisioningServerArgs = []string{ constants.ProvisioningServerCmd, constants.ServeSubcommand, fmt.Sprintf("--api-listener-address=0.0.0.0:%d", constants.DefaultContainerPort), fmt.Sprintf("--tls-server-cert=%s/%s", constants.TLSServerMountPath, constants.TLSCertField), fmt.Sprintf("--tls-server-key=%s/%s", constants.TLSServerMountPath, constants.TLSKeyField), } HardwarePluginManagerArgs = []string{ constants.HardwarePluginManagerCmd, constants.StartSubcommand, constants.HealthProbeFlag + "=" + constants.HealthProbePort, constants.MetricsFlag + "=" + constants.MetricsPort, fmt.Sprintf("--metrics-tls-cert-dir=%s", constants.TLSServerMountPath), constants.LeaderElectFlag, } Metal3PluginServerArgs = []string{ constants.Metal3HardwarePluginManagerCmd, constants.StartSubcommand, constants.HealthProbeFlag + "=" + constants.HealthProbePort, constants.MetricsFlag + "=" + constants.MetricsPort, fmt.Sprintf("--metrics-tls-cert-dir=%s", constants.TLSServerMountPath), constants.LeaderElectFlag, fmt.Sprintf("--api-listener-address=0.0.0.0:%d", constants.DefaultContainerPort), fmt.Sprintf("--tls-server-cert=%s/%s", constants.TLSServerMountPath, constants.TLSCertField), fmt.Sprintf("--tls-server-key=%s/%s", constants.TLSServerMountPath, constants.TLSKeyField), } )
Container arguments
var ( // AllowedClusterInstanceFields contains path patterns for fields that are allowed to be updated. // The wildcard "*" is used to match any index in a list. AllowedClusterInstanceFields = [][]string{ {"extraAnnotations"}, {"extraLabels"}, {"nodes", "*", "extraAnnotations"}, {"nodes", "*", "extraLabels"}, } // IgnoredClusterInstanceFields contains path patterns for fields that should be ignored. // The wildcard "*" is used to match any index in a list. IgnoredClusterInstanceFields = [][]string{ {"nodes", "*", "bmcAddress"}, {"nodes", "*", "bmcCredentialsName"}, {"nodes", "*", "bootMACAddress"}, {"nodes", "*", "hostRef"}, {"nodes", "*", "nodeNetwork", "interfaces", "*", "macAddress"}, {"nodes", "*", "nodeNetwork", "interfaces", "*", "label"}, {"suppressedManifests"}, } )
var (
CRDsToBeSuppressedForUpgrade = []string{
"AgentClusterInstall",
}
)
CRDs needed to be suppressed in ClusterInstance for upgrade
var InventoryConditionReasons = struct { DeploymentsReady InventoryConditionReason ErrorGettingDeploymentInformation InventoryConditionReason DatabaseDeploymentFailed InventoryConditionReason DeploymentNotFound InventoryConditionReason ServerArgumentsError InventoryConditionReason SmoRegistrationSuccessful InventoryConditionReason SmoRegistrationFailed InventoryConditionReason SmoNotConfigured InventoryConditionReason OAuthClientIDNotConfigured InventoryConditionReason }{ DatabaseDeploymentFailed: "DatabaseDeploymentFailed", DeploymentsReady: "AllDeploymentsReady", ErrorGettingDeploymentInformation: "ErrorGettingDeploymentInformation", DeploymentNotFound: "DeploymentNotFound", ServerArgumentsError: "ServerArgumentsError", SmoRegistrationSuccessful: "SmoRegistrationSuccessful", SmoRegistrationFailed: "SmoRegistrationFailed", SmoNotConfigured: "SmoNotConfigured", OAuthClientIDNotConfigured: "OAuthClientIDNotConfigured", }
var InventoryConditionTypes = struct { Ready InventoryConditionType NotReady InventoryConditionType Error InventoryConditionType Available InventoryConditionType SmoRegistrationCompleted InventoryConditionType AlarmServerError InventoryConditionType ArtifactsServerError InventoryConditionType ClusterServerError InventoryConditionType DatabaseServerError InventoryConditionType ResourceServerError InventoryConditionType ProvisioningServerError InventoryConditionType AlarmServerAvailable InventoryConditionType ArtifactsServerAvailable InventoryConditionType ClusterServerAvailable InventoryConditionType DatabaseServerAvailable InventoryConditionType ResourceServerAvailable InventoryConditionType ProvisioningServerAvailable InventoryConditionType }{ Ready: "InventoryReady", NotReady: "InventoryConditionType", Error: "Error", Available: "Available", SmoRegistrationCompleted: "SmoRegistrationCompleted", AlarmServerError: "AlarmServerError", ArtifactsServerError: "ArtifactsServerError", ClusterServerError: "ClusterServerError", DatabaseServerError: "DatabaseServerError", ResourceServerError: "ResourceServerError", ProvisioningServerError: "ProvisioningServerError", AlarmServerAvailable: "AlarmServerAvailable", ArtifactsServerAvailable: "ArtifactsServerAvailable", ClusterServerAvailable: "ClusterServerAvailable", DatabaseServerAvailable: "DatabaseServerAvailable", ResourceServerAvailable: "ResourceServerAvailable", ProvisioningServerAvailable: "ProvisioningServerAvailable", }
var MapAvailableDeploymentNameConditionType = map[string]InventoryConditionType{ InventoryAlarmServerName: InventoryConditionTypes.AlarmServerAvailable, InventoryArtifactsServerName: InventoryConditionTypes.ArtifactsServerAvailable, InventoryClusterServerName: InventoryConditionTypes.ClusterServerAvailable, InventoryDatabaseServerName: InventoryConditionTypes.DatabaseServerAvailable, InventoryResourceServerName: InventoryConditionTypes.ResourceServerAvailable, InventoryProvisioningServerName: InventoryConditionTypes.ProvisioningServerAvailable, }
var MapErrorDeploymentNameConditionType = map[string]InventoryConditionType{ InventoryAlarmServerName: InventoryConditionTypes.AlarmServerError, InventoryArtifactsServerName: InventoryConditionTypes.ArtifactsServerError, InventoryClusterServerName: InventoryConditionTypes.ClusterServerError, InventoryDatabaseServerName: InventoryConditionTypes.DatabaseServerError, InventoryResourceServerName: InventoryConditionTypes.ResourceServerError, InventoryProvisioningServerName: InventoryConditionTypes.ProvisioningServerError, }
Functions ¶
func AddCABundle ¶
AddCABundle to an existing TLS configuration
func AddObjectContext ¶
AddObjectContext adds standard object metadata to context
func AssignMacAddress ¶
func AssignMacAddress(clusterInput map[string]any, hwInterfaces []*pluginsv1alpha1.Interface, nodeSpec map[string]interface{}) error
AssignMacAddress assigns a MAC address to a node interface based on matching criteria. Parameters:
- clusterInput: A map containing the merged cluster input data. It should include a "nodes" key with a slice of node data that specifies interface details.
- hwInterfaces: A slice of hardware interfaces containing MAC address and label information.
- nodeSpec: A reference to the node specification where the MAC address will be assigned.
Returns: - error: An error if any unexpected structure or data is encountered; otherwise, nil.
func BuildTestClusterInstanceCRD ¶
func BuildTestClusterInstanceCRD(clusterInstanceSpecStr string) (*unstructured.Unstructured, error)
func ClearPRCallbackAnnotationsWithPatch ¶
func ClearPRCallbackAnnotationsWithPatch(ctx context.Context, c client.Client, object client.Object) error
ClearPRCallbackAnnotationsWithPatch removes CallbackReceivedAnnotation from a client.Object and patches it
func ClearPRCallbackReceivedAnnotation ¶
ClearPRCallbackReceivedAnnotation removes CallbackReceivedAnnotation from a client.Object
func ClusterIsReadyForPolicyConfig ¶
func ClusterIsReadyForPolicyConfig( ctx context.Context, c client.Client, clusterInstanceName string) (bool, error)
ClusterIsReadyForPolicyConfig checks if a cluster is ready for policy configuration by looking at its availability, joined status and hub acceptance.
func ConvertFromUnstructured ¶
func ConvertFromUnstructured(u *unstructured.Unstructured) (*siteconfig.ClusterInstance, error)
func ConvertMapAnyToString ¶
ConvertMapAnyToString converts a map of any to a map of strings. Values not of type string are ignored.
func ConvertToUnstructured ¶
func ConvertToUnstructured(ci siteconfig.ClusterInstance) (*unstructured.Unstructured, error)
func CopyBMCSecrets ¶
func CopyBMCSecrets(ctx context.Context, c client.Client, hwNodes map[string][]NodeInfo, clusterNamespace string) error
CopyBMCSecrets copies BMC secrets from the plugin namespace to the cluster namespace.
func CopyK8sSecret ¶
func CopyK8sSecret(ctx context.Context, c client.Client, secretName, sourceNamespace, targetNamespace string) error
CopyK8sSecret copies a secret from one namespace to another.
func CopyPullSecret ¶
func CopyPullSecret(ctx context.Context, c client.Client, ownerObject client.Object, sourceNamespace, pullSecretName string, hwNodes map[string][]NodeInfo) error
CopyPullSecret copies the pull secrets from the cluster template namespace to the bmh namespace.
func CreateConfigMapFromEmbeddedFile ¶
func CreateConfigMapFromEmbeddedFile(ctx context.Context, c client.Client, ownerObject client.Object, fs embed.FS, path, namespace, name, key string) error
CreateConfigMapFromEmbeddedFile extracts a file from an embedded file system and builds a ConfigMap. If the file does not exist or is not accessible then an error is returned.
func CreateDefaultInventoryCR ¶
CreateDefaultInventoryCR creates the default Inventory CR so that the system has running servers
func CreateHwMgrPluginNamespace ¶
CreateHwMgrPluginNamespace creates the namespace of the hardware manager plugin where the node allocation requests resource resides
func CreateK8sCR ¶
func CreateK8sCR(ctx context.Context, c client.Client, newObject client.Object, ownerObject client.Object, operation string) (err error)
CreateK8sCR creates/updates/patches an object.
func CreateSecretFromLiterals ¶
func CreateSecretFromLiterals(ctx context.Context, c client.Client, ownerObject client.Object, namespace, name string, literals map[string][]byte) error
CreateSecretFromLiterals takes a map of key value pairs and produces a Secret.
func DeepMergeMaps ¶
func DeepMergeMaps[K comparable, V any](dst, src map[K]V, checkType bool) error
DeepMergeMaps performs a deep merge of the src map into the dst map. Merge rules:
- If a key exists in both src and dst maps: a. If the values are of different types and matched type is required, it returns an error, otherwise, the src values overrides the dst element. b. If the values are both maps, recursively merge them. c. If the values are both slices, deeply merge the slices. d. For other types, the src value overrides the dst value.
- If a key exists only in src, add it to dst.
- If a key exists only in dst, preserve it.
func DeepMergeSlices ¶
func DeepMergeSlices[K comparable, V any](dst, src []V, checkType bool) ([]V, error)
DeepMergeSlices performs a deep indexing merge of the src slice into the dst slice. Merge rules:
- For elements present in both src and dst slices at the same index: a. If the elements are of different types and matched type is required, it returns an error, otherwise, the src element overrides the dst element. b. If the elements are both maps, deeply merge them. c. For other types, the src element overrides the dst element.
- If the src slice is longer, append the additional elements from src to dst.
- If the dst slice is longer, preserve the additional elements from dst.
func DetermineAuthType ¶
func DoesK8SResourceExist ¶
func ExtractBeforeDot ¶
ExtractBeforeDot returns the strubstring before the first dot.
func ExtractPortFromAddress ¶
ExtractPortFromAddress extracts the port number from an address string like ":8090" or "0.0.0.0:8090" Returns an error if no port is found or if parsing fails
func ExtractSchemaRequired ¶
ExtractSchemaRequired extracts the required field of a subschema
func ExtractTemplateDataFromConfigMap ¶
ExtractTemplateDataFromConfigMap extracts the template data associated with the specified key from the provided ConfigMap. The data is expected to be in YAML format.
func ExtractTimeoutFromConfigMap ¶
ExtractTimeoutFromConfigMap extracts the timeout config from the ConfigMap by key if exits. converting it from duration string to time.Duration. Returns an error if the value is not a valid duration string.
func GenerateSearchApiUrl ¶
GenerateSearchApiUrl appends graphql path to the backend URL to form the fully qualified search path
func GenerateSecretName ¶
Generates the name for a node's secret from a node map.
func GetBMHNamespace ¶
func GetBMHNamespace(node *pluginsv1alpha1.AllocatedNode) string
GetBMHNamespace returns the BMH namespace for the given node. Check both node label and Spec.HwMgrNodeNs to ensure compatibility until plugin transitions to Spec.HwMgrNodeNs
func GetBackendTokenArg ¶
func GetBareMetalHostForAllocatedNode ¶
func GetBareMetalHostForAllocatedNode(ctx context.Context, c client.Client, allocatedNodeID string) *metal3v1alpha1.BareMetalHost
func GetBareMetalHostFromHostname ¶
func GetBareMetalHostFromHostname(ctx context.Context, c client.Client, hostname string) (*metal3v1alpha1.BareMetalHost, error)
GetBareMetalHostFromHostname retrieves the BareMetalHost that matches the given hostname
func GetBootMacAddress ¶
func GetBootMacAddress(interfaces []*pluginsv1alpha1.Interface, bootIfaceLabel string) (string, error)
GetBootMacAddress selects the boot interface based on label and return the interface MAC address
func GetClientTLSConfig ¶
GetClientTLSConfig creates a tls.Config that uses a dynamic loader to handle updates to the certificate and/or key.
func GetClusterID ¶
GetClusterID retrieves the UUID value for the cluster specified by name
func GetConfigMapField ¶
GetConfigMapField attempts to retrieve the value of the field using the provided field name
func GetConfigmap ¶
func GetConfigmap(ctx context.Context, c client.Client, name, namespace string) (*corev1.ConfigMap, error)
GetConfigmap attempts to retrieve a ConfigMap object for the given name
func GetDatabaseHostname ¶
func GetDatabaseHostname() string
GetDatabaseHostname returns the URL used to access the database service
func GetDefaultBackendTransport ¶
func GetDefaultBackendTransport() (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 GetDefaultsFromConfigMap ¶
func GetDefaultsFromConfigMap(ctx context.Context, c client.Client, configMapName string, configMapNamespace string, configMapKey string, schema []byte, schemaKey string) (map[string]interface{}, error)
GetDefaultsFromConfigMap returns the data of a defaults ConfigMap with its content separated in 2 sections:
- immutable: the values for configuration that is not exposed through the ClusterTemplate.
- editable : the values for configuration is exposed through the ClusterTemplate and can later be changed through the ProvisioningRequest.
If any error is encountered, the default data is returned as it is in the ConfigMap, without any further separation.
func GetDefaultsFromMaps ¶
func GetDefaultsFromMaps[K comparable, V any]( mapDefaults map[K]V, mapSchema map[K]V) (map[K]V, map[K]V, error)
GetDefaultsFromMaps separates the values from a map into 2 maps: one with elements that match the passed schema and one with the elements that do not match the schema.
func GetDefaultsFromSlices ¶
func GetDefaultsFromSlices[K comparable, V any]( sliceDefaults []V, mapSchema map[K]V) ([]V, []V, error)
GetDefaultsFromSlices separates the values from a slice into 2 lists: one with elements that match the passed schema and one with the elements that do not match the schema.
func GetDeploymentVolumeMounts ¶
func GetDeploymentVolumeMounts(serverName string, inventory *inventoryv1alpha1.Inventory) []corev1.VolumeMount
GetDeploymentVolumeMounts builds the list of volume mounts applicable to the specified server
func GetDeploymentVolumes ¶
func GetDeploymentVolumes(serverName string, inventory *inventoryv1alpha1.Inventory) []corev1.Volume
GetDeploymentVolumes builds the list of volumes applicable to the specified server
func GetEnvOrDefault ¶
GetEnvOrDefault returns the value of the named environment variable or the supplied default value if the environment variable is not set.
func GetHardwarePlugin ¶
func GetHardwarePlugin(ctx context.Context, c client.Client, hwPluginName string) (*hwmgmtv1alpha1.HardwarePlugin, error)
GetHardwarePlugin retrieves the HardwarePlugin resource for a given name
func GetHardwarePluginFromProvisioningRequest ¶
func GetHardwarePluginFromProvisioningRequest(ctx context.Context, c client.Client, pr *provisioningv1alpha1.ProvisioningRequest) (*hwmgmtv1alpha1.HardwarePlugin, error)
GetHardwarePluginFromProvisioningRequest retrieves the HardwarePlugin resource associated with a given ProvisioningRequest resource
func GetHardwarePluginRefFromProvisioningRequest ¶
func GetHardwarePluginRefFromProvisioningRequest(ctx context.Context, c client.Client, pr *provisioningv1alpha1.ProvisioningRequest) (string, error)
GetHardwarePluginRefFromProvisioningRequest retrieves the HardwarePlugin Reference from the ProvisioningRequest. The HardwarePluginRef is stored in the HardwareTemplate which can be obtained by fetching the ClusterTemplate associated with the given ProvisioningRequest.
func GetHardwareTemplate ¶
func GetHardwareTemplate(ctx context.Context, c client.Client, hwTemplateName string) (*hwmgmtv1alpha1.HardwareTemplate, error)
GetHardwareTemplate retrieves the hardware template resource for a given name
func GetHwMgrPluginNS ¶
func GetHwMgrPluginNS() string
GetHwMgrPluginNS returns the value of environment variable HWMGR_PLUGIN_NAMESPACE
func GetIngressDomain ¶
GetIngressDomain will determine the network domain of the default ingress controller
func GetInternalClientTLSConfig ¶
GetInternalClientTLSConfig creates a tls.Config that uses a dynamic loader to handle updates to the certificate and/or key.
func GetKeyPairFromSecret ¶
func GetKeyPairFromSecret(ctx context.Context, c client.Client, name, namespace string) ([]byte, []byte, error)
GetKeyPairFromSecret retrieves a certificate and its associated private key from a Secret.
func GetNarCallbackServiceName ¶
func GetNarCallbackServiceName() string
GetNarCallbackServiceName returns the callback service name from environment or default
func GetNarCallbackServiceNamespace ¶
func GetNarCallbackServiceNamespace() string
GetNarCallbackServiceNamespace returns the callback service namespace from environment or default namespace
func GetParentPolicyNameAndNamespace ¶
GetParentPolicyNameAndNamespace extracts the parent policy name and namespace from the child policy name. The child policy name follows the format: "<parent_policy_namespace>.<parent_policy_name>". Since the namespace is disallowed to contain ".", splitting the string with "." into two substrings is safe.
func GetPasswordOrRandom ¶
GetPasswordOrRandom attempts to query a password from the environment and generates a random password if none was found matching the supplied environment variable name.
func GetPullSecretName ¶
func GetPullSecretName(clusterInstance *unstructured.Unstructured) (string, error)
func GetSearchAPI ¶
GetSearchAPI attempts to find the search-api service using its label selector
func GetSearchURL ¶
GetSearchURL attempts to build the Search API service URL by dynamically looking up the service.
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 GetServerArgs ¶
func GetServerArgs(inventory *inventoryv1alpha1.Inventory, serverName string) (result []string, err error)
func GetServerDatabasePasswordName ¶
GetServerDatabasePasswordName retrieves name of the environment variable used to store the server's database password
func GetServerTLSConfig ¶
GetServerTLSConfig creates a tls.Config that uses a dynamic loader to handle updates to the certificate and/or key.
func GetServiceURL ¶
GetServiceURL constructs the default service URL for a server
func GetStatusMessage ¶
func GetStatusMessage(condition hwmgmtv1alpha1.ConditionType) string
GetStatusMessage returns a status message based on the given condition typ
func GetTLSSkipVerify ¶
func GetTLSSkipVerify() bool
GetTLSSkipVerify returns the current requested value of the TLS Skip Verify setting
func GetTimeoutFromHWTemplate ¶
func GetTimeoutFromHWTemplate(ctx context.Context, c client.Client, name string) (time.Duration, error)
GetTimeoutFromHWTemplate retrieves the timeout value from the hardware template resource. converting it from duration string to time.Duration. Returns an error if the value is not a valid duration string.
func HandleHardwareTimeout ¶
func HandleHardwareTimeout( condition hwmgmtv1alpha1.ConditionType, provisioningStartTime *metav1.Time, configurationStartTime *metav1.Time, timeout time.Duration, currentReason string, currentMessage string) (bool, string, string)
HandleHardwareTimeout checks for provisioning or configuration timeout
func HasApiEndpoints ¶
HasApiEndpoints determines whether a server exposes a set of API endpoints
func HasDatabase ¶
HasDatabase determines whether a server owns a logical database instance
func HasFatalProvisioningFailure ¶
HasFatalProvisioningFailure checks if the ProvisioningRequest has a fatal provisioning failure that cannot be recovered on its own.
func HwMgrPluginNamespaceExists ¶
HwMgrPluginNamespaceExists checks if the namespace of the hardware manager plugin exists
func IsClusterConfigCompleted ¶
func IsClusterConfigCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterConfigCompleted checks if the cluster config condition status is completed
func IsClusterProvisionCompleted ¶
func IsClusterProvisionCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterProvisionCompleted checks if the cluster provision condition status is completed.
func IsClusterProvisionFailed ¶
func IsClusterProvisionFailed(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterProvisionFailed checks if the cluster provision condition status is failed
func IsClusterProvisionInProgress ¶
func IsClusterProvisionInProgress(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterProvisionInProgress checks if the cluster provision condition status is in progress.
func IsClusterProvisionPresent ¶
func IsClusterProvisionPresent(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterProvisionPresent checks if the cluster provision condition is present
func IsClusterProvisionTimedOutOrFailed ¶
func IsClusterProvisionTimedOutOrFailed(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterProvisionTimedOutOrFailed checks if the cluster provision condition status is timedout or failed
func IsClusterUpgradeCompleted ¶
func IsClusterUpgradeCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterUpgradeCompleted checks if the cluster upgrade is completed
func IsClusterUpgradeInProgress ¶
func IsClusterUpgradeInProgress(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterUpgradeInProgress checks if the cluster upgrade condition status is in progress
func IsClusterUpgradeInitiated ¶
func IsClusterUpgradeInitiated(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterUpgradeInitiated checks if the cluster upgrade is initiated
func IsClusterZtpDone ¶
func IsClusterZtpDone(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsClusterZtpDone checks if the cluster ZTP is done
func IsConditionDoesNotExistsErr ¶
IsConditionDoesNotExistsErr checks if the given error is of type ConditionDoesNotExistsErr
func IsHardwareConfigCompleted ¶
func IsHardwareConfigCompleted(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsHardwareConfigCompleted checks if the hardware config condition status is completed For initial provisioning, this condition may not exist, which is considered completed. For Day2 updates, the condition must be present and True.
func IsInputError ¶
func IsOAuthEnabled ¶
func IsOAuthEnabled(inventory *inventoryv1alpha1.Inventory) bool
IsOAuthEnabled determines if the Inventory CR has OAuth attributes provided.
func IsParentPolicyInZtpClusterTemplateNs ¶
IsParentPolicyInZtpClusterTemplateNs checks whether the parent policy resides in the namespace "ztp-<clustertemplate-ns>".
func IsProvisioningStateFulfilled ¶
func IsProvisioningStateFulfilled(cr *provisioningv1alpha1.ProvisioningRequest) bool
IsProvisioningStateFulfilled checks if the provisioning status is fulfilled
func IsSmoRegistrationCompleted ¶
func IsSmoRegistrationCompleted(cr *inventoryv1alpha1.Inventory) bool
IsSmoRegistrationCompleted checks if registration with SMO has been completed
func IsValidURL ¶
func LogOperation ¶
func LogOperation(ctx context.Context, logger *slog.Logger, operation, msg string, attrs ...slog.Attr) context.Context
LogOperation logs a specific operation with context
func LogPhaseComplete ¶
func LogPhaseComplete(ctx context.Context, logger *slog.Logger, phase string, duration time.Duration)
LogPhaseComplete logs the completion of a reconciliation phase
func LogPhaseStart ¶
LogPhaseStart logs the start of a reconciliation phase
func LogReconcileStart ¶
func LogReconcileStart(ctx context.Context, logger *slog.Logger, req ctrl.Request, resourceType string) context.Context
LogReconcileStart adds standard reconciliation context and logs start message
func MakeUUIDFromNames ¶
MakeUUIDFromNames generates a namespaced uuid value from the specified namespace and name values. The values are scoped to a `cloudID` to avoid conflicts with other systems.
func MapKeysToSlice ¶
MapKeysToSlice takes a map[string]bool and returns a slice of strings containing the keys
func NeedsOAuthAccess ¶
NeedsOAuthAccess determines whether a server requires access to the Authorization server. This can be either because it needs to get a token to communicate with the SMO or to validate a token against the authorization server directly.
func RemoveLabelFromInterfaces ¶
RemoveLabelFromInterfaces removes the label property for each interface as the label property is not part of the ClusterInstance schema.
func RequiresInternalListener ¶
RequiresInternalListener determines whether a server expects its API to be accessed by another server. If this is the case, then in an OAuth configuration we run a second listener for that server which handles authenticating using a Kubernetes service account token rather than an OAuth token.
func SetProvisioningStateDeleting ¶
func SetProvisioningStateDeleting(cr *provisioningv1alpha1.ProvisioningRequest)
SetProvisioningStateDeleting updates the provisioning state to deleting with detailed message
func SetProvisioningStateFailed ¶
func SetProvisioningStateFailed(cr *provisioningv1alpha1.ProvisioningRequest, message string)
SetProvisioningStateFailed updates the provisioning state to failed with detailed message
func SetProvisioningStateFulfilled ¶
func SetProvisioningStateFulfilled(cr *provisioningv1alpha1.ProvisioningRequest)
SetProvisioningStateFulfilled updates the provisioning state to fulfilled with detailed message
func SetProvisioningStateInProgress ¶
func SetProvisioningStateInProgress(cr *provisioningv1alpha1.ProvisioningRequest, message string)
SetProvisioningStateInProgress updates the provisioning state to progressing with detailed message
func SetProvisioningStatePending ¶
func SetProvisioningStatePending(cr *provisioningv1alpha1.ProvisioningRequest, message string)
SetProvisioningStatePending updates the provisioning state to pending with detailed message
func SetStatusCondition ¶
func SetStatusCondition( existingConditions *[]metav1.Condition, conditionType provisioningv1alpha1.ConditionType, conditionReason provisioningv1alpha1.ConditionReason, 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, logger *slog.Logger, config *OAuthClientConfig) (*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 TimeoutExceeded ¶
TimeoutExceeded returns true if it's been more time than the timeout configuration.
func UpdateHardwareTemplateStatusCondition ¶
func UpdateHardwareTemplateStatusCondition(ctx context.Context, c client.Client, hardwareTemplate *hwmgmtv1alpha1.HardwareTemplate, conditionType provisioningv1alpha1.ConditionType, conditionReason provisioningv1alpha1.ConditionReason, conditionStatus metav1.ConditionStatus, message string) error
UpdateHardwareTemplateStatusCondition updates the status condition of the HardwareTemplate resource
func UpdateK8sCRStatus ¶
func ValidateConfigmapSchemaAgainstClusterInstanceCRD ¶
func ValidateConfigmapSchemaAgainstClusterInstanceCRD[T any](ctx context.Context, c client.Client, data T) error
ValidateConfigmapSchemaAgainstClusterInstanceCRD checks if the data of the ClusterInstance default ConfigMap matches the ClusterInstance CRD schema.
func ValidateDefaultInterfaces ¶
ValidateDefaultInterfaces verifies that each interface has a specified label field, as labels are not part of the ClusterInstance structure by default.
Types ¶
type AvailableNotification ¶
type AvailableNotification struct { GlobalCloudId string `json:"globalCloudId"` OCloudId string `json:"oCloudId"` ImsEndpoint string `json:"IMS_EP"` }
AvailableNotification represents the data sent to the SMO once the O2IMS is ready to accept API calls. This is from table 3.6.5.1.2-1 in the O-RAN.WG6.O2IMS-INTERFACE-R003-v06.00 document, and presumably will be formally defined in an OpenAPI that we can just import at some point.
type ConditionDoesNotExistsErr ¶
type ConditionDoesNotExistsErr struct {
ConditionName string
}
ConditionDoesNotExistsErr represents an error when a specific condition is missing
func (*ConditionDoesNotExistsErr) Error ¶
func (e *ConditionDoesNotExistsErr) Error() string
Error implements the error interface for ConditionDoesNotExistsErr, returning a formatted error message
type InputError ¶
type InputError struct {
// contains filtered or unexported fields
}
InputError wraps a standard error and provides a custom error type for input-related errors
func NewInputError ¶
func NewInputError(format string, args ...interface{}) *InputError
func (*InputError) Error ¶
func (i *InputError) Error() string
type InventoryConditionReason ¶
type InventoryConditionReason string
type InventoryConditionType ¶
type InventoryConditionType string
InventoryConditionType defines conditions of an Inventory deployment.
type NarCallbackConfig ¶
NarCallbackConfig holds configuration for the NodeAllocationRequest callback service
func NewNarCallbackConfig ¶
func NewNarCallbackConfig(port int) *NarCallbackConfig
NewNarCallbackConfig creates a new callback configuration with values from environment variables and the provided port
func (*NarCallbackConfig) BuildCallbackURL ¶
func (c *NarCallbackConfig) BuildCallbackURL(prName string) string
BuildCallbackURL constructs the callback URL for a given provisioning request name
type OAuthClientConfig ¶
type OAuthClientConfig struct { OAuthConfig *OAuthConfig // The TLS related configuration attributes TLSConfig *TLSConfig }
OAuthClientConfig defines the parameters required to establish an HTTP Client capable of acquiring an OAuth Token from an OAuth capable authorization server.
type OAuthConfig ¶
type OAuthConfig struct { // 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 // Defines the OAuth client-secret attribute to be used when acquiring a token. 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 }
OAuthConfig defines the OAuth config attributes related to an OAuth client configuration
type StaticKeyPairLoader ¶
type StaticKeyPairLoader struct {
// contains filtered or unexported fields
}
StaticKeyPairLoader provides a means by which we can use a static certificate as input into the dynamic content provider interface. We limit the use of this to clients that are a one-shot implementation that would get re-created periodically and wouldn't need to worry about certificates getting renewed as part of a long lived client.
func NewStaticKeyPairLoader ¶
func NewStaticKeyPairLoader(cert, key []byte) *StaticKeyPairLoader
func (*StaticKeyPairLoader) AddListener ¶
func (s *StaticKeyPairLoader) AddListener(_ dynamiccertificates.Listener)
AddListener is a no-op for static providers.
func (*StaticKeyPairLoader) CurrentCertKeyContent ¶
func (s *StaticKeyPairLoader) CurrentCertKeyContent() ([]byte, []byte)
CurrentCertKeyContent loads the key pair from the dynamic source. In this case it is static data so we always load the same data.
func (*StaticKeyPairLoader) Name ¶
func (s *StaticKeyPairLoader) Name() string
Name is a simple name to identify this provider
type TLSConfig ¶
type TLSConfig struct { // The client certificate to be used when initiating connection to the server. ClientCert dynamiccertificates.CertKeyContentProvider // 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 }
TLSConfig defines the TLS config attributes related to a OAuth client configuration