From 070196a4eaa02d03cffadd8ce368532cc0d97318 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Wed, 4 Oct 2023 12:48:30 -0600 Subject: [PATCH] Add BMC env opts: TinkerbellBMCCustomPayload and TinkerbellBMCCustomPayloadDotLocation. Signed-off-by: Jacob Weinstock --- cmd/eksctl-anywhere/cmd/aflag/tinkerbell.go | 12 ++++++++++++ cmd/eksctl-anywhere/cmd/createcluster.go | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/cmd/eksctl-anywhere/cmd/aflag/tinkerbell.go b/cmd/eksctl-anywhere/cmd/aflag/tinkerbell.go index d29219d237071..e42599b94a5b2 100644 --- a/cmd/eksctl-anywhere/cmd/aflag/tinkerbell.go +++ b/cmd/eksctl-anywhere/cmd/aflag/tinkerbell.go @@ -87,3 +87,15 @@ var TinkerbellBMCHMACSecrets = Flag[[]string]{ Name: "tinkerbell-bmc-hmac-secrets", Usage: "The secrets used to HMAC sign a payload, used in RPC BMC interactions", } + +// TinkerbellBMCCustomPayload allows providing a JSON payload that will be used in the RPC request. +var TinkerbellBMCCustomPayload = Flag[string]{ + Name: "tinkerbell-bmc-custom-payload", + Usage: "The custom payload used in RPC BMC interactions, must be used with tinkerbell-bmc-custom-payload-dot-location", +} + +// TinkerbellBMCCustomPayloadDotLocation is the path to where the bmclib RequestPayload{} will be embedded. For example: object.data.body. +var TinkerbellBMCCustomPayloadDotLocation = Flag[string]{ + Name: "tinkerbell-bmc-custom-payload-dot-location", + Usage: "The dot location of the custom payload used in RPC BMC interactions, must be used with tinkerbell-bmc-custom-payload", +} diff --git a/cmd/eksctl-anywhere/cmd/createcluster.go b/cmd/eksctl-anywhere/cmd/createcluster.go index a549c5ef27874..260f46b03aa6a 100644 --- a/cmd/eksctl-anywhere/cmd/createcluster.go +++ b/cmd/eksctl-anywhere/cmd/createcluster.go @@ -93,6 +93,10 @@ func tinkerbellFlags(fs *pflag.FlagSet, r *hardware.RPCOpts) { aflag.MarkHidden(fs, aflag.TinkerbellBMCPrefixSigDisabled.Name) aflag.StringSlice(aflag.TinkerbellBMCHMACSecrets, &r.HMAC.Secrets, fs) aflag.MarkHidden(fs, aflag.TinkerbellBMCHMACSecrets.Name) + aflag.String(aflag.TinkerbellBMCCustomPayload, &r.Experimental.CustomRequestPayload, fs) + aflag.MarkHidden(fs, aflag.TinkerbellBMCCustomPayload.Name) + aflag.String(aflag.TinkerbellBMCCustomPayloadDotLocation, &r.Experimental.DotPath, fs) + aflag.MarkHidden(fs, aflag.TinkerbellBMCCustomPayloadDotLocation.Name) } func (cc *createClusterOptions) createCluster(cmd *cobra.Command, _ []string) error {