mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-22 06:50:43 -04:00
cli: add config kubernetes-versions
subcommand (#1224)
Allows users to learn which k8s versions are supported by the current CLI. Extend respective docs section.
This commit is contained in:
parent
ce09b9dae5
commit
d78d22f95a
5 changed files with 49 additions and 10 deletions
|
@ -23,6 +23,7 @@ func NewConfigCmd() *cobra.Command {
|
|||
cmd.AddCommand(newConfigGenerateCmd())
|
||||
cmd.AddCommand(newConfigFetchMeasurementsCmd())
|
||||
cmd.AddCommand(newConfigInstanceTypesCmd())
|
||||
cmd.AddCommand(newConfigKubernetesVersionsCmd())
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
34
cli/internal/cmd/configkubernetesversions.go
Normal file
34
cli/internal/cmd/configkubernetesversions.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/versions"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newConfigKubernetesVersionsCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "kubernetes-versions",
|
||||
Short: "Print the Kubernetes versions supported by this CLI",
|
||||
Long: "Print the Kubernetes versions supported by this CLI.",
|
||||
Args: cobra.ArbitraryArgs,
|
||||
Run: printSupportedKubernetesVersions,
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func printSupportedKubernetesVersions(cmd *cobra.Command, args []string) {
|
||||
cmd.Printf("Supported Kubernetes Versions:\n\t%s\n", formatKubernetesVersions())
|
||||
}
|
||||
|
||||
func formatKubernetesVersions() string {
|
||||
return strings.Join(versions.SupportedK8sVersions(), "\n\t")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue