exporter

package
v1.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SDKVersion is the Atlas SDK major version used by this exporter.
	// This must match the imported SDK package version (v20250312013).
	SDKVersion = "v20250312"
)

Variables

View Source
var SupportedResources = []ResourceConfig{
	{CRDName: "atlas.generated.mongodb.com_groups", Factory: generated.NewGroupExporter},
	{CRDName: "atlas.generated.mongodb.com_clusters", Factory: generated.NewClusterExporter},
	{CRDName: "atlas.generated.mongodb.com_flexclusters", Factory: generated.NewFlexClusterExporter},
	{CRDName: "atlas.generated.mongodb.com_databaseusers", Factory: generated.NewDatabaseUserExporter},
	{CRDName: "atlas.generated.mongodb.com_ipaccesslistentries", Factory: generated.NewIPAccessListEntryExporter},
}

SupportedResources lists all resources that can be exported. To add a new resource, simply add an entry here.

Functions

func NewSDKClient

func NewSDKClient(cfg store.ServiceGetter) (*admin.APIClient, error)

NewSDKClient creates a new Atlas SDK v20250312013 client using the same authentication and configuration pattern as the Store abstraction.

func NewScheme

func NewScheme() (*runtime.Scheme, error)

NewScheme creates a new runtime.Scheme with the generated CRD types registered.

func NewTranslator

func NewTranslator(scheme *runtime.Scheme, crd *apiextensionsv1.CustomResourceDefinition, sdkVersion string) (crapi.Translator, error)

NewTranslator creates a new Crapi translator for the given CRD. It extracts the CRD version from the CRD spec and uses the provided SDK version to ensure compatibility with the SDK client.

func Setup

Setup creates and configures a GeneratedExporter with all required dependencies. It iterates over SupportedResources to create exporters for each resource type.

Types

type ResourceConfig

type ResourceConfig struct {
	// CRDName is the full CRD name (e.g., "groups.atlas.generated.mongodb.com")
	CRDName string

	// Factory creates the exporter for this resource type
	Factory func(client *admin.APIClient, translator crapi.Translator, identifiers []string) generated.Exporter
}

ResourceConfig defines a resource type that can be exported. To add a new resource, add an entry to the SupportedResources slice.

type SetupConfig

type SetupConfig struct {
	// ProjectID is the Atlas project ID to export
	ProjectID string

	// TargetNamespace is the Kubernetes namespace for exported resources
	TargetNamespace string

	// Profile provides service configuration and credentials
	Profile store.AuthenticatedConfig

	// OrgID is the Atlas organization ID for the credentials secret
	OrgID string

	// CRDProvider provides CRD definitions
	CRDProvider crds.AtlasOperatorCRDProvider

	// OperatorVersion is the operator version for CRD lookup
	OperatorVersion string

	// IndependentResources when true, resources are exported independently without
	// cross-resource references. When false, previously exported objects are passed
	// to each exporter for dependency resolution.
	IndependentResources bool

	// IncludeSecrets when true, generates Secret resources and references them
	// in spec.connectionSecretRef. When false but IndependentResources is true,
	// secrets are still generated to ensure standalone resources work correctly.
	IncludeSecrets bool
}

SetupConfig holds the configuration for setting up the generated exporter.

Directories

Path Synopsis
nolint:dupl
nolint:dupl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL