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 1/6] 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 From 8f492e51085b59c975505b6df9078ef54c5257d9 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 May 2024 19:45:30 -0600 Subject: [PATCH 2/6] Update api/v1alpha1/provider_opts.go update comment --- api/v1alpha1/provider_opts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1alpha1/provider_opts.go b/api/v1alpha1/provider_opts.go index dde22b8..06df397 100644 --- a/api/v1alpha1/provider_opts.go +++ b/api/v1alpha1/provider_opts.go @@ -27,7 +27,7 @@ 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. + // HostScheme determines whether to use http or https for intelAMT calls. // +optional // +kubebuilder:validation:Enum=http;https // +kubebuilder:default:=http From 131992bde6101d1680c2e97bccc5232688110823 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 May 2024 19:45:42 -0600 Subject: [PATCH 3/6] Update config/crd/bases/bmc.tinkerbell.org_machines.yaml update comment --- config/crd/bases/bmc.tinkerbell.org_machines.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/bmc.tinkerbell.org_machines.yaml b/config/crd/bases/bmc.tinkerbell.org_machines.yaml index ee8b324..d53c7fb 100644 --- a/config/crd/bases/bmc.tinkerbell.org_machines.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_machines.yaml @@ -76,7 +76,7 @@ spec: properties: hostScheme: default: http - description: UseHttp determines whether to use http or + description: HostScheme determines whether to use http or https for intelAMT calls. enum: - http From a16c3841b26a808f4aab9e6c9f92223aec8aa110 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 May 2024 19:45:52 -0600 Subject: [PATCH 4/6] Update config/crd/bases/bmc.tinkerbell.org_tasks.yaml update comment --- config/crd/bases/bmc.tinkerbell.org_tasks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml index 8574146..0430b1e 100644 --- a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml @@ -77,7 +77,7 @@ spec: properties: hostScheme: default: http - description: UseHttp determines whether to use http or + description: HostScheme determines whether to use http or https for intelAMT calls. enum: - http From bf56621a7546b1fa6ca1b9c44576cd37ab289d46 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 May 2024 19:46:07 -0600 Subject: [PATCH 5/6] Update config/crd/bases/bmc.tinkerbell.org_machines.yaml update capitalization --- config/crd/bases/bmc.tinkerbell.org_machines.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/bmc.tinkerbell.org_machines.yaml b/config/crd/bases/bmc.tinkerbell.org_machines.yaml index d53c7fb..0d548eb 100644 --- a/config/crd/bases/bmc.tinkerbell.org_machines.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_machines.yaml @@ -77,7 +77,7 @@ spec: hostScheme: default: http description: HostScheme determines whether to use http or - https for intelAMT calls. + https for IntelAMT calls. enum: - http - https From 7c7a25d8bbcde96513b1e79a9c13cfda1513e4f2 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 May 2024 19:46:14 -0600 Subject: [PATCH 6/6] Update config/crd/bases/bmc.tinkerbell.org_tasks.yaml update capitalization --- config/crd/bases/bmc.tinkerbell.org_tasks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml index 0430b1e..83d4e45 100644 --- a/config/crd/bases/bmc.tinkerbell.org_tasks.yaml +++ b/config/crd/bases/bmc.tinkerbell.org_tasks.yaml @@ -78,7 +78,7 @@ spec: hostScheme: default: http description: HostScheme determines whether to use http or - https for intelAMT calls. + https for IntelAMT calls. enum: - http - https