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
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CIRRUS_CLI ?= v0.165.2
GITHUB_RUNNER ?= 2.334.0
# renovate: datasource=gitlab-releases depName=gitlab-org/gitlab-runner
GITLAB_RUNNER ?= 18.11.2
# renovate: datasource=github-releases depName=open-telemetry/opentelemetry-collector-releases
OTELCOL_VERSION ?= 0.151.0

# Go and compilation related variables
GOPATH ?= $(shell go env GOPATH)
Expand All @@ -25,7 +27,9 @@ MODULEPATH = $(ORG)/mapt
VERSION_VARIABLES := -X $(MODULEPATH)/pkg/manager/context.OCI=$(IMG) \
-X $(MODULEPATH)/pkg/integrations/cirrus.version=$(CIRRUS_CLI) \
-X $(MODULEPATH)/pkg/integrations/github.runnerVersion=$(GITHUB_RUNNER) \
-X $(MODULEPATH)/pkg/integrations/gitlab.version=$(GITLAB_RUNNER)
-X $(MODULEPATH)/pkg/integrations/gitlab.version=$(GITLAB_RUNNER) \
-X $(MODULEPATH)/pkg/provider/ibmcloud/action/ibm-power.otelColVersion=$(OTELCOL_VERSION) \
-X $(MODULEPATH)/pkg/provider/ibmcloud/action/ibm-z.otelColVersion=$(OTELCOL_VERSION)
LDFLAGS := $(VERSION_VARIABLES) ${GO_EXTRA_LDFLAGS}
GCFLAGS := all=-N -l
GOOS := $(shell go env GOOS)
Expand Down Expand Up @@ -80,6 +84,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 @@ -99,7 +107,6 @@ lint: $(TOOLS_BINDIR)/golangci-lint
.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.md)


### 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
108 changes: 108 additions & 0 deletions cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
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{
PIPrivateSubnetID: viper.GetString(params.PIPrivateSubnetID),
WorkspaceID: viper.GetString(params.WorkspaceID),
VPCPublicSubnetID: viper.GetString(params.VPCPublicSubnetID),
OtelAppCode: viper.GetString(params.OtelAppCode),
OtelAuthToken: viper.GetString(params.OtelAuthToken),
OtelEndpoint: viper.GetString(params.OtelEndpoint),
})
},
}
flagSet := pflag.NewFlagSet(params.CreateCmdName, pflag.ExitOnError)
flagSet.StringP(params.ConnectionDetailsOutput, "", "", params.ConnectionDetailsOutputDesc)
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
flagSet.StringP(params.PIPrivateSubnetID, "", "", params.PIPrivateSubnetIDDesc)
flagSet.StringP(params.WorkspaceID, "", "", params.WorkspaceIDDesc)
flagSet.StringP(params.VPCPublicSubnetID, "", "", params.VPCPublicSubnetIDDesc)
flagSet.StringP(params.OtelAppCode, "", "", params.OtelAppCodeDesc)
flagSet.StringP(params.OtelAuthToken, "", "", params.OtelAuthTokenDesc)
flagSet.StringP(params.OtelEndpoint, "", "https://otel-input.corp.redhat.com", params.OtelEndpointDesc)
params.AddGHActionsFlags(flagSet)
params.AddCirrusFlags(flagSet)
c.PersistentFlags().AddFlagSet(flagSet)
_ = c.MarkPersistentFlagRequired(params.PIPrivateSubnetID)
_ = 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
}
102 changes: 102 additions & 0 deletions cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
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),
OtelAppCode: viper.GetString(params.OtelAppCode),
OtelAuthToken: viper.GetString(params.OtelAuthToken),
OtelEndpoint: viper.GetString(params.OtelEndpoint),
})
},
}
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)
flagSet.StringP(params.OtelAppCode, "", "", params.OtelAppCodeDesc)
flagSet.StringP(params.OtelAuthToken, "", "", params.OtelAuthTokenDesc)
flagSet.StringP(params.OtelEndpoint, "", "https://otel-input.corp.redhat.com", params.OtelEndpointDesc)
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
}
17 changes: 17 additions & 0 deletions cmd/mapt/cmd/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,23 @@ 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"
WorkspaceID string = "workspace-id"
WorkspaceIDDesc string = "ID of an existing Power VS workspace (cloud instance)"
PIPrivateSubnetID string = "pi-private-subnet-id"
PIPrivateSubnetIDDesc string = "ID of an existing Power VS private subnet to attach the instance to"
VPCPublicSubnetID string = "vpc-public-subnet-id"
VPCPublicSubnetIDDesc string = "ID of an existing VPC subnet (with public gateway, connected to Transit Gateway) for the SSH bastion"

OtelAppCode string = "otel-app-code"
OtelAppCodeDesc string = "OpenTelemetry appcode identifier (e.g. MAPT-001); when set together with --otel-auth-token, installs the otelcol-contrib filelog collector on the instance"
OtelAuthToken string = "otel-auth-token"
OtelAuthTokenDesc string = "OpenTelemetry authentication token (UUID) used to authenticate against the OTLP endpoint"
OtelEndpoint string = "otel-endpoint"
OtelEndpointDesc string = "OTLP HTTP endpoint to export logs to"

// Kind
KindCmd = "kind"
KindCmdDesc = "Manage a Kind cluster. This is not intended for production use"
Expand Down
Loading