dellhwmgr

package
v0.0.0-...-74e121d Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

dell-hwmgr

The Dell Hardware Manager Adaptor for O-Cloud Hardware Manager Plugin provides the interactions between the O-Cloud Manager and one or more configured Dell Hardware Managers.

Overview

The Dell Hardware Manager Adaptor requires the .spec.dellData field to be set in the HardwareManager CR, providing the necessary configuration information to establish an authenticated connection to the hardware manager instance. The Plugin will interact with the hardware manager while processing a NodePool CR.

Configuration

The dellData of the HardwareManager CR provides the following information:

  • apiUrl: The address for the hardware manager.
  • authSecret: The name of the secret in the Plugin namespace that provides the username and password to be used when requesting a token.

The secret follows the kubernetes.io/basic-auth type format, with username and password data fields, along with the client-id field.

Example:

---
apiVersion: v1
kind: Secret
metadata:
  name: dell-1
  namespace: oran-hwmgr-plugin
type: kubernetes.io/basic-auth
data:
  client-id: bXljbGllbnQ=
  username: YWRtaW4=
  password: bm90cmVhbA==
---
apiVersion: hwmgr-plugin.oran.openshift.io/v1alpha1
kind: HardwareManager
metadata:
  name: dell-1
  namespace: oran-hwmgr-plugin
spec:
  adaptorId: dell-hwmgr
  dellData:
    authSecret: dell-1
    apiUrl: https://myserver.example.com:443/

If the Plugin is able to establish an authenticated connection to the hardware manager, a Validation condition is set to True on the HardwareManager CR to indicate that the CR has been validated and authentication was successful. If not, the Validation field is set to False with a message indicating that authentication has failed.

$ oc get -n oran-hwmgr-plugin hwmgr
NAME           AGE   REASON      STATUS   DETAILS
dell-1         16h   Completed   True     Authentication passed
dell-badauth   16h   Failed      False    Authentication failure - failed to get token for dell-badauth: token request failed with status 401 Unauthorized (401), message={"code":401,"message":"internal error occurred while creating token","details":{"domain":"IAM","reason":"Unauthorized","metadata":{"DTIASErrorCode":"DELL-DTIAS-IAM-20016","DTIASErrorMessage":"internal error occurred while creating token","HTTPErrorCode":"401","ManagedServiceError":"Invalid user credentials","Resolution":"contact administrator with the error for further assistance."}}}
$ oc get -n oran-hwmgr-plugin hwmgr -o yaml
apiVersion: v1
items:
- apiVersion: hwmgr-plugin.oran.openshift.io/v1alpha1
  kind: HardwareManager
  metadata:
    creationTimestamp: "2024-10-21T21:38:42Z"
    generation: 1
    name: dell-1
    namespace: oran-hwmgr-plugin
    resourceVersion: "514800972"
    uid: ca721c06-98af-468a-b51f-d0d0a15a629f
  spec:
    adaptorId: dell-hwmgr
    dellData:
      apiUrl: https://myserver.example.com:443/
      authSecret: dell-1
      clientId: ccpapi
  status:
    conditions:
    - lastTransitionTime: "2024-10-21T21:38:42Z"
      message: Authentication passed
      reason: Completed
      status: "True"
      type: Validation
- apiVersion: hwmgr-plugin.oran.openshift.io/v1alpha1
  kind: HardwareManager
  metadata:
    creationTimestamp: "2024-10-21T21:39:13Z"
    generation: 1
    name: dell-badauth
    namespace: oran-hwmgr-plugin
    resourceVersion: "514801993"
    uid: 292d5726-28b3-4cef-873c-ace0bad22f55
  spec:
    adaptorId: dell-hwmgr
    dellData:
      apiUrl: https://myserver.example.com:443/
      authSecret: dell-badauth
      clientId: ccpapi
  status:
    conditions:
    - lastTransitionTime: "2024-10-21T21:39:13Z"
      message: 'Authentication failure - failed to get token for dell-badauth: token
        request failed with status 401 Unauthorized (401), message={"code":401,"message":"internal
        error occurred while creating token","details":{"domain":"IAM","reason":"Unauthorized","metadata":{"DTIASErrorCode":"DELL-DTIAS-IAM-20016","DTIASErrorMessage":"internal
        error occurred while creating token","HTTPErrorCode":"401","ManagedServiceError":"Invalid
        user credentials","Resolution":"contact administrator with the error for further
        assistance."}}}'
      reason: Failed
      status: "False"
      type: Validation
kind: List
metadata:
  resourceVersion: ""

Debug

Message tracing, which logs the JSON request and response data for interactions with the hardware manager, can be enabled by setting an annotation on the HardwareManager CR, setting hwmgr-plugin.oran.openshift.io/logMessages=enabled. Any other value will disable the tracing.

# Add the annotation to target HardwareManager
oc annotate -n oran-hwmgr-plugin HardwareManager <hwmgr> hwmgr-plugin.oran.openshift.io/logMessages=enabled

# Remove the annotation
oc annotate -n oran-hwmgr-plugin HardwareManager <hwmgr> hwmgr-plugin.oran.openshift.io/logMessages-

Documentation

Index

Constants

View Source
const (
	NodePoolFSMCreate = iota
	NodePoolFSMProcessing
	NodePoolFSMSpecChanged
	NodePoolFSMNoop
)
View Source
const (
	ExtensionsNics = "O2-nics"
	ExtensionsNads = "nads"

	ExtensionsRemoteManagement = "RemoteManagement"
	ExtensionsVirtualMediaUrl  = "virtualMediaUrl"

	LabelNameKey  = "name"
	LabelLabelKey = "label"
)
View Source
const (
	JobIdAnnotation = "hwmgr-plugin.oran.openshift.io/jobId"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptor

type Adaptor struct {
	client.Client
	Scheme    *runtime.Scheme
	Logger    *slog.Logger
	Namespace string
	AdaptorID pluginv1alpha1.HardwareManagerAdaptorID
}

func NewAdaptor

func NewAdaptor(client client.Client, scheme *runtime.Scheme, logger *slog.Logger, namespace string) *Adaptor

func (*Adaptor) AllocateNode

func (a *Adaptor) AllocateNode(
	ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	nodepool *hwmgmtv1alpha1.NodePool,
	resource hwmgrapi.RhprotoResource,
	nodegroupName string) (string, error)

AllocateNode processes a NodePool CR, allocating a free node for each specified nodegroup as needed

func (*Adaptor) CreateBMCSecret

func (a *Adaptor) CreateBMCSecret(
	ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	nodepool *hwmgmtv1alpha1.NodePool,
	nodename string,
	resource hwmgrapi.RhprotoResource) error

CreateBMCSecret creates the bmc-secret for a node

func (*Adaptor) CreateNode

func (a *Adaptor) CreateNode(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool, nodename string, resource hwmgrapi.RhprotoResource, nodegroupName string) error

CreateNode creates a Node CR with specified attributes

func (*Adaptor) GetAllocatedNodes

func (a *Adaptor) GetAllocatedNodes(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (allocatedNodes []string, err error)

GetAllocatedNodes gets a list of nodes allocated for the specified NodePool CR

func (*Adaptor) HandleNodePool

func (a *Adaptor) HandleNodePool(ctx context.Context, hwmgr *pluginv1alpha1.HardwareManager, nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

func (*Adaptor) HandleNodePoolCreate

func (a *Adaptor) HandleNodePoolCreate(
	ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

HandleNodePoolCreate processes a new NodePool CR, creating a resource group on the hardware manager

func (*Adaptor) HandleNodePoolDeletion

func (a *Adaptor) HandleNodePoolDeletion(ctx context.Context, hwmgr *pluginv1alpha1.HardwareManager, nodepool *hwmgmtv1alpha1.NodePool) error

func (*Adaptor) HandleNodePoolProcessing

func (a *Adaptor) HandleNodePoolProcessing(
	ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

HandleNodePoolProcessing checks the status of an in-progress NodePool, querying the hardware manager for the job status. If the job is completed, it queries for the resource group in order to create Node CRs corresponding to the allocated nodes.

func (*Adaptor) HandleNodePoolSpecChanged

func (a *Adaptor) HandleNodePoolSpecChanged(
	ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

func (*Adaptor) ProcessNewNodePool

func (a *Adaptor) ProcessNewNodePool(ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) error

ProcessNewNodePool sends a request to the hardware manager to create a resource group

func (*Adaptor) ReleaseNodePool

func (a *Adaptor) ReleaseNodePool(ctx context.Context,
	hwmgrClient *hwmgrclient.HardwareManagerClient,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) error

ReleaseNodePool frees resources allocated to a NodePool

func (*Adaptor) SetupAdaptor

func (a *Adaptor) SetupAdaptor(mgr ctrl.Manager) error

SetupAdaptor sets up the Dell Hardware Manager Adaptor

func (*Adaptor) UpdateNodeStatus

func (a *Adaptor) UpdateNodeStatus(ctx context.Context, nodename string, resource hwmgrapi.RhprotoResource) error

UpdateNodeStatus updates a Node CR status field with additional node information from the RhprotoResource

func (*Adaptor) ValidateNodeConfig

func (a *Adaptor) ValidateNodeConfig(ctx context.Context, resource hwmgrapi.RhprotoResource) error

ValidateNodeConfig performs basic data structure validation on the resource

func (*Adaptor) ValidateNodePool

func (a *Adaptor) ValidateNodePool(nodepool *hwmgmtv1alpha1.NodePool) error

ValidateNodePool performs basic validation of the nodepool data

type BMCCredentials

type BMCCredentials struct {
	Username string `json:"bmc_username"`
	Password string `json:"bmc_password"`
}

type ExtensionInterface

type ExtensionInterface struct {
	Model string          `json:"model,omitempty"`
	Name  string          `json:"name,omitempty"`
	Ports []ExtensionPort `json:"ports,omitempty"`
}

type ExtensionPort

type ExtensionPort struct {
	MACAddress string            `json:"mac,omitempty"`
	MBPS       int               `json:"mbps,omitempty"`
	Labels     []ExtensionsLabel `json:"Labels,omitempty"`
}

type ExtensionsLabel

type ExtensionsLabel struct {
	Key   string `json:"Key"`
	Value string `json:"Value"`
}

Directories

Path Synopsis
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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