Documentation
¶
Index ¶
- Constants
- func EtcdCredsIdentifier(instanceID string) resource.Identifier
- func PatroniClusterResourceIdentifier(nodeName string) resource.Identifier
- func PatroniMemberResourceIdentifier(instanceID string) resource.Identifier
- func PgBackRestConfigIdentifier(instanceID string, configType pgbackrest.ConfigType) resource.Identifier
- func PgBackRestStanzaIdentifier(nodeName string) resource.Identifier
- func PgServiceConfResourceIdentifier(instanceID string) resource.Identifier
- func PostgresCertsIdentifier(instanceID string) resource.Identifier
- func ReadResourceFile(fs afero.Fs, path string) ([]byte, error)
- func RegisterResourceTypes(registry *resource.Registry)
- type EtcdCreds
- func (c *EtcdCreds) Create(ctx context.Context, rc *resource.Context) error
- func (c *EtcdCreds) Delete(ctx context.Context, rc *resource.Context) error
- func (c *EtcdCreds) Dependencies() []resource.Identifier
- func (c *EtcdCreds) DiffIgnore() []string
- func (c *EtcdCreds) Executor() resource.Executor
- func (c *EtcdCreds) Identifier() resource.Identifier
- func (c *EtcdCreds) Refresh(ctx context.Context, rc *resource.Context) error
- func (c *EtcdCreds) ResourceVersion() string
- func (c *EtcdCreds) TypeDependencies() []resource.Type
- func (c *EtcdCreds) Update(ctx context.Context, rc *resource.Context) error
- type GenerateOptions
- type PatroniCluster
- func (p *PatroniCluster) Create(ctx context.Context, rc *resource.Context) error
- func (p *PatroniCluster) Delete(ctx context.Context, rc *resource.Context) error
- func (p *PatroniCluster) Dependencies() []resource.Identifier
- func (p *PatroniCluster) DiffIgnore() []string
- func (p *PatroniCluster) Executor() resource.Executor
- func (p *PatroniCluster) Identifier() resource.Identifier
- func (p *PatroniCluster) Refresh(ctx context.Context, rc *resource.Context) error
- func (p *PatroniCluster) ResourceVersion() string
- func (p *PatroniCluster) TypeDependencies() []resource.Type
- func (p *PatroniCluster) Update(ctx context.Context, rc *resource.Context) error
- type PatroniConfig
- func (c *PatroniConfig) Create(ctx context.Context, rc *resource.Context, systemAddresses []string, ...) error
- func (c *PatroniConfig) Delete(ctx context.Context, rc *resource.Context) error
- func (c *PatroniConfig) Dependencies() []resource.Identifier
- func (c *PatroniConfig) Refresh(ctx context.Context, rc *resource.Context) error
- func (c *PatroniConfig) TypeDependencies() []resource.Type
- type PatroniConfigGenerator
- type PatroniConfigGeneratorOptions
- type PatroniMember
- func (p *PatroniMember) Create(ctx context.Context, rc *resource.Context) error
- func (p *PatroniMember) Delete(ctx context.Context, rc *resource.Context) error
- func (p *PatroniMember) Dependencies() []resource.Identifier
- func (p *PatroniMember) DiffIgnore() []string
- func (p *PatroniMember) Executor() resource.Executor
- func (p *PatroniMember) Identifier() resource.Identifier
- func (p *PatroniMember) Refresh(ctx context.Context, rc *resource.Context) error
- func (p *PatroniMember) ResourceVersion() string
- func (p *PatroniMember) TypeDependencies() []resource.Type
- func (p *PatroniMember) Update(ctx context.Context, rc *resource.Context) error
- type PgBackRestConfig
- func (c *PgBackRestConfig) BaseName() string
- func (c *PgBackRestConfig) Create(ctx context.Context, rc *resource.Context) error
- func (c *PgBackRestConfig) Delete(ctx context.Context, rc *resource.Context) error
- func (c *PgBackRestConfig) Dependencies() []resource.Identifier
- func (c *PgBackRestConfig) DiffIgnore() []string
- func (c *PgBackRestConfig) Executor() resource.Executor
- func (c *PgBackRestConfig) HostPath(rc *resource.Context) (string, error)
- func (c *PgBackRestConfig) Identifier() resource.Identifier
- func (c *PgBackRestConfig) Refresh(ctx context.Context, rc *resource.Context) error
- func (c *PgBackRestConfig) ResourceVersion() string
- func (c *PgBackRestConfig) TypeDependencies() []resource.Type
- func (c *PgBackRestConfig) Update(ctx context.Context, rc *resource.Context) error
- type PgBackRestStanza
- func (p *PgBackRestStanza) Create(ctx context.Context, rc *resource.Context) error
- func (p *PgBackRestStanza) Delete(ctx context.Context, rc *resource.Context) error
- func (p *PgBackRestStanza) Dependencies() []resource.Identifier
- func (p *PgBackRestStanza) DiffIgnore() []string
- func (p *PgBackRestStanza) Executor() resource.Executor
- func (p *PgBackRestStanza) Identifier() resource.Identifier
- func (p *PgBackRestStanza) Refresh(ctx context.Context, rc *resource.Context) error
- func (p *PgBackRestStanza) ResourceVersion() string
- func (p *PgBackRestStanza) TypeDependencies() []resource.Type
- func (p *PgBackRestStanza) Update(ctx context.Context, rc *resource.Context) error
- type PgServiceConf
- func (p *PgServiceConf) Create(ctx context.Context, rc *resource.Context) error
- func (p *PgServiceConf) Delete(ctx context.Context, rc *resource.Context) error
- func (p *PgServiceConf) Dependencies() []resource.Identifier
- func (p *PgServiceConf) DiffIgnore() []string
- func (p *PgServiceConf) Executor() resource.Executor
- func (p *PgServiceConf) Identifier() resource.Identifier
- func (p *PgServiceConf) Refresh(ctx context.Context, rc *resource.Context) error
- func (p *PgServiceConf) ResourceVersion() string
- func (p *PgServiceConf) TypeDependencies() []resource.Type
- func (p *PgServiceConf) Update(ctx context.Context, rc *resource.Context) error
- type PostgresCerts
- func (c *PostgresCerts) Create(ctx context.Context, rc *resource.Context) error
- func (c *PostgresCerts) Delete(ctx context.Context, rc *resource.Context) error
- func (c *PostgresCerts) Dependencies() []resource.Identifier
- func (c *PostgresCerts) DiffIgnore() []string
- func (c *PostgresCerts) Executor() resource.Executor
- func (c *PostgresCerts) Identifier() resource.Identifier
- func (c *PostgresCerts) Refresh(ctx context.Context, rc *resource.Context) error
- func (c *PostgresCerts) ResourceVersion() string
- func (c *PostgresCerts) TypeDependencies() []resource.Type
- func (c *PostgresCerts) Update(ctx context.Context, rc *resource.Context) error
Constants ¶
View Source
const ResourceTypeEtcdCreds resource.Type = "common.etcd_creds"
View Source
const ResourceTypePatroniCluster resource.Type = "common.patroni_cluster"
View Source
const ResourceTypePatroniMember resource.Type = "common.patroni_member"
View Source
const ResourceTypePgBackRestConfig resource.Type = "common.pgbackrest_config"
View Source
const ResourceTypePgBackRestStanza resource.Type = "common.pgbackrest_stanza"
View Source
const ResourceTypePgServiceConf resource.Type = "common.pg_service_conf"
View Source
const ResourceTypePostgresCerts resource.Type = "common.postgres_certs"
Variables ¶
This section is empty.
Functions ¶
func EtcdCredsIdentifier ¶
func EtcdCredsIdentifier(instanceID string) resource.Identifier
func PatroniClusterResourceIdentifier ¶
func PatroniClusterResourceIdentifier(nodeName string) resource.Identifier
func PatroniMemberResourceIdentifier ¶
func PatroniMemberResourceIdentifier(instanceID string) resource.Identifier
func PgBackRestConfigIdentifier ¶
func PgBackRestConfigIdentifier(instanceID string, configType pgbackrest.ConfigType) resource.Identifier
func PgBackRestStanzaIdentifier ¶
func PgBackRestStanzaIdentifier(nodeName string) resource.Identifier
func PgServiceConfResourceIdentifier ¶
func PgServiceConfResourceIdentifier(instanceID string) resource.Identifier
func PostgresCertsIdentifier ¶
func PostgresCertsIdentifier(instanceID string) resource.Identifier
func RegisterResourceTypes ¶
Types ¶
type EtcdCreds ¶
type EtcdCreds struct {
InstanceID string `json:"instance_id"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
NodeName string `json:"node_name"`
ParentID string `json:"parent_id"`
OwnerUID int `json:"owner_uid"`
OwnerGID int `json:"owner_gid"`
Username string `json:"username"`
Password string `json:"password"`
CaCert []byte `json:"ca_cert"`
ClientCert []byte `json:"client_cert"`
ClientKey []byte `json:"client_key"`
}
func (*EtcdCreds) Dependencies ¶
func (c *EtcdCreds) Dependencies() []resource.Identifier
func (*EtcdCreds) DiffIgnore ¶
func (*EtcdCreds) Identifier ¶
func (c *EtcdCreds) Identifier() resource.Identifier
func (*EtcdCreds) ResourceVersion ¶
func (*EtcdCreds) TypeDependencies ¶
type GenerateOptions ¶
type GenerateOptions struct {
// SystemAddresses are IPs, hostnames, or CIDR ranges that pgedge or
// patroni_replicator connections will originate from.
SystemAddresses []string
// ExtraHbaEntries are orchestrator-specific entries to include in the
// pg_hba.conf.
ExtraHbaEntries []hba.Entry
// EnableFastBasebackup enables basebackup's "fast" checkpoint option when
// bootstrapping this instance from another existing instance.
EnableFastBasebackup bool
}
type PatroniCluster ¶
type PatroniCluster struct {
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
}
func (*PatroniCluster) Dependencies ¶
func (p *PatroniCluster) Dependencies() []resource.Identifier
func (*PatroniCluster) DiffIgnore ¶
func (p *PatroniCluster) DiffIgnore() []string
func (*PatroniCluster) Executor ¶
func (p *PatroniCluster) Executor() resource.Executor
func (*PatroniCluster) Identifier ¶
func (p *PatroniCluster) Identifier() resource.Identifier
func (*PatroniCluster) ResourceVersion ¶
func (p *PatroniCluster) ResourceVersion() string
func (*PatroniCluster) TypeDependencies ¶
func (p *PatroniCluster) TypeDependencies() []resource.Type
type PatroniConfig ¶
type PatroniConfig struct {
InstanceID string `json:"instance_id"`
HostID string `json:"host_id"`
NodeName string `json:"node_name"`
Generator *PatroniConfigGenerator `json:"generator"`
ParentID string `json:"parent_id"`
OwnerUID int `json:"owner_uid"`
OwnerGID int `json:"owner_gid"`
}
func (*PatroniConfig) Dependencies ¶
func (c *PatroniConfig) Dependencies() []resource.Identifier
func (*PatroniConfig) TypeDependencies ¶
func (c *PatroniConfig) TypeDependencies() []resource.Type
type PatroniConfigGenerator ¶
type PatroniConfigGenerator struct {
// ArchiveCommand sets the Postgres archive command parameter.
ArchiveCommand string `json:"archive_command,omitempty"`
// ClusterSize is the number of nodes in the Spock cluster. This is used for
// the tunable Postgres parameters.
ClusterSize int `json:"cluster_size"`
// CPUs is the number of CPUs allocated for this instance. This is used for
// the tunable Postgres parameters.
CPUs float64 `json:"cpus,omitempty"`
// DatabaseID is the Database's ID.
DatabaseID string `json:"database_id"`
// DataDir is the Postgres data directory.
DataDir string `json:"data_dir"`
// EtcdCertsDir is the Etcd certificates directory.
EtcdCertsDir string `json:"etcd_certs_dir"`
// FQDN is the fully-qualified domain name for this instance. This name must
// be reachable by sibling instances within the Spock node.
FQDN string `json:"fqdn"`
// InstanceID is this instance's ID.
InstanceID string `json:"instance_id"`
// LogType sets the Patroni log type.
LogType patroni.LogType `json:"log_type"`
// MemoryBytes is the amount of memory that is allocated for this instance.
// This is used for the tunable Postgres parameters.
MemoryBytes uint64 `json:"memory_bytes,omitempty"`
// NodeName is the Spock node name.
NodeName string `json:"node_name"`
// NodeOrdinal is the ordinal part of the Spock node name, e.g. for 'n1'
// this would be '1'. This is used to configure the Snowflake and LOLOR
// extensions.
NodeOrdinal int `json:"node_ordinal"`
// OrchestratorParameters are additional parameters to be provided by the
// orchestrator implementation.
OrchestratorParameters map[string]any `json:"orchestrator_parameters,omitempty"`
// PatroniAllowlist is a user-specified list of addresses, hostnames, or
// CIDR ranges to include in the allowlist for Patroni's REST API.
PatroniAllowlist []string `json:"patroni_allowlist"`
// PatroniPort is the port that Patroni will listen on.
PatroniPort int `json:"patroni_port"`
// PostgresCertsDir is the Postgres certificates directory.
PostgresCertsDir string `json:"postgres_certs_dir"`
// PostgresPort is the port that Postgres will listen on.
PostgresPort int `json:"postgres_port"`
// RestoreCommand is an alternate command to use to bootstrap this instance.
RestoreCommand string `json:"restore_command"`
// SpecParameters are user-specified Postgres parameters that are included
// in the database spec.
SpecParameters map[string]any `json:"spec_parameters,omitempty"`
// TenantID is an optional tenant ID that is associated with this instance.
TenantID *string `json:"tenant_id,omitempty"`
}
func NewPatroniConfigGenerator ¶
func NewPatroniConfigGenerator(opts PatroniConfigGeneratorOptions) *PatroniConfigGenerator
func (*PatroniConfigGenerator) Generate ¶
func (p *PatroniConfigGenerator) Generate( etcdHosts []string, etcdCreds *EtcdCreds, opts GenerateOptions, ) *patroni.Config
type PatroniConfigGeneratorOptions ¶
type PatroniConfigGeneratorOptions struct {
// Instance is the instance spec for this instance.
Instance *database.InstanceSpec
// HostCPUs is the total number of CPUs available on the host. This is used for
// the tunable Postgres parameters.
HostCPUs float64
// HostMemoryBytes is the total amount of memory available on the host. This
// is used for the tunable Postgres parameters.
HostMemoryBytes uint64
// FQDN is the fully-qualified domain name for this instance. This name must
// be reachable by sibling instances within the Spock node.
FQDN string
// LogType sets the Patroni log type.
LogType patroni.LogType
// OrchestratorParameters are additional parameters to be provided by the
// orchestrator implementation.
OrchestratorParameters map[string]any
// PatroniPort is the port that Patroni will listen on.
PatroniPort int
// PostgresPort is the port that Postgres will listen on.
PostgresPort int
// Paths is used to compute the paths of directories and executables.
Paths database.InstancePaths
}
type PatroniMember ¶
type PatroniMember struct {
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
InstanceID string `json:"instance_id"`
}
func (*PatroniMember) Dependencies ¶
func (p *PatroniMember) Dependencies() []resource.Identifier
func (*PatroniMember) DiffIgnore ¶
func (p *PatroniMember) DiffIgnore() []string
func (*PatroniMember) Executor ¶
func (p *PatroniMember) Executor() resource.Executor
func (*PatroniMember) Identifier ¶
func (p *PatroniMember) Identifier() resource.Identifier
func (*PatroniMember) ResourceVersion ¶
func (p *PatroniMember) ResourceVersion() string
func (*PatroniMember) TypeDependencies ¶
func (p *PatroniMember) TypeDependencies() []resource.Type
type PgBackRestConfig ¶
type PgBackRestConfig struct {
InstanceID string `json:"instance_id"`
HostID string `json:"host_id"`
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
Repositories []*pgbackrest.Repository `json:"repositories"`
ParentID string `json:"parent_id"`
Type pgbackrest.ConfigType `json:"type"`
OwnerUID int `json:"owner_uid"`
OwnerGID int `json:"owner_gid"`
Paths database.InstancePaths `json:"paths"`
Port int `json:"port"`
}
func (*PgBackRestConfig) BaseName ¶
func (c *PgBackRestConfig) BaseName() string
func (*PgBackRestConfig) Dependencies ¶
func (c *PgBackRestConfig) Dependencies() []resource.Identifier
func (*PgBackRestConfig) DiffIgnore ¶
func (c *PgBackRestConfig) DiffIgnore() []string
func (*PgBackRestConfig) Executor ¶
func (c *PgBackRestConfig) Executor() resource.Executor
func (*PgBackRestConfig) HostPath ¶
func (c *PgBackRestConfig) HostPath(rc *resource.Context) (string, error)
func (*PgBackRestConfig) Identifier ¶
func (c *PgBackRestConfig) Identifier() resource.Identifier
func (*PgBackRestConfig) ResourceVersion ¶
func (c *PgBackRestConfig) ResourceVersion() string
func (*PgBackRestConfig) TypeDependencies ¶
func (c *PgBackRestConfig) TypeDependencies() []resource.Type
type PgBackRestStanza ¶
type PgBackRestStanza struct {
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
}
func (*PgBackRestStanza) Dependencies ¶
func (p *PgBackRestStanza) Dependencies() []resource.Identifier
func (*PgBackRestStanza) DiffIgnore ¶
func (p *PgBackRestStanza) DiffIgnore() []string
func (*PgBackRestStanza) Executor ¶
func (p *PgBackRestStanza) Executor() resource.Executor
func (*PgBackRestStanza) Identifier ¶
func (p *PgBackRestStanza) Identifier() resource.Identifier
func (*PgBackRestStanza) ResourceVersion ¶
func (p *PgBackRestStanza) ResourceVersion() string
func (*PgBackRestStanza) TypeDependencies ¶
func (p *PgBackRestStanza) TypeDependencies() []resource.Type
type PgServiceConf ¶
type PgServiceConf struct {
ParentID string `json:"parent_id"`
HostID string `json:"host_id"`
InstanceID string `json:"instance_id"`
NodeNames []string `json:"node_names"`
OwnerUID int `json:"owner_uid"`
OwnerGID int `json:"owner_gid"`
}
func (*PgServiceConf) Dependencies ¶
func (p *PgServiceConf) Dependencies() []resource.Identifier
func (*PgServiceConf) DiffIgnore ¶
func (p *PgServiceConf) DiffIgnore() []string
func (*PgServiceConf) Executor ¶
func (p *PgServiceConf) Executor() resource.Executor
func (*PgServiceConf) Identifier ¶
func (p *PgServiceConf) Identifier() resource.Identifier
func (*PgServiceConf) ResourceVersion ¶
func (p *PgServiceConf) ResourceVersion() string
func (*PgServiceConf) TypeDependencies ¶
func (p *PgServiceConf) TypeDependencies() []resource.Type
type PostgresCerts ¶
type PostgresCerts struct {
InstanceID string `json:"instance_id"`
HostID string `json:"host_id"`
InstanceAddresses []string `json:"instance_addresses"`
ParentID string `json:"parent_id"`
OwnerUID int `json:"owner_uid"`
OwnerGID int `json:"owner_gid"`
CaCert []byte `json:"ca_cert"`
ServerCert []byte `json:"server_cert"`
ServerKey []byte `json:"server_key"`
SuperuserCert []byte `json:"superuser_cert"`
SuperuserKey []byte `json:"superuser_key"`
ReplicationCert []byte `json:"replication_cert"`
ReplicationKey []byte `json:"replication_key"`
}
func (*PostgresCerts) Dependencies ¶
func (c *PostgresCerts) Dependencies() []resource.Identifier
func (*PostgresCerts) DiffIgnore ¶
func (c *PostgresCerts) DiffIgnore() []string
func (*PostgresCerts) Executor ¶
func (c *PostgresCerts) Executor() resource.Executor
func (*PostgresCerts) Identifier ¶
func (c *PostgresCerts) Identifier() resource.Identifier
func (*PostgresCerts) ResourceVersion ¶
func (c *PostgresCerts) ResourceVersion() string
func (*PostgresCerts) TypeDependencies ¶
func (c *PostgresCerts) TypeDependencies() []resource.Type
Click to show internal directories.
Click to hide internal directories.