Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 0 additions & 7 deletions .claude/settings.local.json

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ manifest.json
ami-id
Pulumi*.yaml
/tools/bin/**
!/tools/bin/.gitkeep
!/tools/bin/.gitkeep
.claude/settings.local.json
19 changes: 17 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
version: "2"

run:
timeout: 10m
timeout: 20m
skip-dirs:
- vendor
- tools/vendor
skip-files:
- pkg/provider/ibmcloud/action/powervs/powervs.go
concurrency: 1

linters:
disable:
- govet
- govet

linters-settings:
govet:
enable-all: true

issues:
exclude-dirs:
- vendor
- tools/vendor
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ build: $(BUILD_DIR)/mapt

.PHONY: test
test:
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/...

.PHONY: test-race
test-race:
CGO_ENABLED=1 go test -race --tags build -v -ldflags="$(VERSION_VARIABLES)" ./pkg/... ./cmd/...

.PHONY: clean ## Remove all build artifacts
Expand All @@ -94,12 +98,11 @@ fmt:
# Run golangci-lint against code
.PHONY: lint
lint: $(TOOLS_BINDIR)/golangci-lint
"$(TOOLS_BINDIR)"/golangci-lint run -v
"$(TOOLS_BINDIR)"/golangci-lint run -v --skip-dirs vendor

.PHONY: renovate-check
renovate-check:
${CONTAINER_MANAGER} run --rm -v ${PWD}:/repo docker.io/renovate/renovate:latest renovate-config-validator /repo/renovate.json


# Build the container image
.PHONY: oci-build
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ Instances can be wrapped on specific topologies like airgap, in this case mapt w

Instances can also define a timeout to avoid leftovers in case destoy operation is missing. Using this approach mapt will be execute as an unateneded execution using servless technologies.

[MacOS](docs/aws/mac.md)-[Windows Server](docs/aws/windows.md)-[Windows Desktop](docs/azure/windows.md)-[RHEL](docs/aws/rhel.md)-[Fedora](docs/azure/fedora.md)-[Ubuntu](docs/azure/ubuntu.md)
[MacOS](docs/aws/mac.md) - [Windows Server](docs/aws/windows.md) - [Windows Desktop](docs/azure/windows.md) - [RHEL](docs/aws/rhel.md) - [Fedora](docs/azure/fedora.md) - [Ubuntu](docs/azure/ubuntu.md)

### Services

Mapt offers some managed services boosted with some of the features from the instances offerings (i.e spot) and also create some ad hoc services on top the instances offerings to improve reutilization of instances when there is no easy way to do it (i.e. Mac-Pool).

[AKS](docs/azure/aks.md)-[EKS](docs/aws/eks.md)-[Mac-Pool](docs/aws/mac-pool.md) - [OpenShift-SNC](docs/aws/openshift-snc.md) - [Kind](docs/aws/openshift-snc.md)
[AKS](docs/azure/aks.md) - [EKS](docs/aws/eks.md) - [Mac-Pool](docs/aws/mac-pool.md) - [OpenShift-SNC](docs/aws/openshift-snc.md) - [Kind](docs/aws/openshift-snc.md)

### Architectures

x86 and arm64 archs can be provisioned through any of the previous targets based on parameters.

In addition we can provision

[s390x](docs/ibmcloud/ibm-z.md) - [ppc64](docs/ibmcloud/ibm-power.mdS)


### Integrations

Currently each target offered by Mapt can be added as:
The integrations allow to provision the machine and link to different CI/CD systems based on their native integrations.

* [Github Self Hosted Runner](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners)
* [Cirrus Persistent Worker](https://cirrus-ci.org/guide/persistent-workers/)
Expand Down
100 changes: 100 additions & 0 deletions cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
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{
NetworkID: viper.GetString(params.NetworkID),
WorkspaceID: viper.GetString(params.WorkspaceID),
})
},
}
flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError)
flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc)
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
flagSet.StringP(params.NetworkID, "", "", params.NetworkIDDesc)
flagSet.StringP(params.WorkspaceID, "", "", params.WorkspaceIDDesc)
params.AddGHActionsFlags(flagSet)
params.AddCirrusFlags(flagSet)
c.PersistentFlags().AddFlagSet(flagSet)
_ = c.MarkPersistentFlagRequired(params.NetworkID)
_ = c.MarkPersistentFlagRequired(params.WorkspaceID)
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
}
96 changes: 96 additions & 0 deletions cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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-z 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{
SubnetID: viper.GetString(params.SubnetID),
})
},
}
flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError)
flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc)
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
flagSet.StringP(params.SubnetID, "", "", params.SubnetIDDesc)
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
}
35 changes: 35 additions & 0 deletions cmd/mapt/cmd/ibmcloud/ibmcloud.go
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
}
8 changes: 8 additions & 0 deletions cmd/mapt/cmd/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ const (
KeepState string = "keep-state"
KeepStateDesc string = "keep Pulumi state files in backend storage after successful destroy (by default, state files are removed)"

// IBM Cloud
SubnetID string = "subnet-id"
SubnetIDDesc string = "ID of an existing VPC subnet to deploy the instance into"
NetworkID string = "network-id"
NetworkIDDesc string = "ID of an existing Power VS network to attach the instance to"
WorkspaceID string = "workspace-id"
WorkspaceIDDesc string = "ID of an existing Power VS workspace (cloud instance) that owns the network"

// Kind
KindCmd = "kind"
KindCmdDesc = "Manage a Kind cluster. This is not intended for production use"
Expand Down
4 changes: 3 additions & 1 deletion cmd/mapt/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"github.com/redhat-developer/mapt/cmd/mapt/cmd/aws"
"github.com/redhat-developer/mapt/cmd/mapt/cmd/azure"
"github.com/redhat-developer/mapt/cmd/mapt/cmd/ibmcloud"
"github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
"github.com/redhat-developer/mapt/pkg/util/logging"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -61,7 +62,8 @@ func init() {
// Subcommands
rootCmd.AddCommand(
aws.GetCmd(),
azure.GetCmd())
azure.GetCmd(),
ibmcloud.GetCmd())
}

func Execute() {
Expand Down
Loading