mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-06 05:54:28 -04:00
cli: move helm and terraform out of kubernetes package (#2222)
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
f270e91724
commit
ed0bfd9d41
10 changed files with 370 additions and 376 deletions
|
@ -7,6 +7,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -23,3 +27,31 @@ func NewUpgradeCmd() *cobra.Command {
|
|||
cmd.AddCommand(newUpgradeApplyCmd())
|
||||
return cmd
|
||||
}
|
||||
|
||||
// upgradeCmdKind is the kind of the upgrade command (check, apply).
|
||||
type upgradeCmdKind int
|
||||
|
||||
const (
|
||||
// upgradeCmdKindCheck corresponds to the upgrade check command.
|
||||
upgradeCmdKindCheck upgradeCmdKind = iota
|
||||
// upgradeCmdKindApply corresponds to the upgrade apply command.
|
||||
upgradeCmdKindApply
|
||||
// upgradeCmdKindIAM corresponds to the IAM upgrade command.
|
||||
upgradeCmdKindIAM
|
||||
)
|
||||
|
||||
func generateUpgradeID(kind upgradeCmdKind) string {
|
||||
upgradeID := time.Now().Format("20060102150405") + "-" + strings.Split(uuid.New().String(), "-")[0]
|
||||
switch kind {
|
||||
case upgradeCmdKindCheck:
|
||||
// When performing an upgrade check, the upgrade directory will only be used temporarily to store the
|
||||
// Terraform state. The directory is deleted after the check is finished.
|
||||
// Therefore, add a tmp-suffix to the upgrade ID to indicate that the directory will be cleared after the check.
|
||||
upgradeID = "upgrade-" + upgradeID + "-tmp"
|
||||
case upgradeCmdKindApply:
|
||||
upgradeID = "upgrade-" + upgradeID
|
||||
case upgradeCmdKindIAM:
|
||||
upgradeID = "iam-" + upgradeID
|
||||
}
|
||||
return upgradeID
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue