mongoprovider

package
v0.2.5-rc Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

pkg/providers/mongodb/provider.go

Real MongoDB provider for Orkestra.

Handles the "mongodb" block in Katalog declarations. Uses the official MongoDB Go driver — no mocks, no stubs.

Supported resource kinds:

database   — MongoDB database (create, drop)
user       — Database user (create, update roles, delete)
collection — Collection with optional schema validation (create, drop)

Installation:

go get go.mongodb.org/mongo-driver/mongo
go get go.mongodb.org/mongo-driver/mongo/options

Registration:

client, _ := mongo.Connect(ctx, options.Client().ApplyURI(uri))
registry.Register(mongoprovider.New(client))

Katalog:

providers:
  mongodb:
    - database:
        name: "{{ .metadata.name }}"

    - user:
        name: "{{ .spec.dbUser }}"
        database: "{{ .metadata.name }}"
        roles: "readWrite"
        credentials:
          secretName: "{{ .metadata.name }}-mongo-creds"   # MONGO_PASSWORD

    - collection:
        name: events
        database: "{{ .metadata.name }}"
        when:
          - field: spec.enableEvents
            equals: "true"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements orktypes.Provider for the "mongodb" block.

func New

func New(client *mongo.Client) *Provider

New creates a MongoDB provider from an existing connected client.

func NewFromURI

func NewFromURI(ctx context.Context, uri string) (*Provider, error)

NewFromURI connects to MongoDB using the given URI and returns a Provider.

func (*Provider) Delete

func (p *Provider) Delete(ctx context.Context, req orktypes.DeleteRequest) error

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Reconcile

func (p *Provider) Reconcile(ctx context.Context, req orktypes.ReconcileRequest) error

Jump to

Keyboard shortcuts

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