...

Package couchctl

import "edge-infra.dev/pkg/edge/datasync/controllers/couchctl"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Constants
Variables
func ApplySubstitutions(res client.Object, su Substitution) (*unstructured.Unstructured, error)
func ChangeSetEntry(action sap.Action, obj client.Object) (*sap.ChangeSetEntry, error)
func CheckPod(ctx context.Context, cl client.Client, ns string, name string) (bool, error)
func ConfigMap(server dsapi.CouchDBServer) (*corev1.ConfigMap, error)
func DatabaseDocumentCountSet(servername, dbname string, count float64)
func DatabaseDocumentDiffInc(servername, dbname string, count float64)
func ExistingChangeSetEntry(obj client.Object) (*sap.ChangeSetEntry, error)
func IsCondition(conditions []corev1.PodCondition, cType string, cStatus corev1.ConditionStatus) bool
func IsLeader(node corev1.Node) bool
func MemoryLessThan(node1 corev1.ResourceList, node2 corev1.ResourceList) bool
func ReplicationStatusInc(servername, dbname, status, message string)
func Run(o ...controller.Option) error
func SubstitutionVars(su Substitution) map[SubstitutionVar]string
func WatchCouchDBUser(ctx context.Context, cl client.WithWatch, user *dsapi.CouchDBUser, timeout time.Duration) error
type BulkDoc
    func (d *BulkDoc) SetDone()
    func (d *BulkDoc) SetError(err error)
type BulkDocs
    func (b *BulkDocs) DoneProcessing() bool
    func (b *BulkDocs) Equals(id string, doc map[string]interface{}) bool
    func (b *BulkDocs) GetAllDocs() []*BulkDoc
    func (b *BulkDocs) GetDocs(state State) []string
    func (b *BulkDocs) JoinErrors() error
    func (b *BulkDocs) ProcessingDocs() []interface{}
    func (b *BulkDocs) Remove(dbs ...string)
    func (b *BulkDocs) SetDone(id string) bool
    func (b *BulkDocs) SetError(id string, err error) bool
    func (b *BulkDocs) SetErrors(err error)
    func (b *BulkDocs) SetProcessing(id string) bool
    func (b *BulkDocs) SetRevision(id string, rev string) bool
    func (b *BulkDocs) SetState(id string, state State) bool
    func (b *BulkDocs) Stats() Stat
type Changes
type ChangesFunc
type Config
    func NewConfig() (*Config, error)
    func (c *Config) BindFlags(fs *flag.FlagSet)
    func (c *Config) CloudURL() string
    func (c *Config) IsCPNode() bool
    func (c *Config) IsDSDS() bool
    func (c *Config) IsGKE() bool
    func (c *Config) IsGeneric() bool
    func (c *Config) IsStore() bool
    func (c *Config) ReplicationDB() string
    func (c *Config) Validate() error
type CouchDBDesignDocReconciler
    func (r *CouchDBDesignDocReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchDBDesignDocReconciler) SetupWithManager(mgr ctrl.Manager) error
type CouchDBPersistenceReconciler
    func (r *CouchDBPersistenceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchDBPersistenceReconciler) SetupWithManager(mgr ctrl.Manager) error
type CouchDatabaseReconciler
    func (r *CouchDatabaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchDatabaseReconciler) SetupWithManager(mgr ctrl.Manager) error
type CouchIndexReconciler
    func (r *CouchIndexReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchIndexReconciler) SetupWithManager(mgr ctrl.Manager) error
type CouchReplicationReconciler
    func (r *CouchReplicationReconciler) EnQueue(_ HostState, queue workqueue.RateLimitingInterface)
    func (r *CouchReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchReplicationReconciler) SetupWithManager(mgr ctrl.Manager) error
type CouchServerReconciler
    func (r *CouchServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchServerReconciler) SetupWithManager(mgr ctrl.Manager) error
type CouchUserReconciler
    func (r *CouchUserReconciler) CredsToSecretManager(ctx context.Context, user *dsapi.CouchDBUser, userCreds couchdb.CredentialsManager, couchReplicationCred bool) error
    func (r *CouchUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
    func (r *CouchUserReconciler) SetupWithManager(mgr ctrl.Manager) error
type Event
type HostNetwork
type HostState
    func (h HostState) InLOM() bool
type InterlockClient
    func NewInterlockClient(baseURL string, cb func(e HostState, queue workqueue.RateLimitingInterface)) *InterlockClient
    func (c *InterlockClient) GetHostState(ctx context.Context) (*HostState, error)
    func (c *InterlockClient) Start(ctx context.Context, queue workqueue.RateLimitingInterface) error
type LeaderElection
    func NewLeaderElection(cs *coordinationv1client.CoordinationV1Client, namespace, name, id string) *LeaderElection
    func (l *LeaderElection) IsLeader() bool
    func (l *LeaderElection) OnNewLeader(ctx context.Context, cb func(leader bool))
type LeaderElector
type MockCouchDBCluster
    func NewMockCouchDBCluster(config *Config, client client.Client, server *dsapi.CouchDBServer, database *dsapi.CouchDBDatabase, user *dsapi.CouchDBUser, index *dsapi.CouchDBIndex, ddoc *dsapi.CouchDBDesignDoc, replication *dsapi.CouchDBReplicationSet) (*MockCouchDBCluster, error)
    func (c *MockCouchDBCluster) NotFound()
    func (c *MockCouchDBCluster) Port() string
type NodeMemoryComparison
    func (n NodeMemoryComparison) Len() int
    func (n NodeMemoryComparison) Less(i, j int) bool
    func (n NodeMemoryComparison) Swap(i, j int)
type NodeMemoryElector
    func (NodeMemoryElector) Elect(nodes []corev1.Node) (*corev1.Node, error)
type NodeResourcePredicate
type NodeResourcePredicateFunc
    func (f NodeResourcePredicateFunc) ShouldReconcile(cfg *Config, obj client.Object) bool
type Payload
type PersistenceLeaderElector
type PersistenceLeaderElectorFunc
    func (r PersistenceLeaderElectorFunc) IsLeader() bool
type ReplicationEvent
    func NewReplicationEvent(cfg *Config) *ReplicationEvent
    func (c *ReplicationEvent) Listen(repl *dsapi.CouchDBReplicationSet, username, password, url string) error
    func (c *ReplicationEvent) Start(ctx context.Context, queue workqueue.RateLimitingInterface) error
    func (c *ReplicationEvent) Stop()
type ReplicationInfo
type RetryableErrorFunc
type ServerSetupResponse
type Stat
    func (s Stat) Done() bool
    func (s Stat) String() string
type State
type Substitution
    func LaneSubstitution(ni *nameutils.NodeInfo, nodeMapping map[string]map[string]string, replDB, leaderNodeUID string) Substitution
    func StoreSubstitution(replDB string) Substitution
    func ToSubstitution(s map[SubstitutionVar]string) Substitution
    func (s Substitution) IsTouchpoint() bool
    func (s Substitution) NodeClass() v1ien.Class
    func (s Substitution) NodeRole() v1ien.Role
type SubstitutionVar
    func ParseSubstitutions(yamlString string) ([]SubstitutionVar, error)

Package files

config.go configmap.go couch_helper.go couchctl.go database_controller.go design_doc_controller.go finalizer.go index_controller.go interface.go interlock_client.go leader_election.go leader_node.go metrics.go mock_couchdb_cluster.go mock_secretmanager.go persistence_controller.go reconcile.go replication.go replication_event.go replicationset_controller.go resource_manager.go server_controller.go subsitutions.go user_controller.go watch.go

Constants

const (
    ServerName                      = SubstitutionVar("{server_name}")
    ServerType                      = SubstitutionVar("{sever_type}")
    LaneNumber                      = SubstitutionVar("{lane_number}")
    Suffix                          = SubstitutionVar("{suffix}")
    CouchDBStatefulSet              = SubstitutionVar("{couchdb_sts}")
    ChirpStatefulSet                = SubstitutionVar("{chirp_sts}")
    ReplicationDB                   = SubstitutionVar("{replication_db}")
    ReplicationSecret               = SubstitutionVar("{replication_secret}")
    ReplicationSecretNS             = SubstitutionVar("{replication_secret_ns}")
    NodeUID                         = SubstitutionVar("{node_uid}")
    LaneNumberSubstitutionMaxLength = 12
    ChirpName                       = "chirp"
    ChirpOldName                    = "data-sync-messaging"
    ConfigMapUID                    = "node-uuid"
)
const (
    ControllerNamespace = "couchctl"
)
const (
    DatasyncFinalizer = "finalizers.datasync.edge.ncr.com"
)
const (
    IniFileKey = "inifile"
)

Variables

var (
    ErrServerNotReady                   = errors.New("server is not ready yet")
    ErrNewDatabaseNotFound              = errors.New("new database not found")
    ErrNewDatabaseRolesAndUsersNotFound = errors.New("new database roles and users are not set")
)
var (
    DatabaseReplicationStatus = promauto.NewCounterVec(prometheus.CounterOpts{
        Name: metrics.Name("couchctl", "database_replication_status"),
        Help: "information about database replication status",
    }, []string{"server_name", "db_name", "status", "message"})
    DatabaseDocumentCount = promauto.NewGaugeVec(prometheus.GaugeOpts{
        Name: metrics.Name("couchctl", "database_doc_count"),
        Help: "number of documents in a couchdb database",
    }, []string{"server_name", "db_name"})
    DatabaseDiffDocumentCount = promauto.NewGaugeVec(prometheus.GaugeOpts{
        Name: metrics.Name("couchctl", "database_diff_count"),
        Help: "difference in documents from the cloud couchdb database",
    }, []string{"server_name", "db_name"})
)
var (
    // Substitutions a set of valid mockSubstitutions values
    Substitutions = map[SubstitutionVar]struct{}{
        ServerName:          {},
        ServerType:          {},
        LaneNumber:          {},
        Suffix:              {},
        CouchDBStatefulSet:  {},
        ChirpStatefulSet:    {},
        ReplicationDB:       {},
        ReplicationSecret:   {},
        ReplicationSecretNS: {},
        NodeUID:             {},
    }

    ErrInvalidSubstitutions = errors.New("invalid substitutions")
    ErrNoValueSubstitution  = errors.New("no value found for mockSubstitutions")
)
var (
    ErrNewUserNotFoundInDB = errors.New("new user not found in users table")
)
var (
    ErrPodsNotReady = errors.New("pods arent ready")
)

func ApplySubstitutions

func ApplySubstitutions(res client.Object, su Substitution) (*unstructured.Unstructured, error)

ApplySubstitutions replace all mockSubstitutions values

func ChangeSetEntry

func ChangeSetEntry(action sap.Action, obj client.Object) (*sap.ChangeSetEntry, error)

func CheckPod

func CheckPod(ctx context.Context, cl client.Client, ns string, name string) (bool, error)

func ConfigMap

func ConfigMap(server dsapi.CouchDBServer) (*corev1.ConfigMap, error)

ConfigMap dynamically build couchdb config ini

func DatabaseDocumentCountSet

func DatabaseDocumentCountSet(servername, dbname string, count float64)

func DatabaseDocumentDiffInc

func DatabaseDocumentDiffInc(servername, dbname string, count float64)

func ExistingChangeSetEntry

func ExistingChangeSetEntry(obj client.Object) (*sap.ChangeSetEntry, error)

ExistingChangeSetEntry used for backward compatibility

func IsCondition

func IsCondition(conditions []corev1.PodCondition, cType string, cStatus corev1.ConditionStatus) bool

IsCondition determines if a K8s resource has a status matching the input type and status

func IsLeader

func IsLeader(node corev1.Node) bool

func MemoryLessThan

func MemoryLessThan(node1 corev1.ResourceList, node2 corev1.ResourceList) bool

func ReplicationStatusInc

func ReplicationStatusInc(servername, dbname, status, message string)

func Run

func Run(o ...controller.Option) error

Run creates the manager, sets up the controller, and then starts everything. It returns the created manager for testing purposes

func SubstitutionVars

func SubstitutionVars(su Substitution) map[SubstitutionVar]string

func WatchCouchDBUser

func WatchCouchDBUser(ctx context.Context, cl client.WithWatch, user *dsapi.CouchDBUser, timeout time.Duration) error

WatchCouchDBUser watch couchdb user resource. TODO make generic to watch any couchdb resource.

type BulkDoc

type BulkDoc struct {
    State
    Doc     map[string]interface{}
    Error   error
    Dataset dsapi.Dataset
}

func (*BulkDoc) SetDone

func (d *BulkDoc) SetDone()

func (*BulkDoc) SetError

func (d *BulkDoc) SetError(err error)

type BulkDocs

type BulkDocs struct {
    Docs map[string]*BulkDoc
}

func (*BulkDocs) DoneProcessing

func (b *BulkDocs) DoneProcessing() bool

func (*BulkDocs) Equals

func (b *BulkDocs) Equals(id string, doc map[string]interface{}) bool

func (*BulkDocs) GetAllDocs

func (b *BulkDocs) GetAllDocs() []*BulkDoc

func (*BulkDocs) GetDocs

func (b *BulkDocs) GetDocs(state State) []string

func (*BulkDocs) JoinErrors

func (b *BulkDocs) JoinErrors() error

func (*BulkDocs) ProcessingDocs

func (b *BulkDocs) ProcessingDocs() []interface{}

func (*BulkDocs) Remove

func (b *BulkDocs) Remove(dbs ...string)

func (*BulkDocs) SetDone

func (b *BulkDocs) SetDone(id string) bool

func (*BulkDocs) SetError

func (b *BulkDocs) SetError(id string, err error) bool

func (*BulkDocs) SetErrors

func (b *BulkDocs) SetErrors(err error)

SetErrors can't no longer process doc, set all remaining doc as error

func (*BulkDocs) SetProcessing

func (b *BulkDocs) SetProcessing(id string) bool

func (*BulkDocs) SetRevision

func (b *BulkDocs) SetRevision(id string, rev string) bool

func (*BulkDocs) SetState

func (b *BulkDocs) SetState(id string, state State) bool

func (*BulkDocs) Stats

func (b *BulkDocs) Stats() Stat

type Changes

type Changes interface {
    Next() bool
    Err() error
    ID() string        // document ID
    Changes() []string // list of revisions
}

type ChangesFunc

type ChangesFunc func(ctx context.Context, username, password, url string) (Changes, error)

type Config

type Config struct {
    CompactRatio float64

    RequeueTime                time.Duration // Duration use to reconcile random errors
    ServerNotReady             time.Duration // Duration use to wait for server to become ready
    DatabaseNotFound           time.Duration // Duration use to reconcile for database not found
    IngressNotReady            time.Duration // Duration use to reconcile for ingress not ready
    PollingInterval            time.Duration // Duration use to check for resource updates
    ReplicationPollingInterval time.Duration // Duration use to check for new DB replication
    ReplicationChangesInterval time.Duration // Duration use to check for new DB replication
    EnablementWatchInterval    time.Duration // Duration use to check for banner couchdb enablement
    ReplicationDBCreated       time.Duration // Duration use to check db created by replication
    DatasyncDNSName            string
    CouchDBPort                string
    FleetType                  string
    ClusterType                string
    BannerEdgeID               string
    ProjectID                  string
    SiteID                     string // bslInfo.ID, only in stores
    CouchNamespace             string
    CouchCTLNamespace          string
    InterlockAPIURL            string
    NodeUID                    string
    NodeClass                  string
    NodeRole                   string
    ReplicationEventFromSource bool
    ReconcileConcurrency       int
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) BindFlags

func (c *Config) BindFlags(fs *flag.FlagSet)

func (*Config) CloudURL

func (c *Config) CloudURL() string

func (*Config) IsCPNode

func (c *Config) IsCPNode() bool

func (*Config) IsDSDS

func (c *Config) IsDSDS() bool

func (*Config) IsGKE

func (c *Config) IsGKE() bool

func (*Config) IsGeneric

func (c *Config) IsGeneric() bool

func (*Config) IsStore

func (c *Config) IsStore() bool

func (*Config) ReplicationDB

func (c *Config) ReplicationDB() string

func (*Config) Validate

func (c *Config) Validate() error

type CouchDBDesignDocReconciler

type CouchDBDesignDocReconciler struct {
    client.Client
    NodeResourcePredicate
    kuberecorder.EventRecorder
    Name    string
    Config  *Config
    Metrics metrics.Metrics
    // contains filtered or unexported fields
}

func (*CouchDBDesignDocReconciler) Reconcile

func (r *CouchDBDesignDocReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchDBDesignDocReconciler) SetupWithManager

func (r *CouchDBDesignDocReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up CouchDBDesignDocReconciler with the manager

type CouchDBPersistenceReconciler

type CouchDBPersistenceReconciler struct {
    client.Client
    LeaderElector
    kuberecorder.EventRecorder
    ResourceManager *sap.ResourceManager
    Name            string
    Config          *Config
    Metrics         metrics.Metrics

    PersistenceLeaderElector
    // contains filtered or unexported fields
}

func (*CouchDBPersistenceReconciler) Reconcile

func (r *CouchDBPersistenceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchDBPersistenceReconciler) SetupWithManager

func (r *CouchDBPersistenceReconciler) SetupWithManager(mgr ctrl.Manager) error

type CouchDatabaseReconciler

type CouchDatabaseReconciler struct {
    client.Client
    NodeResourcePredicate
    kuberecorder.EventRecorder
    Name    string
    Config  *Config
    Metrics metrics.Metrics

    ReconcileConcurrency int
    // contains filtered or unexported fields
}

func (*CouchDatabaseReconciler) Reconcile

func (r *CouchDatabaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchDatabaseReconciler) SetupWithManager

func (r *CouchDatabaseReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up ComputeAddressReconciler with the manager

type CouchIndexReconciler

type CouchIndexReconciler struct {
    client.Client
    NodeResourcePredicate
    kuberecorder.EventRecorder
    Name    string
    Config  *Config
    Metrics metrics.Metrics
    // contains filtered or unexported fields
}

func (*CouchIndexReconciler) Reconcile

func (r *CouchIndexReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchIndexReconciler) SetupWithManager

func (r *CouchIndexReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up CouchIndexReconciler with the manager

type CouchReplicationReconciler

type CouchReplicationReconciler struct {
    client.Client
    NodeResourcePredicate
    kuberecorder.EventRecorder
    Name    string
    Config  *Config
    Metrics metrics.Metrics
    // contains filtered or unexported fields
}

func (*CouchReplicationReconciler) EnQueue

func (r *CouchReplicationReconciler) EnQueue(_ HostState, queue workqueue.RateLimitingInterface)

func (*CouchReplicationReconciler) Reconcile

func (r *CouchReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchReplicationReconciler) SetupWithManager

func (r *CouchReplicationReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up CouchReplicationReconciler with the manager

type CouchServerReconciler

type CouchServerReconciler struct {
    client.Client
    NodeResourcePredicate
    kuberecorder.EventRecorder
    ResourceManager *sap.ResourceManager
    Name            string
    Config          *Config
    Metrics         metrics.Metrics
    // contains filtered or unexported fields
}

func (*CouchServerReconciler) Reconcile

func (r *CouchServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchServerReconciler) SetupWithManager

func (r *CouchServerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up CouchServerReconciler with the manager

type CouchUserReconciler

type CouchUserReconciler struct {
    client.Client
    NodeResourcePredicate
    kuberecorder.EventRecorder
    SecretManager secretManager
    Name          string
    Config        *Config
    Metrics       metrics.Metrics

    ResourceManager *sap.ResourceManager
    // contains filtered or unexported fields
}

func (*CouchUserReconciler) CredsToSecretManager

func (r *CouchUserReconciler) CredsToSecretManager(ctx context.Context, user *dsapi.CouchDBUser, userCreds couchdb.CredentialsManager, couchReplicationCred bool) error

CredsToSecretManager takes in user and attempts to add the fields as secrets to secretmanager

func (*CouchUserReconciler) Reconcile

func (r *CouchUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*CouchUserReconciler) SetupWithManager

func (r *CouchUserReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up ComputeAddressReconciler with the manager

type Event

type Event struct {
    Topic     string    `json:"topic"` // must be `host` for HostState data
    HostState HostState `json:"data"`
}

type HostNetwork

type HostNetwork struct {
    LanOutageDetected bool `json:"lan-outage-detected"`
    LanOutageMode     bool `json:"lan-outage-mode"`
}

type HostState

type HostState struct {
    Hostname string      `json:"hostname"`
    Network  HostNetwork `json:"network"`
}

func (HostState) InLOM

func (h HostState) InLOM() bool

type InterlockClient

InterlockClient https://docs.edge-infra.dev/edge/sds/interlock/api/

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

func NewInterlockClient

func NewInterlockClient(baseURL string, cb func(e HostState, queue workqueue.RateLimitingInterface)) *InterlockClient

NewInterlockClient retrieves state of the cluster

func (*InterlockClient) GetHostState

func (c *InterlockClient) GetHostState(ctx context.Context) (*HostState, error)

func (*InterlockClient) Start

func (c *InterlockClient) Start(ctx context.Context, queue workqueue.RateLimitingInterface) error

type LeaderElection

type LeaderElection struct {
    Lock resourcelock.Interface
    // contains filtered or unexported fields
}

func NewLeaderElection

func NewLeaderElection(cs *coordinationv1client.CoordinationV1Client, namespace, name, id string) *LeaderElection

func (*LeaderElection) IsLeader

func (l *LeaderElection) IsLeader() bool

func (*LeaderElection) OnNewLeader

func (l *LeaderElection) OnNewLeader(ctx context.Context, cb func(leader bool))

type LeaderElector

type LeaderElector interface {
    Elect([]corev1.Node) (*corev1.Node, error)
}

type MockCouchDBCluster

type MockCouchDBCluster struct {
    sync.Mutex
    *utils.MockHTTPTestServer
    // contains filtered or unexported fields
}

func NewMockCouchDBCluster

func NewMockCouchDBCluster(config *Config, client client.Client,
    server *dsapi.CouchDBServer,
    database *dsapi.CouchDBDatabase,
    user *dsapi.CouchDBUser,
    index *dsapi.CouchDBIndex,
    ddoc *dsapi.CouchDBDesignDoc,
    replication *dsapi.CouchDBReplicationSet) (*MockCouchDBCluster, error)

NewMockCouchDBCluster allows us to run all integration tests without connecting to couchdb. Note: this does not replace integration test for couchdb

func (*MockCouchDBCluster) NotFound

func (c *MockCouchDBCluster) NotFound()

func (*MockCouchDBCluster) Port

func (c *MockCouchDBCluster) Port() string

type NodeMemoryComparison

type NodeMemoryComparison []corev1.Node

func (NodeMemoryComparison) Len

func (n NodeMemoryComparison) Len() int

func (NodeMemoryComparison) Less

func (n NodeMemoryComparison) Less(i, j int) bool

func (NodeMemoryComparison) Swap

func (n NodeMemoryComparison) Swap(i, j int)

type NodeMemoryElector

type NodeMemoryElector struct{}

func (NodeMemoryElector) Elect

func (NodeMemoryElector) Elect(nodes []corev1.Node) (*corev1.Node, error)

Elect returns a copy of the node elected as leader

type NodeResourcePredicate

type NodeResourcePredicate interface {
    ShouldReconcile(*Config, client.Object) bool
}

type NodeResourcePredicateFunc

type NodeResourcePredicateFunc func(*Config, client.Object) bool

func (NodeResourcePredicateFunc) ShouldReconcile

func (f NodeResourcePredicateFunc) ShouldReconcile(cfg *Config, obj client.Object) bool

type Payload

type Payload struct {
    Action string `json:"action"`
}

type PersistenceLeaderElector

type PersistenceLeaderElector interface {
    IsLeader() bool
}

type PersistenceLeaderElectorFunc

type PersistenceLeaderElectorFunc func() bool

func (PersistenceLeaderElectorFunc) IsLeader

func (r PersistenceLeaderElectorFunc) IsLeader() bool

type ReplicationEvent

type ReplicationEvent struct {
    sync.Mutex
    // contains filtered or unexported fields
}

func NewReplicationEvent

func NewReplicationEvent(cfg *Config) *ReplicationEvent

func (*ReplicationEvent) Listen

func (c *ReplicationEvent) Listen(repl *dsapi.CouchDBReplicationSet, username, password, url string) error

func (*ReplicationEvent) Start

func (c *ReplicationEvent) Start(ctx context.Context, queue workqueue.RateLimitingInterface) error

func (*ReplicationEvent) Stop

func (c *ReplicationEvent) Stop()

type ReplicationInfo

type ReplicationInfo struct {
    SourceURI      string
    SourceUsername string
    SourcePassword string

    TargetURI      string // http://localhost:5984
    TargetUsername string
    TargetPassword string
}

type RetryableErrorFunc

type RetryableErrorFunc func(err error) bool

type ServerSetupResponse

type ServerSetupResponse struct {
    State  string `json:"state,omitempty"`
    Error  string `json:"error,omitempty"`
    Reason string `json:"reason,omitempty"`
}

type Stat

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

func (Stat) Done

func (s Stat) Done() bool

func (Stat) String

func (s Stat) String() string

type State

type State int
const (
    Processing State = iota
    Done
    Error
)

type Substitution

type Substitution struct {
    Leader              bool
    DSDS                bool
    ServerName          string
    ServerType          dsapi.ServerType
    LaneNumber          string
    Suffix              string
    CouchDBStatefulSet  string
    ReplicationDB       string
    ReplicationSecret   string
    ReplicationSecretNS string
    NodeUID             string // optional for generic cluster, required for dsds cluster
    NodeName            string // optional for generic cluster, required for dsds cluster
    ChirpStatefulSet    string
    NodeInfo            *nameutils.NodeInfo
}

func LaneSubstitution

func LaneSubstitution(ni *nameutils.NodeInfo, nodeMapping map[string]map[string]string, replDB, leaderNodeUID string) Substitution

LaneSubstitution based on node labels Node UID is used for suffix

func StoreSubstitution

func StoreSubstitution(replDB string) Substitution

StoreSubstitution generic cluster don't have node labels, so we can use hard coded values

func ToSubstitution

func ToSubstitution(s map[SubstitutionVar]string) Substitution

func (Substitution) IsTouchpoint

func (s Substitution) IsTouchpoint() bool

func (Substitution) NodeClass

func (s Substitution) NodeClass() v1ien.Class

func (Substitution) NodeRole

func (s Substitution) NodeRole() v1ien.Role

type SubstitutionVar

type SubstitutionVar string

func ParseSubstitutions

func ParseSubstitutions(yamlString string) ([]SubstitutionVar, error)

ParseSubstitutions return a set of valid substitutions or error

Subdirectories

Name Synopsis
..
test_runner