mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-06 05:54:28 -04:00
cli: support StackIT provider on config generate (#1803)
* support stackit provider on config generate * update cli reference * default config values * deploy csi driver Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com> --------- Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
This commit is contained in:
parent
a0dea7e69b
commit
6d5e7e1f7c
6 changed files with 108 additions and 32 deletions
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
func newConfigGenerateCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "generate {aws|azure|gcp|openstack|qemu}",
|
||||
Use: "generate {aws|azure|gcp|openstack|qemu|stackit}",
|
||||
Short: "Generate a default configuration file",
|
||||
Long: "Generate a default configuration file for your selected cloud provider.",
|
||||
Args: cobra.MatchAll(
|
||||
|
@ -61,10 +61,10 @@ func runConfigGenerate(cmd *cobra.Command, args []string) error {
|
|||
fileHandler := file.NewHandler(afero.NewOsFs())
|
||||
provider := cloudprovider.FromString(args[0])
|
||||
cg := &configGenerateCmd{log: log}
|
||||
return cg.configGenerate(cmd, fileHandler, provider)
|
||||
return cg.configGenerate(cmd, fileHandler, provider, args[0])
|
||||
}
|
||||
|
||||
func (cg *configGenerateCmd) configGenerate(cmd *cobra.Command, fileHandler file.Handler, provider cloudprovider.Provider) error {
|
||||
func (cg *configGenerateCmd) configGenerate(cmd *cobra.Command, fileHandler file.Handler, provider cloudprovider.Provider, rawProvider string) error {
|
||||
flags, err := parseGenerateFlags(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -72,7 +72,7 @@ func (cg *configGenerateCmd) configGenerate(cmd *cobra.Command, fileHandler file
|
|||
|
||||
cg.log.Debugf("Parsed flags as %v", flags)
|
||||
cg.log.Debugf("Using cloud provider %s", provider.String())
|
||||
conf, err := createConfigWithAttestationType(provider, flags.attestationVariant)
|
||||
conf, err := createConfigWithAttestationType(provider, rawProvider, flags.attestationVariant)
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating config: %w", err)
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ func (cg *configGenerateCmd) configGenerate(cmd *cobra.Command, fileHandler file
|
|||
}
|
||||
|
||||
// createConfig creates a config file for the given provider.
|
||||
func createConfigWithAttestationType(provider cloudprovider.Provider, attestationVariant variant.Variant) (*config.Config, error) {
|
||||
conf := config.Default()
|
||||
func createConfigWithAttestationType(provider cloudprovider.Provider, rawProvider string, attestationVariant variant.Variant) (*config.Config, error) {
|
||||
conf := config.Default().WithOpenStackProviderDefaults(rawProvider)
|
||||
conf.RemoveProviderExcept(provider)
|
||||
|
||||
// set a lower default for QEMU's state disk
|
||||
|
@ -128,7 +128,8 @@ func createConfigWithAttestationType(provider cloudprovider.Provider, attestatio
|
|||
|
||||
// createConfig creates a config file for the given provider.
|
||||
func createConfig(provider cloudprovider.Provider) *config.Config {
|
||||
res, _ := createConfigWithAttestationType(provider, variant.Dummy{})
|
||||
// rawProvider can be hardcoded as it only matters for OpenStack
|
||||
res, _ := createConfigWithAttestationType(provider, "", variant.Dummy{})
|
||||
return res
|
||||
}
|
||||
|
||||
|
@ -186,7 +187,7 @@ func parseGenerateFlags(cmd *cobra.Command) (generateFlags, error) {
|
|||
func generateCompletion(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
switch len(args) {
|
||||
case 0:
|
||||
return []string{"aws", "gcp", "azure", "qemu"}, cobra.ShellCompDirectiveNoFileComp
|
||||
return []string{"aws", "gcp", "azure", "qemu", "stackit"}, cobra.ShellCompDirectiveNoFileComp
|
||||
default:
|
||||
return []string{}, cobra.ShellCompDirectiveError
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue