Documentation
¶
Index ¶
- Constants
- Variables
- func ComputeHash(projectID, targetName, userName, connectionTargetType string) string
- func CreateURL(hostname, username, password string) (string, error)
- func K8sConnectionSecretName(projectID, targetName, userName, connectionTargetType string) string
- type ConnectionSecretData
- type ConnectionSecretIdentifiers
- type ConnectionSecretReconciler
- type ConnectionTarget
- type DataFederationConnectionTarget
- func (e DataFederationConnectionTarget) BuildConnectionData(ctx context.Context, user *akov2.AtlasDatabaseUser) (ConnectionSecretData, error)
- func (e DataFederationConnectionTarget) GetConnectionTargetType() string
- func (e DataFederationConnectionTarget) GetName() string
- func (e DataFederationConnectionTarget) GetProjectID(ctx context.Context) (string, error)
- func (e DataFederationConnectionTarget) GetScopeType() akov2.ScopeType
- func (e DataFederationConnectionTarget) IsReady() bool
- func (DataFederationConnectionTarget) SelectorByProjectID(projectID string) fields.Selector
- type DeploymentConnectionTarget
- func (e DeploymentConnectionTarget) BuildConnectionData(ctx context.Context, user *akov2.AtlasDatabaseUser) (ConnectionSecretData, error)
- func (e DeploymentConnectionTarget) GetConnectionTargetType() string
- func (e DeploymentConnectionTarget) GetName() string
- func (e DeploymentConnectionTarget) GetProjectID(ctx context.Context) (string, error)
- func (e DeploymentConnectionTarget) GetScopeType() akov2.ScopeType
- func (e DeploymentConnectionTarget) IsReady() bool
- func (DeploymentConnectionTarget) SelectorByProjectID(projectID string) fields.Selector
- type PrivateLinkConnectionURLs
Constants ¶
const ( ProjectLabelKey = "atlas.mongodb.com/project-id" TargetLabelKey = "atlas.mongodb.com/target-name" TypeLabelKey = "atlas.mongodb.com/type" DatabaseUserLabelKey = "atlas.mongodb.com/database-user-name" ConnectionTypelKey = "atlas.mongodb.com/connection-type" CredLabelVal = "credentials" )
Variables ¶
var ( ConnectionSecretGoFieldOwner = client.FieldOwner("connectionsecret") ErrInternalFormatErr = errors.New("identifiers could not be loaded from internal format") ErrK8SFormatErr = errors.New("identifiers could not be loaded from k8s format") ErrMissingPairing = errors.New("missing user/connectionTarget") ErrAmbiguousPairing = errors.New("multiple users/connectionTargets with the same name found") ErrUnresolvedProjectID = errors.New("could not resolve the project id") )
Functions ¶
func ComputeHash ¶
ComputeHash generates a hash based on key connection metadata for immutable secret naming
func K8sConnectionSecretName ¶
Types ¶
type ConnectionSecretData ¶
type ConnectionSecretData struct {
DBUserName string
Password string
ConnectionURL string
SrvConnectionURL string
PrivateConnectionURLs []PrivateLinkConnectionURLs
}
ConnectionData contains all connection information required to populate the Kubernetes Secret, including standard and SRV URLs and optional Private Link URLs.
type ConnectionSecretIdentifiers ¶
type ConnectionSecretIdentifiers struct {
ProjectID string
TargetName string
DatabaseUsername string
ConnectionType string
}
ConnnSecretIdentifiers stores all the necessary information that will be needed to identiy and get a K8s connection secret
type ConnectionSecretReconciler ¶
type ConnectionSecretReconciler struct {
reconciler.AtlasReconciler
Scheme *runtime.Scheme
EventRecorder record.EventRecorder
GlobalPredicates []predicate.Predicate
ConnectionTargetKinds []ConnectionTarget
}
func (*ConnectionSecretReconciler) For ¶
func (r *ConnectionSecretReconciler) For() (client.Object, builder.Predicates)
func (*ConnectionSecretReconciler) SetupWithManager ¶
func (r *ConnectionSecretReconciler) SetupWithManager(mgr ctrl.Manager, skipNameValidation bool) error
type ConnectionTarget ¶
type ConnectionTarget interface {
GetConnectionTargetType() string
GetName() string
IsReady() bool
GetScopeType() akov2.ScopeType
GetProjectID(ctx context.Context) (string, error)
SelectorByProjectID(projectID string) fields.Selector
BuildConnectionData(ctx context.Context, user *akov2.AtlasDatabaseUser) (ConnectionSecretData, error)
}
Each connectionTarget would have to implement this interface (e.g. AtlasDeployment, AtlasDataFederation)
type DataFederationConnectionTarget ¶
type DataFederationConnectionTarget struct {
// contains filtered or unexported fields
}
func (DataFederationConnectionTarget) BuildConnectionData ¶
func (e DataFederationConnectionTarget) BuildConnectionData(ctx context.Context, user *akov2.AtlasDatabaseUser) (ConnectionSecretData, error)
BuildConnectionData builds the ConnectionSecretData for this connectionTarget type
func (DataFederationConnectionTarget) GetConnectionTargetType ¶
func (e DataFederationConnectionTarget) GetConnectionTargetType() string
GetConnectionTargetType returns the connectionTarget type
func (DataFederationConnectionTarget) GetName ¶
func (e DataFederationConnectionTarget) GetName() string
GetName resolves the connectionTargets name from the spec
func (DataFederationConnectionTarget) GetProjectID ¶
func (e DataFederationConnectionTarget) GetProjectID(ctx context.Context) (string, error)
GetProjectID resolves parent project's id (only ProjectRef)
func (DataFederationConnectionTarget) GetScopeType ¶
func (e DataFederationConnectionTarget) GetScopeType() akov2.ScopeType
GetScopeType returns the scope type of the connectionTarget to match with the ones from AtlasDatabaseUser
func (DataFederationConnectionTarget) IsReady ¶
func (e DataFederationConnectionTarget) IsReady() bool
IsReady returns true if the connectionTarget is ready
func (DataFederationConnectionTarget) SelectorByProjectID ¶
func (DataFederationConnectionTarget) SelectorByProjectID(projectID string) fields.Selector
Defines the selector to use for indexer when trying to retrieve all connectionTargets by project
type DeploymentConnectionTarget ¶
type DeploymentConnectionTarget struct {
// contains filtered or unexported fields
}
func (DeploymentConnectionTarget) BuildConnectionData ¶
func (e DeploymentConnectionTarget) BuildConnectionData(ctx context.Context, user *akov2.AtlasDatabaseUser) (ConnectionSecretData, error)
BuildConnectionData defines the specific function/way for building the ConnectionSecretData given this type of connectionTarget AtlasDeployment stores connection strings in the status field
func (DeploymentConnectionTarget) GetConnectionTargetType ¶
func (e DeploymentConnectionTarget) GetConnectionTargetType() string
GetConnectionTargetType returns the connectionTarget type
func (DeploymentConnectionTarget) GetName ¶
func (e DeploymentConnectionTarget) GetName() string
GetName resolves the connectionTargets name from the spec
func (DeploymentConnectionTarget) GetProjectID ¶
func (e DeploymentConnectionTarget) GetProjectID(ctx context.Context) (string, error)
GetProjectID resolves parent project's id (ProjectRef or ExternalRef)
func (DeploymentConnectionTarget) GetScopeType ¶
func (e DeploymentConnectionTarget) GetScopeType() akov2.ScopeType
GetScopeType returns the scope type of the connectionTarget to match with the ones from AtlasDatabaseUser
func (DeploymentConnectionTarget) IsReady ¶
func (e DeploymentConnectionTarget) IsReady() bool
IsReady returns true if the connectionTarget is ready
func (DeploymentConnectionTarget) SelectorByProjectID ¶
func (DeploymentConnectionTarget) SelectorByProjectID(projectID string) fields.Selector
Defines the selector to use for indexer when trying to retrieve all connectionTargets by project