cassandra

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowAlterRfDuringRangeMovement

func AllowAlterRfDuringRangeMovement(dcConfig *DatacenterConfig)

func ApplySystemReplication

func ApplySystemReplication(dcConfig *DatacenterConfig, replication SystemReplication)

ApplySystemReplication adds system properties to configure replication of system keyspaces.

func CreateJsonConfig

func CreateJsonConfig(config *api.CassandraConfig, cassandraVersion string) ([]byte, error)

CreateJsonConfig parses dcConfig into a raw JSON base64-encoded string.

func DatacenterReady

func DatacenterReady(dc *cassdcapi.CassandraDatacenter) bool

func DatacenterStopped

func DatacenterStopped(dc *cassdcapi.CassandraDatacenter) bool

func DatacenterStopping

func DatacenterStopping(dc *cassdcapi.CassandraDatacenter) bool

func DatacenterUpdatedAfter

func DatacenterUpdatedAfter(t time.Time, dc *cassdcapi.CassandraDatacenter) bool

func IsCassandra3

func IsCassandra3(version string) bool

func NewDatacenter

func NewDatacenter(klusterKey types.NamespacedName, template *DatacenterConfig) (*cassdcapi.CassandraDatacenter, error)

Types

type DatacenterConfig

type DatacenterConfig struct {
	Meta              api.EmbeddedObjectMeta
	Cluster           string
	ServerImage       string
	ServerVersion     string
	Size              int32
	Resources         *corev1.ResourceRequirements
	SystemReplication SystemReplication
	StorageConfig     *cassdcapi.StorageConfig
	Racks             []cassdcapi.Rack
	CassandraConfig   *api.CassandraConfig
	AdditionalSeeds   []string
	Networking        *cassdcapi.NetworkingConfig
}

DatacenterConfig provides the configuration to be applied to the CassandraDatacenter. A DatacenterConfig is essentially a coalescence of an api.CassandraClusterTemplate and an api.CassandraDatacenterTemplate. There are global, cluster-wide settings that need to be specified at the DC-level. Using a DatacenterConfig allows to keep the api types clean such that cluster-level settings won't leak into the dc-level settings.

func Coalesce

func Coalesce(clusterTemplate *api.CassandraClusterTemplate, dcTemplate *api.CassandraDatacenterTemplate) *DatacenterConfig

Coalesce combines the cluster and dc templates with override semantics. If a property is defined in both templates, the dc-level property takes precedence.

type ManagementApiFacade

type ManagementApiFacade interface {

	// CreateKeyspaceIfNotExists calls the management API "/ops/keyspace/create" endpoint to create a new keyspace if it
	// does not exist yet. Calling this method on an existing keyspace is a no-op.
	CreateKeyspaceIfNotExists(
		keyspaceName string,
		replication map[string]int,
	) error

	ListKeyspaces(
		keyspaceName string,
	) ([]string, error)

	AlterKeyspace(
		keyspaceName string,
		replicationSettings map[string]int) error
}

ManagementApiFacade is a component mirroring methods available on httphelper.NodeMgmtClient.

type ManagementApiFactory

type ManagementApiFactory interface {

	// NewManagementApiFacade returns a new ManagementApiFacade that will connect to the Management API of nodes in
	// the given datacenter. The k8sClient is used to fetch pods in that datacenter.
	NewManagementApiFacade(
		ctx context.Context,
		dc *cassdcapi.CassandraDatacenter,
		k8sClient client.Client,
		logger logr.Logger,
	) (ManagementApiFacade, error)
}

ManagementApiFactory creates request-scoped instances of ManagementApiFacade. This component exists mostly to allow tests to provide mocks for the Management API client.

func NewManagementApiFactory

func NewManagementApiFactory() ManagementApiFactory

type RemoteSeedsResolver

type RemoteSeedsResolver interface {
	ResolveSeedEndpoints(ctx context.Context, dc *cassdcapi.CassandraDatacenter, remoteClient client.Client) ([]string, error)
}

func NewRemoteSeedsResolver

func NewRemoteSeedsResolver() RemoteSeedsResolver

type SystemReplication

type SystemReplication struct {
	Datacenters       []string
	ReplicationFactor int
}

SystemReplication represents the replication factor of the system_auth, system_traces, and system_distributed keyspsces. This is applied to each datacenter. The replication should be configured per DC, but that is currently not supported. See https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/124 and https://github.com/k8ssandra/k8ssandra-operator/issues/91 for details. Note that when we can configure the replication per DC, this can be changed to a map[string]int.

func ComputeSystemReplication

func ComputeSystemReplication(kluster *api.K8ssandraCluster) SystemReplication

Jump to

Keyboard shortcuts

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