Skip to content

Commit b9efc9c

Browse files
committed
feat: IBM Cloud Support
Signed-off-by: Adrian Riobo <ariobolo@redhat.com>
1 parent c6d5174 commit b9efc9c

File tree

2,285 files changed

+991075
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,285 files changed

+991075
-5
lines changed

.claude/settings.local.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(go list:*)",
5+
"Bash(curl:*)",
6+
"Bash(find:*)",
7+
"Bash(go mod:*)",
8+
"Bash(go env:*)",
9+
"Bash(make:*)",
10+
"Bash(go build:*)"
11+
],
12+
"deny": [],
13+
"ask": []
14+
}
15+
}

.golangci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
3+
run:
4+
timeout: 20m
5+
skip-dirs:
6+
- vendor
7+
- tools/vendor
8+
skip-files:
9+
- pkg/provider/ibmcloud/action/powervs/powervs.go
10+
concurrency: 1
11+
12+
linters-settings:
13+
govet:
14+
enable-all: true
15+
16+
issues:
17+
exclude-dirs:
18+
- vendor
19+
- tools/vendor

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ build: $(BUILD_DIR)/mapt
7575

7676
.PHONY: test
7777
test:
78+
GOMAXPROCS=1 CGO_ENABLED=1 go test -p 1 --tags build -v -ldflags="$(VERSION_VARIABLES)" ./pkg/... ./cmd/... -skip github.com/mapt-oss/pulumi-ibmcloud/sdk/go/...
79+
80+
.PHONY: test-race
81+
test-race:
7882
CGO_ENABLED=1 go test -race --tags build -v -ldflags="$(VERSION_VARIABLES)" ./pkg/... ./cmd/...
7983

8084
.PHONY: clean ## Remove all build artifacts
@@ -89,7 +93,7 @@ fmt:
8993
# Run golangci-lint against code
9094
.PHONY: lint
9195
lint: $(TOOLS_BINDIR)/golangci-lint
92-
"$(TOOLS_BINDIR)"/golangci-lint run -v --timeout 10m
96+
"$(TOOLS_BINDIR)"/golangci-lint run -v --timeout 20m --skip-dirs vendor
9397

9498
# Build the container image
9599
.PHONY: oci-build
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package hosts
2+
3+
import (
4+
"github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
5+
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
6+
ibmpower "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-power"
7+
"github.com/spf13/cobra"
8+
"github.com/spf13/pflag"
9+
"github.com/spf13/viper"
10+
)
11+
12+
const (
13+
cmdIBMPower = "ibm-power"
14+
cmdIBMPowerDesc = "manage ibm-power machines (ppc64)"
15+
)
16+
17+
func IBMPowerCmd() *cobra.Command {
18+
c := &cobra.Command{
19+
Use: cmdIBMPower,
20+
Short: cmdIBMPowerDesc,
21+
RunE: func(cmd *cobra.Command, args []string) error {
22+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
23+
return err
24+
}
25+
return nil
26+
},
27+
}
28+
29+
flagSet := pflag.NewFlagSet(cmdIBMPower, pflag.ExitOnError)
30+
params.AddCommonFlags(flagSet)
31+
c.PersistentFlags().AddFlagSet(flagSet)
32+
33+
c.AddCommand(ibmPowerCreate(), ibmPowerDestroy())
34+
return c
35+
}
36+
37+
func ibmPowerCreate() *cobra.Command {
38+
c := &cobra.Command{
39+
Use: params.CreateCmdName,
40+
Short: params.CreateCmdName,
41+
RunE: func(cmd *cobra.Command, args []string) error {
42+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
43+
return err
44+
}
45+
return ibmpower.New(
46+
&maptContext.ContextArgs{
47+
Context: cmd.Context(),
48+
ProjectName: viper.GetString(params.ProjectName),
49+
BackedURL: viper.GetString(params.BackedURL),
50+
ResultsOutput: viper.GetString(params.ConnectionDetailsOutput),
51+
Debug: viper.IsSet(params.Debug),
52+
DebugLevel: viper.GetUint(params.DebugLevel),
53+
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
54+
GHRunnerArgs: params.GithubRunnerArgs(),
55+
Tags: viper.GetStringMapString(params.Tags),
56+
},
57+
&ibmpower.PWArgs{})
58+
},
59+
}
60+
flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError)
61+
flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc)
62+
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
63+
params.AddGHActionsFlags(flagSet)
64+
params.AddCirrusFlags(flagSet)
65+
c.PersistentFlags().AddFlagSet(flagSet)
66+
return c
67+
}
68+
69+
func ibmPowerDestroy() *cobra.Command {
70+
c := &cobra.Command{
71+
Use: params.DestroyCmdName,
72+
Short: params.DestroyCmdName,
73+
RunE: func(cmd *cobra.Command, args []string) error {
74+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
75+
return err
76+
}
77+
return ibmpower.Destroy(&maptContext.ContextArgs{
78+
Context: cmd.Context(),
79+
ProjectName: viper.GetString(params.ProjectName),
80+
BackedURL: viper.GetString(params.BackedURL),
81+
Debug: viper.IsSet(params.Debug),
82+
DebugLevel: viper.GetUint(params.DebugLevel),
83+
Serverless: viper.IsSet(params.Serverless),
84+
ForceDestroy: viper.IsSet(params.ForceDestroy),
85+
})
86+
},
87+
}
88+
flagSet := pflag.NewFlagSet(params.DestroyCmdName, pflag.ExitOnError)
89+
flagSet.Bool(params.Serverless, false, params.ServerlessDesc)
90+
flagSet.Bool(params.ForceDestroy, false, params.ForceDestroyDesc)
91+
c.PersistentFlags().AddFlagSet(flagSet)
92+
return c
93+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package hosts
2+
3+
import (
4+
"github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
5+
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
6+
ibmz "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-z"
7+
"github.com/spf13/cobra"
8+
"github.com/spf13/pflag"
9+
"github.com/spf13/viper"
10+
)
11+
12+
const (
13+
cmdIBMZ = "ibm-z"
14+
cmdIBMZDesc = "manage ibm-power machines (s390x)"
15+
)
16+
17+
func IBMZCmd() *cobra.Command {
18+
c := &cobra.Command{
19+
Use: cmdIBMZ,
20+
Short: cmdIBMZDesc,
21+
RunE: func(cmd *cobra.Command, args []string) error {
22+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
23+
return err
24+
}
25+
return nil
26+
},
27+
}
28+
29+
flagSet := pflag.NewFlagSet(cmdIBMZ, pflag.ExitOnError)
30+
params.AddCommonFlags(flagSet)
31+
c.PersistentFlags().AddFlagSet(flagSet)
32+
33+
c.AddCommand(ibmZCreate(), ibmZDestroy())
34+
return c
35+
}
36+
37+
func ibmZCreate() *cobra.Command {
38+
c := &cobra.Command{
39+
Use: params.CreateCmdName,
40+
Short: params.CreateCmdName,
41+
RunE: func(cmd *cobra.Command, args []string) error {
42+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
43+
return err
44+
}
45+
return ibmz.New(
46+
&maptContext.ContextArgs{
47+
Context: cmd.Context(),
48+
ProjectName: viper.GetString(params.ProjectName),
49+
BackedURL: viper.GetString(params.BackedURL),
50+
ResultsOutput: viper.GetString(params.ConnectionDetailsOutput),
51+
Debug: viper.IsSet(params.Debug),
52+
DebugLevel: viper.GetUint(params.DebugLevel),
53+
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
54+
GHRunnerArgs: params.GithubRunnerArgs(),
55+
Tags: viper.GetStringMapString(params.Tags),
56+
},
57+
&ibmz.ZArgs{})
58+
},
59+
}
60+
flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError)
61+
flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc)
62+
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
63+
params.AddGHActionsFlags(flagSet)
64+
params.AddCirrusFlags(flagSet)
65+
c.PersistentFlags().AddFlagSet(flagSet)
66+
return c
67+
}
68+
69+
func ibmZDestroy() *cobra.Command {
70+
c := &cobra.Command{
71+
Use: params.DestroyCmdName,
72+
Short: params.DestroyCmdName,
73+
RunE: func(cmd *cobra.Command, args []string) error {
74+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
75+
return err
76+
}
77+
return ibmz.Destroy(&maptContext.ContextArgs{
78+
Context: cmd.Context(),
79+
ProjectName: viper.GetString(params.ProjectName),
80+
BackedURL: viper.GetString(params.BackedURL),
81+
Debug: viper.IsSet(params.Debug),
82+
DebugLevel: viper.GetUint(params.DebugLevel),
83+
Serverless: viper.IsSet(params.Serverless),
84+
ForceDestroy: viper.IsSet(params.ForceDestroy),
85+
})
86+
},
87+
}
88+
flagSet := pflag.NewFlagSet(params.DestroyCmdName, pflag.ExitOnError)
89+
flagSet.Bool(params.Serverless, false, params.ServerlessDesc)
90+
flagSet.Bool(params.ForceDestroy, false, params.ForceDestroyDesc)
91+
c.PersistentFlags().AddFlagSet(flagSet)
92+
return c
93+
}

cmd/mapt/cmd/ibmcloud/ibmcloud.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package ibmcloud
2+
3+
import (
4+
"github.com/redhat-developer/mapt/cmd/mapt/cmd/ibmcloud/hosts"
5+
params "github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
6+
"github.com/spf13/cobra"
7+
"github.com/spf13/pflag"
8+
"github.com/spf13/viper"
9+
)
10+
11+
const (
12+
cmd = "ibmcloud"
13+
cmdDesc = "ibmcloud operations"
14+
)
15+
16+
func GetCmd() *cobra.Command {
17+
c := &cobra.Command{
18+
Use: cmd,
19+
Short: cmdDesc,
20+
RunE: func(cmd *cobra.Command, args []string) error {
21+
if err := viper.BindPFlags(cmd.Flags()); err != nil {
22+
return err
23+
}
24+
return nil
25+
},
26+
}
27+
28+
flagSet := pflag.NewFlagSet(cmd, pflag.ExitOnError)
29+
params.AddCommonFlags(flagSet)
30+
c.PersistentFlags().AddFlagSet(flagSet)
31+
c.AddCommand(
32+
hosts.IBMPowerCmd(),
33+
hosts.IBMZCmd())
34+
return c
35+
}

cmd/mapt/cmd/root.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"syscall"
1111
"github.com/redhat-developer/mapt/cmd/mapt/cmd/aws"
1212
"github.com/redhat-developer/mapt/cmd/mapt/cmd/azure"
13+
"github.com/redhat-developer/mapt/cmd/mapt/cmd/ibmcloud"
1314
"github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
1415
"github.com/redhat-developer/mapt/pkg/util/logging"
1516
"github.com/spf13/cobra"
@@ -61,7 +62,8 @@ func init() {
6162
// Subcommands
6263
rootCmd.AddCommand(
6364
aws.GetCmd(),
64-
azure.GetCmd())
65+
azure.GetCmd(),
66+
ibmcloud.GetCmd())
6567
}
6668

6769
func Execute() {

go.mod

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.24.7
44

55
require (
66
github.com/coocood/freecache v1.2.4
7+
github.com/mapt-oss/pulumi-ibmcloud/sdk v0.0.9
78
github.com/pulumi/pulumi-command/sdk v1.1.3
89
github.com/pulumi/pulumi-random/sdk/v4 v4.18.4
910
github.com/pulumi/pulumi/sdk/v3 v3.210.0
@@ -17,6 +18,7 @@ require (
1718
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7 v7.2.0
1819
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0
1920
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0
21+
github.com/IBM/go-sdk-core/v5 v5.21.2
2022
github.com/aws/amazon-ec2-instance-selector/v3 v3.1.2
2123
github.com/aws/aws-sdk-go-v2 v1.41.0
2224
github.com/aws/aws-sdk-go-v2/config v1.32.4
@@ -70,6 +72,7 @@ require (
7072
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
7173
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.2.0 // indirect
7274
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
75+
github.com/IBM/platform-services-go-sdk v0.81.0 // indirect
7376
github.com/agext/levenshtein v1.2.3 // indirect
7477
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
7578
github.com/atotto/clipboard v0.1.4 // indirect
@@ -100,20 +103,37 @@ require (
100103
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
101104
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
102105
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
106+
github.com/go-logr/logr v1.4.3 // indirect
107+
github.com/go-logr/stdr v1.2.2 // indirect
108+
github.com/go-openapi/analysis v0.23.0 // indirect
109+
github.com/go-openapi/errors v0.22.4 // indirect
110+
github.com/go-openapi/jsonpointer v0.21.1 // indirect
111+
github.com/go-openapi/jsonreference v0.21.0 // indirect
112+
github.com/go-openapi/loads v0.22.0 // indirect
113+
github.com/go-openapi/runtime v0.28.0 // indirect
114+
github.com/go-openapi/spec v0.21.0 // indirect
115+
github.com/go-openapi/strfmt v0.25.0 // indirect
116+
github.com/go-openapi/swag v0.23.1 // indirect
117+
github.com/go-openapi/validate v0.24.0 // indirect
103118
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
104119
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
105120
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
106121
github.com/google/uuid v1.6.0 // indirect
122+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
123+
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
107124
github.com/iwdgo/sigintwindows v0.2.2 // indirect
125+
github.com/josharian/intern v1.0.0 // indirect
108126
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
109127
github.com/kylelemons/godebug v1.1.0 // indirect
110128
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
129+
github.com/mailru/easyjson v0.9.0 // indirect
111130
github.com/mattn/go-isatty v0.0.20 // indirect
112131
github.com/mattn/go-localereader v0.0.1 // indirect
113132
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
114133
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
115134
github.com/muesli/cancelreader v0.2.2 // indirect
116135
github.com/muesli/termenv v0.16.0 // indirect
136+
github.com/oklog/ulid v1.3.1 // indirect
117137
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
118138
github.com/pgavlin/fx v0.1.6 // indirect
119139
github.com/pjbgf/sha1cd v0.5.0 // indirect
@@ -129,15 +149,24 @@ require (
129149
github.com/subosito/gotenv v1.6.0 // indirect
130150
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
131151
github.com/zclconf/go-cty v1.17.0 // indirect
152+
go.mongodb.org/mongo-driver v1.17.6 // indirect
153+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
154+
go.opentelemetry.io/otel v1.38.0 // indirect
155+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
156+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
132157
go.uber.org/multierr v1.11.0 // indirect
158+
go.yaml.in/yaml/v2 v2.4.3 // indirect
133159
go.yaml.in/yaml/v3 v3.0.4 // indirect
134160
golang.org/x/sync v0.19.0 // indirect
135161
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
136162
gopkg.in/yaml.v3 v3.0.1 // indirect
163+
sigs.k8s.io/yaml v1.6.0 // indirect
137164
)
138165

139166
require (
140167
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0
168+
github.com/IBM-Cloud/power-go-client v1.14.3
169+
github.com/IBM/vpc-go-sdk v0.76.1
141170
github.com/Microsoft/go-winio v0.6.2 // indirect
142171
github.com/ProtonMail/go-crypto v1.3.0 // indirect
143172
github.com/aws/aws-sdk-go-v2/service/ecs v1.69.4

0 commit comments

Comments
 (0)