Documentation
¶
Index ¶
Constants ¶
View Source
const ( CockroachDBSQLPort = 26257 RootSQLUser = "root" )
Variables ¶
This section is empty.
Functions ¶
func NewDbConnection ¶
func NewDbConnection(dbConn *DBConnection) (*sql.DB, error)
NewDbConnection returns a new sql.DB instance to the corresponding CockroachDB pod. The DBConnection struct contains the information required to make the connection.
Types ¶
type DBConnection ¶
type DBConnection struct {
Ctx context.Context
// Client is the controller runtime client
Client client.Client
// RestConfig is the Kubernetes rest configuration
RestConfig *rest.Config
// ServiceName to connect to
ServiceName string
// Namespace that the pod is running in
Namespace string
// Database name that we connect to
DatabaseName string
// Port for the database connection
Port *int32
// RunningInsideK8s allows the database connection proxying
// via a kube-proxy implementation
RunningInsideK8s bool
// UseSSL controls if the database connection utilizes SSL
UseSSL bool
// ClientCertificateSecretName is the name of the secret that contains the client CA and Key
ClientCertificateSecretName string
// RootCertificateSecretName is the name of the secret that contains the rootCA
RootCertificateSecretName string
}
DBConnection represents a database connection into a CR Database
Click to show internal directories.
Click to hide internal directories.