Documentation
¶
Index ¶
- Constants
- Variables
- func NewSDKClient(cfg store.ServiceGetter) (*admin.APIClient, error)
- func NewScheme() (*runtime.Scheme, error)
- func NewTranslator(scheme *runtime.Scheme, crd *apiextensionsv1.CustomResourceDefinition, ...) (crapi.Translator, error)
- func Setup(cfg SetupConfig) (*operator.GeneratedExporter, error)
- type ResourceConfig
- type SetupConfig
Constants ¶
const ( // SDKVersion is the Atlas SDK major version used by this exporter. // This must match the imported SDK package version (v20250312013). SDKVersion = "v20250312" )
Variables ¶
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 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 ¶
func Setup(cfg SetupConfig) (*operator.GeneratedExporter, error)
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.