From f72a47d20b56db8e8a585f0b87889c4bc434f60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9onard=20Suslian=20=28synthe102=29?= Date: Fri, 24 May 2024 22:39:54 +0200 Subject: [PATCH] feat(intelAMT): add support for HTTPS connections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: LĂ©onard Suslian (synthe102) --- api/v1alpha1/provider_opts.go | 6 ++++++ config/crd/bases/bmc.tinkerbell.org_machines.yaml | 8 ++++++++ config/crd/bases/bmc.tinkerbell.org_tasks.yaml | 8 ++++++++ controller/client.go | 5 +++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/api/v1alpha1/provider_opts.go b/api/v1alpha1/provider_opts.go index 12e01d7..dde22b8 100644 --- a/api/v1alpha1/provider_opts.go +++ b/api/v1alpha1/provider_opts.go @@ -26,6 +26,12 @@ type IPMITOOLOptions struct { type IntelAMTOptions struct { // Port that intelAMT will use for calls. Port int `json:"port"` + + // UseHttp determines whether to use http or https for intelAMT calls. + // +optional + // +kubebuilder:validation:Enum=http;https + // +kubebuilder:default:=http + HostScheme string `json:"hostScheme"` } // HMACAlgorithm is a type for HMAC algorithms. diff --git a/config/crd/bases/bmc.tinkerbell.org_machines.yaml b/config/crd/bases/bmc.tinkerbell.org_machines.yaml index 546a05d..ee8b324 100644 --- a/config/crd/bases/bmc.tinkerbell.org_machines.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_machines.yaml @@ -74,6 +74,14 @@ spec: description: IntelAMT contains the options to customize the IntelAMT provider. properties: + hostScheme: + default: http + description: UseHttp determines whether to use http or + https for intelAMT calls. + enum: + - http + - https + type: string port: description: Port that intelAMT will use for calls. type: integer diff --git a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml index 57f04a9..8574146 100644 --- a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml @@ -75,6 +75,14 @@ spec: description: IntelAMT contains the options to customize the IntelAMT provider. properties: + hostScheme: + default: http + description: UseHttp determines whether to use http or + https for intelAMT calls. + enum: + - http + - https + type: string port: description: Port that intelAMT will use for calls. type: integer diff --git a/controller/client.go b/controller/client.go index e124a98..c74c656 100644 --- a/controller/client.go +++ b/controller/client.go @@ -77,8 +77,9 @@ func (b BMCOptions) Translate(host string) []bmclib.Option { // intelAmt options if b.IntelAMT != nil { - amt := bmclib.WithIntelAMTPort(uint32(b.IntelAMT.Port)) - o = append(o, amt) + amtPort := bmclib.WithIntelAMTPort(uint32(b.IntelAMT.Port)) + amtScheme := bmclib.WithIntelAMTHostScheme(b.IntelAMT.HostScheme) + o = append(o, amtPort, amtScheme) } // rpc options