-
Notifications
You must be signed in to change notification settings - Fork 26
feat: IBM Cloud support #681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(go list:*)", | ||
| "Bash(curl:*)", | ||
| "Bash(find:*)", | ||
| "Bash(go mod:*)", | ||
| "Bash(go env:*)", | ||
| "Bash(make:*)", | ||
| "Bash(go build:*)" | ||
| ], | ||
| "deny": [], | ||
| "ask": [] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| version: 2 | ||
|
|
||
| run: | ||
| timeout: 20m | ||
| skip-dirs: | ||
| - vendor | ||
| - tools/vendor | ||
| skip-files: | ||
| - pkg/provider/ibmcloud/action/powervs/powervs.go | ||
| concurrency: 1 | ||
|
|
||
| linters-settings: | ||
| govet: | ||
| enable-all: true | ||
|
|
||
| issues: | ||
| exclude-dirs: | ||
| - vendor | ||
| - tools/vendor |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| package hosts | ||
|
|
||
| import ( | ||
| "github.com/redhat-developer/mapt/cmd/mapt/cmd/params" | ||
| maptContext "github.com/redhat-developer/mapt/pkg/manager/context" | ||
| ibmpower "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-power" | ||
| "github.com/spf13/cobra" | ||
| "github.com/spf13/pflag" | ||
| "github.com/spf13/viper" | ||
| ) | ||
|
|
||
| const ( | ||
| cmdIBMPower = "ibm-power" | ||
| cmdIBMPowerDesc = "manage ibm-power machines (ppc64)" | ||
| ) | ||
|
|
||
| func IBMPowerCmd() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: cmdIBMPower, | ||
| Short: cmdIBMPowerDesc, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| flagSet := pflag.NewFlagSet(cmdIBMPower, pflag.ExitOnError) | ||
| params.AddCommonFlags(flagSet) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
|
|
||
| c.AddCommand(ibmPowerCreate(), ibmPowerDestroy()) | ||
| return c | ||
| } | ||
|
|
||
| func ibmPowerCreate() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: params.CreateCmdName, | ||
| Short: params.CreateCmdName, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return ibmpower.New( | ||
| &maptContext.ContextArgs{ | ||
| Context: cmd.Context(), | ||
| ProjectName: viper.GetString(params.ProjectName), | ||
| BackedURL: viper.GetString(params.BackedURL), | ||
| ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), | ||
| Debug: viper.IsSet(params.Debug), | ||
| DebugLevel: viper.GetUint(params.DebugLevel), | ||
| CirrusPWArgs: params.CirrusPersistentWorkerArgs(), | ||
| GHRunnerArgs: params.GithubRunnerArgs(), | ||
| Tags: viper.GetStringMapString(params.Tags), | ||
| }, | ||
| &ibmpower.PWArgs{}) | ||
| }, | ||
| } | ||
| flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError) | ||
| flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc) | ||
| flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc) | ||
| params.AddGHActionsFlags(flagSet) | ||
| params.AddCirrusFlags(flagSet) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
| return c | ||
| } | ||
|
|
||
| func ibmPowerDestroy() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: params.DestroyCmdName, | ||
| Short: params.DestroyCmdName, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return ibmpower.Destroy(&maptContext.ContextArgs{ | ||
| Context: cmd.Context(), | ||
| ProjectName: viper.GetString(params.ProjectName), | ||
| BackedURL: viper.GetString(params.BackedURL), | ||
| Debug: viper.IsSet(params.Debug), | ||
| DebugLevel: viper.GetUint(params.DebugLevel), | ||
| Serverless: viper.IsSet(params.Serverless), | ||
| ForceDestroy: viper.IsSet(params.ForceDestroy), | ||
| }) | ||
| }, | ||
| } | ||
| flagSet := pflag.NewFlagSet(params.DestroyCmdName, pflag.ExitOnError) | ||
| flagSet.Bool(params.Serverless, false, params.ServerlessDesc) | ||
| flagSet.Bool(params.ForceDestroy, false, params.ForceDestroyDesc) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
| return c | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| package hosts | ||
|
|
||
| import ( | ||
| "github.com/redhat-developer/mapt/cmd/mapt/cmd/params" | ||
| maptContext "github.com/redhat-developer/mapt/pkg/manager/context" | ||
| ibmz "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-z" | ||
| "github.com/spf13/cobra" | ||
| "github.com/spf13/pflag" | ||
| "github.com/spf13/viper" | ||
| ) | ||
|
|
||
| const ( | ||
| cmdIBMZ = "ibm-z" | ||
| cmdIBMZDesc = "manage ibm-power machines (s390x)" | ||
| ) | ||
|
|
||
| func IBMZCmd() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: cmdIBMZ, | ||
| Short: cmdIBMZDesc, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| flagSet := pflag.NewFlagSet(cmdIBMZ, pflag.ExitOnError) | ||
| params.AddCommonFlags(flagSet) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
|
|
||
| c.AddCommand(ibmZCreate(), ibmZDestroy()) | ||
| return c | ||
| } | ||
|
|
||
| func ibmZCreate() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: params.CreateCmdName, | ||
| Short: params.CreateCmdName, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return ibmz.New( | ||
| &maptContext.ContextArgs{ | ||
| Context: cmd.Context(), | ||
| ProjectName: viper.GetString(params.ProjectName), | ||
| BackedURL: viper.GetString(params.BackedURL), | ||
| ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), | ||
| Debug: viper.IsSet(params.Debug), | ||
| DebugLevel: viper.GetUint(params.DebugLevel), | ||
| CirrusPWArgs: params.CirrusPersistentWorkerArgs(), | ||
| GHRunnerArgs: params.GithubRunnerArgs(), | ||
| Tags: viper.GetStringMapString(params.Tags), | ||
| }, | ||
| &ibmz.ZArgs{}) | ||
| }, | ||
| } | ||
| flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError) | ||
| flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc) | ||
| flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc) | ||
| params.AddGHActionsFlags(flagSet) | ||
| params.AddCirrusFlags(flagSet) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
| return c | ||
| } | ||
|
|
||
| func ibmZDestroy() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: params.DestroyCmdName, | ||
| Short: params.DestroyCmdName, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return ibmz.Destroy(&maptContext.ContextArgs{ | ||
| Context: cmd.Context(), | ||
| ProjectName: viper.GetString(params.ProjectName), | ||
| BackedURL: viper.GetString(params.BackedURL), | ||
| Debug: viper.IsSet(params.Debug), | ||
| DebugLevel: viper.GetUint(params.DebugLevel), | ||
| Serverless: viper.IsSet(params.Serverless), | ||
| ForceDestroy: viper.IsSet(params.ForceDestroy), | ||
| }) | ||
| }, | ||
| } | ||
| flagSet := pflag.NewFlagSet(params.DestroyCmdName, pflag.ExitOnError) | ||
| flagSet.Bool(params.Serverless, false, params.ServerlessDesc) | ||
| flagSet.Bool(params.ForceDestroy, false, params.ForceDestroyDesc) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
| return c | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package ibmcloud | ||
|
|
||
| import ( | ||
| "github.com/redhat-developer/mapt/cmd/mapt/cmd/ibmcloud/hosts" | ||
| params "github.com/redhat-developer/mapt/cmd/mapt/cmd/params" | ||
| "github.com/spf13/cobra" | ||
| "github.com/spf13/pflag" | ||
| "github.com/spf13/viper" | ||
| ) | ||
|
|
||
| const ( | ||
| cmd = "ibmcloud" | ||
| cmdDesc = "ibmcloud operations" | ||
| ) | ||
|
|
||
| func GetCmd() *cobra.Command { | ||
| c := &cobra.Command{ | ||
| Use: cmd, | ||
| Short: cmdDesc, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if err := viper.BindPFlags(cmd.Flags()); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| flagSet := pflag.NewFlagSet(cmd, pflag.ExitOnError) | ||
| params.AddCommonFlags(flagSet) | ||
| c.PersistentFlags().AddFlagSet(flagSet) | ||
| c.AddCommand( | ||
| hosts.IBMPowerCmd(), | ||
| hosts.IBMZCmd()) | ||
| return c | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| # Overview | ||||||
|
|
||||||
| This actions will handle provision Ubuntu ppc64 machines on ibm cloud power vs. | ||||||
|
|
||||||
|
|
||||||
| ## Create | ||||||
|
|
||||||
| ```bash | ||||||
| mapt ibmcloud ibm-power z create -h | ||||||
| create | ||||||
|
|
||||||
| Usage: | ||||||
| mapt ibmcloud ibm-power create [flags] | ||||||
|
|
||||||
| Flags: | ||||||
| --conn-details-output string path to export host connection information (host, username and privateKey) | ||||||
| --ghactions-runner-labels strings List of labels separated by comma to be added to the self-hosted runner | ||||||
| --ghactions-runner-repo string Full URL of the repository where the Github Actions Runner should be registered | ||||||
| --ghactions-runner-token string Token needed for registering the Github Actions Runner token | ||||||
| -h, --help help for create | ||||||
| --it-cirrus-pw-labels stringToString additional labels to use on the persistent worker (--it-cirrus-pw-labels key1=value1,key2=value2) (default []) | ||||||
| --it-cirrus-pw-token string Add mapt target as a cirrus persistent worker. The value will hold a valid token to be used by cirrus cli to join the project. | ||||||
| --tags stringToString tags to add on each resource (--tags name1=value1,name2=value2) (default []) | ||||||
|
|
||||||
| Global Flags: | ||||||
| --backed-url string backed for stack state. (local) file:///path/subpath (s3) s3://existing-bucket, (azure) azblob://existing-blobcontainer. See more https://www.pulumi.com/docs/iac/concepts/state-and-backends/#using-a-self-managed-backend | ||||||
| --debug Enable debug traces and set verbosity to max. Typically to get information to troubleshooting an issue. | ||||||
| --debug-level uint Set the level of verbosity on debug. You can set from minimum 1 to max 9. (default 3) | ||||||
| --project-name string project name to identify the instance of the stack | ||||||
| ``` | ||||||
|
|
||||||
| ### Outputs | ||||||
|
|
||||||
| * It will crete an instance and will give as result several files located at path defined by `--conn-details-output`: | ||||||
|
|
||||||
| * **host**: host for the Windows machine (lb if spot) | ||||||
| * **username**: username to connect to the machine | ||||||
| * **id_rsa**: private key to connect to machine | ||||||
|
|
||||||
| * Also, it will create a state folder holding the state for the created resources at azure, the path for this folder is defined within `--backed-url`, the content from that folder it is required with the same project name (`--project-name`) in order to destroy the resources. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I store state in S3 or is Azure needed?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realized yesterday IBM has a storage containter service which is S3 interface compatible so we can use the s3 backed url and the IBM storage (s3 alike). The thing is to setup access the ENVs pulumi expects are AWS_... which could mislead .. I am thinking to create our own S3_...envs... for the backed ...then for aws if S3 envs will be set those will take precedence over AWS_... and for IBM those will be the ones use to set the access WDYT? |
||||||
|
|
||||||
| ### Container | ||||||
|
|
||||||
| ```bash | ||||||
| podman run -d --name ibm-power \ | ||||||
| -v ${PWD}:/workspace:z \ | ||||||
| -e IBMCLOUD_ACCOUNT=XXX \ | ||||||
| -e IBMCLOUD_API_KEY=XXX \ | ||||||
| -e IC_REGION=us-south \ | ||||||
| -e IC_ZONE=dal12 \ # power vs use this notation | ||||||
| quay.io/redhat-developer/mapt:1.0.0 ibm-power create \ | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --project-name ibm-power \ | ||||||
| --backed-url file:///workspace \ | ||||||
| --conn-details-output /workspace | ||||||
| ``` | ||||||
Uh oh!
There was an error while loading. Please reload this page.