From 40c4d0a9fa6287db244ce37cc5d0860046cc6dda Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Mon, 21 Oct 2024 11:19:33 -0600 Subject: [PATCH 1/2] Add redfish provider options: See the RedfishOptions struct for new field details. Signed-off-by: Jacob Weinstock --- api/v1alpha1/machine.go | 8 ++-- api/v1alpha1/provider_opts.go | 5 +++ .../bases/bmc.tinkerbell.org_machines.yaml | 11 ++++++ .../crd/bases/bmc.tinkerbell.org_tasks.yaml | 11 ++++++ config/default/kustomization.yaml | 39 +++---------------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/api/v1alpha1/machine.go b/api/v1alpha1/machine.go index 38db59c..31b549d 100644 --- a/api/v1alpha1/machine.go +++ b/api/v1alpha1/machine.go @@ -55,19 +55,19 @@ type MachineSpec struct { type ProviderOptions struct { // IntelAMT contains the options to customize the IntelAMT provider. // +optional - IntelAMT *IntelAMTOptions `json:"intelAMT"` + IntelAMT *IntelAMTOptions `json:"intelAMT,omitempty"` // IPMITOOL contains the options to customize the Ipmitool provider. // +optional - IPMITOOL *IPMITOOLOptions `json:"ipmitool"` + IPMITOOL *IPMITOOLOptions `json:"ipmitool,omitempty"` // Redfish contains the options to customize the Redfish provider. // +optional - Redfish *RedfishOptions `json:"redfish"` + Redfish *RedfishOptions `json:"redfish,omitempty"` // RPC contains the options to customize the RPC provider. // +optional - RPC *RPCOptions `json:"rpc"` + RPC *RPCOptions `json:"rpc,omitempty"` } // Connection contains connection data for a Baseboard Management Controller. diff --git a/api/v1alpha1/provider_opts.go b/api/v1alpha1/provider_opts.go index 06df397..c7d473a 100644 --- a/api/v1alpha1/provider_opts.go +++ b/api/v1alpha1/provider_opts.go @@ -10,6 +10,11 @@ import ( type RedfishOptions struct { // Port that redfish will use for calls. Port int `json:"port"` + // UseBasicAuth for redfish calls. The default is false which means token based auth is used. + UseBasicAuth bool `json:"useBasicAuth"` + // SystemName is the name of the system to use for redfish calls. + // With redfish implementations that manage multiple systems via a single endpoint, this allows for specifying the system to manage. + SystemName string `json:"systemName"` } // IPMITOOLOptions contains the ipmitool provider specific options. diff --git a/config/crd/bases/bmc.tinkerbell.org_machines.yaml b/config/crd/bases/bmc.tinkerbell.org_machines.yaml index ce00fcc..39ea2b2 100644 --- a/config/crd/bases/bmc.tinkerbell.org_machines.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_machines.yaml @@ -111,8 +111,19 @@ spec: port: description: Port that redfish will use for calls. type: integer + systemName: + description: |- + SystemName is the name of the system to use for redfish calls. + With redfish implementations that manage multiple systems via a single endpoint, this allows for specifying the system to manage. + type: string + useBasicAuth: + description: UseBasicAuth for redfish calls. The default + is false which means token based auth is used. + type: boolean required: - port + - systemName + - useBasicAuth type: object rpc: description: RPC contains the options to customize the RPC diff --git a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml index 8de1701..fffe103 100644 --- a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml @@ -112,8 +112,19 @@ spec: port: description: Port that redfish will use for calls. type: integer + systemName: + description: |- + SystemName is the name of the system to use for redfish calls. + With redfish implementations that manage multiple systems via a single endpoint, this allows for specifying the system to manage. + type: string + useBasicAuth: + description: UseBasicAuth for redfish calls. The default + is false which means token based auth is used. + type: boolean required: - port + - systemName + - useBasicAuth type: object rpc: description: RPC contains the options to customize the RPC diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index ca212e5..bf1a1bb 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -12,10 +12,6 @@ namePrefix: rufio- #commonLabels: # someName: someValue -bases: -- ../crd -- ../rbac -- ../manager # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml #- ../webhook @@ -24,7 +20,6 @@ bases: # [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. #- ../prometheus -patchesStrategicMerge: # Protect the /metrics endpoint by putting it behind auth. # If you want your controller-manager to expose the /metrics # endpoint w/o any authn/z, please comment the following line. @@ -43,31 +38,9 @@ patchesStrategicMerge: #- webhookcainjection_patch.yaml # the following config is for teaching kustomize how to do var substitution -vars: -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR -# objref: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldref: -# fieldpath: metadata.namespace -#- name: CERTIFICATE_NAME -# objref: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -#- name: SERVICE_NAMESPACE # namespace of the service -# objref: -# kind: Service -# version: v1 -# name: webhook-service -# fieldref: -# fieldpath: metadata.namespace -#- name: SERVICE_NAME -# objref: -# kind: Service -# version: v1 -# name: webhook-service +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../crd +- ../rbac +- ../manager From c1c3a935431a62ba03f7b88acfd28d88e98c65a8 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Tue, 22 Oct 2024 10:09:53 -0600 Subject: [PATCH 2/2] Update bmclib version: This version has fixes for redfish basic auth and an update that allows for setting the redfish system. Signed-off-by: Jacob Weinstock --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d9cfda8..aed4985 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.2 require ( dario.cat/mergo v1.0.1 - github.com/bmc-toolbox/bmclib/v2 v2.3.3-0.20241009101203-eba5356884bf + github.com/bmc-toolbox/bmclib/v2 v2.3.4-0.20241022160847-8a5f5a1a243c github.com/ccoveille/go-safecast v1.1.0 github.com/go-logr/logr v1.4.2 github.com/go-logr/zerologr v1.2.3 diff --git a/go.sum b/go.sum index 491ed2a..1deb8d1 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/VictorLowther/soap v0.0.0-20150314151524-8e36fca84b22 h1:a0MBqYm44o0N github.com/VictorLowther/soap v0.0.0-20150314151524-8e36fca84b22/go.mod h1:/B7V22rcz4860iDqstGvia/2+IYWXf3/JdQCVd/1D2A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bmc-toolbox/bmclib/v2 v2.3.3-0.20241009101203-eba5356884bf h1:mZ9+KTnagDFwddNWcHzp3tk2XTKL+3JJLZvSNh8Kzi8= -github.com/bmc-toolbox/bmclib/v2 v2.3.3-0.20241009101203-eba5356884bf/go.mod h1:t8If/0fHQTRIK/yKDk2H3SgthDNNj+7z2aeftDFRFrU= +github.com/bmc-toolbox/bmclib/v2 v2.3.4-0.20241022160847-8a5f5a1a243c h1:UrzCk+x0r3nsa3aTvuNesgtU5/6EkCrEF7EfwnM2rjI= +github.com/bmc-toolbox/bmclib/v2 v2.3.4-0.20241022160847-8a5f5a1a243c/go.mod h1:t8If/0fHQTRIK/yKDk2H3SgthDNNj+7z2aeftDFRFrU= github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3 h1:/BjZSX/sphptIdxpYo4wxAQkgMLyMMgfdl48J9DKNeE= github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I= github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM=