-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7180f93
commit c3a7514
Showing
42 changed files
with
1,424 additions
and
503 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
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,50 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build !nok8s | ||
|
||
package kubernetes | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/uyuni-project/uyuni-tools/mgradm/cmd/install/shared" | ||
cmd_utils "github.com/uyuni-project/uyuni-tools/mgradm/shared/utils" | ||
. "github.com/uyuni-project/uyuni-tools/shared/l10n" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
"github.com/uyuni-project/uyuni-tools/shared/utils" | ||
) | ||
|
||
type kubernetesInstallFlags struct { | ||
shared.InstallFlags `mapstructure:",squash"` | ||
Helm cmd_utils.HelmFlags | ||
} | ||
|
||
// NewCommand for kubernetes installation. | ||
func NewCommand(globalFlags *types.GlobalFlags) *cobra.Command { | ||
kubernetesCmd := &cobra.Command{ | ||
Use: "kubernetes", | ||
Short: L("Install a PTF or Test package on a kubernetes cluster"), | ||
Long: L(`Install a PTR of Test package on a kubernetes cluster | ||
The support ptf command assumes the following: | ||
* kubectl and helm are installed locally | ||
* a working kubectl configuration should be set to connect to the cluster to deploy to | ||
The helm values file will be overridden with the values from the command parameters or configuration. | ||
NOTE: installing on a remote cluster is not supported yet! | ||
`), | ||
|
||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
var flags kubernetesInstallFlags | ||
return utils.CommandHelper(globalFlags, cmd, args, &flags, ptfForKubernetes) | ||
}, | ||
} | ||
|
||
shared.AddInstallFlags(kubernetesCmd) | ||
cmd_utils.AddHelmInstallFlag(kubernetesCmd) | ||
|
||
return kubernetesCmd | ||
} |
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,16 @@ | ||
// SPDX-FileCopyrightText: 2023 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build nok8s | ||
|
||
package kubernetes | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
) | ||
|
||
func NewCommand(globalFlags *types.GlobalFlags) *cobra.Command { | ||
return nil | ||
} |
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,23 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build !nok8s | ||
|
||
package kubernetes | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/spf13/cobra" | ||
. "github.com/uyuni-project/uyuni-tools/shared/l10n" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
) | ||
|
||
func ptfForKubernetes(globalFlags *types.GlobalFlags, | ||
flags *kubernetesInstallFlags, | ||
cmd *cobra.Command, | ||
args []string, | ||
) error { | ||
return errors.New(L("PTF command for kubernetes is not implemented yet")) | ||
} |
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 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package podman | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
mgradm_utils "github.com/uyuni-project/uyuni-tools/mgradm/shared/utils" | ||
. "github.com/uyuni-project/uyuni-tools/shared/l10n" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
"github.com/uyuni-project/uyuni-tools/shared/utils" | ||
) | ||
|
||
type podmanPTFFlags struct { | ||
Image types.ImageFlags `mapstructure:",squash"` | ||
PTFId string `mapstructure:"ptf"` | ||
TestId string `mapstructure:"ptf"` | ||
} | ||
|
||
// NewCommand for podman installation. | ||
func NewCommand(globalFlags *types.GlobalFlags) *cobra.Command { | ||
podmanCmd := &cobra.Command{ | ||
Use: "podman", | ||
|
||
Short: L("install a PTF or Test package on podman"), | ||
Long: L(`Install a PTF or Test package on podman | ||
The support ptf podman command assumes podman is installed locally and | ||
the host machine is register to SCC. | ||
NOTE: for now installing on a remote podman is not supported! | ||
`), | ||
Args: cobra.MaximumNArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
var flags podmanPTFFlags | ||
return utils.CommandHelper(globalFlags, cmd, args, &flags, ptfForPodman) | ||
}, | ||
} | ||
|
||
mgradm_utils.AddImageFlag(podmanCmd) | ||
|
||
return podmanCmd | ||
} |
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,23 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package podman | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/uyuni-project/uyuni-tools/mgradm/shared/podman" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
) | ||
|
||
func ptfForPodman( | ||
globalFlags *types.GlobalFlags, | ||
flags *podmanPTFFlags, | ||
cmd *cobra.Command, | ||
args []string, | ||
) error { | ||
//we don't want to perform a postgres version upgrade when installing a PTF. | ||
//in that case, we can use the upgrade command. | ||
dummyMigration := types.ImageFlags{} | ||
return podman.Upgrade(flags.Image, dummyMigration, args) | ||
} |
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,32 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package ptf | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/uyuni-project/uyuni-tools/mgradm/cmd/support/ptf/kubernetes" | ||
"github.com/uyuni-project/uyuni-tools/mgradm/cmd/support/ptf/podman" | ||
. "github.com/uyuni-project/uyuni-tools/shared/l10n" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
"github.com/uyuni-project/uyuni-tools/shared/utils" | ||
) | ||
|
||
// NewCommand is the command for creates supportptf. | ||
func NewCommand(globalFlags *types.GlobalFlags) *cobra.Command { | ||
ptfCmd := &cobra.Command{ | ||
Use: "ptf", | ||
Short: L("install a PTF"), | ||
} | ||
|
||
utils.AddBackendFlag(ptfCmd) | ||
|
||
ptfCmd.AddCommand(podman.NewCommand(globalFlags)) | ||
|
||
if kubernetesCmd := kubernetes.NewCommand(globalFlags); kubernetesCmd != nil { | ||
ptfCmd.AddCommand(kubernetesCmd) | ||
} | ||
|
||
return ptfCmd | ||
} |
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.