-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plumb bmc options through from cli to provider:
Adds cli flags for all bmc options. The flags are hidden by default but the cli mechanism we use also makes them available as env vars. The dependencies factory is updated with a new func parameter for provider options that will allow future modifications without breaking the fn signature. the cmd/eksctl-anywhere/cmd/flags pkg was renamed to be singular. It was named similar to the pflags library but with "a" for anywhere. The csv reader was modified to take in bmc options so that the options can be added during a Read. Signed-off-by: Jacob Weinstock <[email protected]>
- Loading branch information
1 parent
02d6225
commit 1a49735
Showing
29 changed files
with
364 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Package aflag is the eks anywhere flag handling package. | ||
package aflag | ||
|
||
import "github.com/spf13/pflag" | ||
|
||
// Flag defines a CLI flag. | ||
type Flag[T any] struct { | ||
Name string | ||
Short string | ||
Usage string | ||
Default T | ||
} | ||
|
||
// String applies f to fs and writes the value to dst. | ||
func String(f Flag[string], dst *string, fs *pflag.FlagSet) { | ||
switch { | ||
// With short form | ||
case f.Short != "": | ||
fs.StringVarP(dst, f.Name, f.Short, f.Default, f.Usage) | ||
// Without short form | ||
default: | ||
fs.StringVar(dst, f.Name, f.Default, f.Usage) | ||
} | ||
} | ||
|
||
// Bool applies f to fs and writes the value to dst. | ||
func Bool(f Flag[bool], dst *bool, fs *pflag.FlagSet) { | ||
switch { | ||
case f.Short != "": | ||
fs.BoolVarP(dst, f.Name, f.Short, f.Default, f.Usage) | ||
default: | ||
fs.BoolVar(dst, f.Name, f.Default, f.Usage) | ||
} | ||
} | ||
|
||
// StringSlice applies f to fs and writes the value to dst. | ||
func StringSlice(f Flag[[]string], dst *[]string, fs *pflag.FlagSet) { | ||
switch { | ||
case f.Short != "": | ||
fs.StringSliceVarP(dst, f.Name, f.Short, f.Default, f.Usage) | ||
default: | ||
fs.StringSliceVar(dst, f.Name, f.Default, f.Usage) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
cmd/eksctl-anywhere/cmd/flags/cluster.go → cmd/eksctl-anywhere/cmd/aflag/cluster.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package aflag | ||
|
||
// TinkerbellBootstrapIP is used to override the Tinkerbell IP for serving a Tinkerbell stack | ||
// from an admin machine. | ||
var TinkerbellBootstrapIP = Flag[string]{ | ||
Name: "tinkerbell-bootstrap-ip", | ||
Usage: "The IP used to expose the Tinkerbell stack from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCConsumerURL is a Rufio RPC provider option. | ||
var TinkerbellBMCConsumerURL = Flag[string]{ | ||
Name: "tinkerbell-bmc-consumer-url", | ||
Usage: "The URL used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCHTTPContentType is a Rufio RPC provider option. | ||
var TinkerbellBMCHTTPContentType = Flag[string]{ | ||
Name: "tinkerbell-bmc-http-content-type", | ||
Usage: "The HTTP content type used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCHTTPMethod is a Rufio RPC provider option. | ||
var TinkerbellBMCHTTPMethod = Flag[string]{ | ||
Name: "tinkerbell-bmc-http-method", | ||
Usage: "The HTTP method used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCTimestampHeader is a Rufio RPC provider option. | ||
var TinkerbellBMCTimestampHeader = Flag[string]{ | ||
Name: "tinkerbell-bmc-timestamp-header", | ||
Usage: "The HTTP timestamp header used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCStaticHeaders is a Rufio RPC provider option. | ||
var TinkerbellBMCStaticHeaders = Flag[string]{ | ||
Name: "tinkerbell-bmc-static-headers", | ||
Usage: "The HTTP static headers used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCHeaderName is a Rufio RPC provider option. | ||
var TinkerbellBMCHeaderName = Flag[string]{ | ||
Name: "tinkerbell-bmc-header-name", | ||
Usage: "The HTTP header name used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCAppendAlgoToHeaderDisabled is a Rufio RPC provider option. | ||
var TinkerbellBMCAppendAlgoToHeaderDisabled = Flag[bool]{ | ||
Name: "tinkerbell-bmc-append-algo-to-header-disabled", | ||
Usage: "The HTTP append algo to header disabled used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCIncludedPayloadHeaders is a Rufio RPC provider option. | ||
var TinkerbellBMCIncludedPayloadHeaders = Flag[[]string]{ | ||
Name: "tinkerbell-bmc-included-payload-headers", | ||
Usage: "The HTTP included payload headers used to expose the Tinkerbell BMC consumer from the bootstrap cluster. If you specify a Timestamp header, it must be included here.", | ||
} | ||
|
||
// TinkerbellBMCPrefixSigDisabled is a Rufio RPC provider option. | ||
var TinkerbellBMCPrefixSigDisabled = Flag[bool]{ | ||
Name: "tinkerbell-bmc-prefix-sig-disabled", | ||
Usage: "The HTTP prefix sig disabled used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} | ||
|
||
// TinkerbellBMCWebhookSecrets is a Rufio RPC provider option. | ||
var TinkerbellBMCWebhookSecrets = Flag[[]string]{ | ||
Name: "tinkerbell-bmc-webhook-secrets", | ||
Usage: "The webhook secrets used to expose the Tinkerbell BMC consumer from the bootstrap cluster", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.