stores

package
v0.0.0-...-82207cb Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

TODO: describe package here.

Index

Constants

View Source
const (
	CloudstateCassandraKeyspaceAnnotation = "cassandra.cloudstate.io/keyspace"
	CloudstateCassandraSecretAnnotation   = "cassandra.cloudstate.io/secret"

	CassandraKeySpaceEnvVar      = "CASSANDRA_KEYSPACE"
	CassandraContactPointsEnvVar = "CASSANDRA_CONTACT_POINTS"
	CassandraPortEnvVar          = "CASSANDRA_PORT"
	CassandraUsernameEnvVar      = "CASSANDRA_USERNAME"
	CassandraPasswordEnvVar      = "CASSANDRA_PASSWORD"
)
View Source
const (
	CloudstatePostgresDatabaseAnnotation = "postgres.cloudstate.io/database"
	CloudstatePostgresSecretAnnotation   = "postgres.cloudstate.io/secret"

	PostgresGoogleCloudSQLInstanceNotReady cloudstate.CloudstateConditionType = "CloudSqlInstanceNotReady"
	PostgresGoogleCloudSQLDatabaseNotReady cloudstate.CloudstateConditionType = "CloudSqlDatabaseNotReady"
	PostgresGoogleCloudSQLUserNotReady     cloudstate.CloudstateConditionType = "CloudSqlUserNotReady"
)
View Source
const (
	CloudstateGcpSecretAnnotation          = "gcp.cloudstate.io/secret"
	CloudstateSpannerDatabaseAnnotation    = "spanner.cloudstate.io/database"
	CloudstateSpannerTableSuffixAnnotation = "spanner.cloudstate.io/table-suffix"

	SpannerInstanceEnvVar    = "SPANNER_INSTANCE"
	SpannerDatabaseEnvVar    = "SPANNER_DATABASE"
	SpannerTableSuffixEnvVar = "SPANNER_TABLE_SUFFIX"
	GcpProjectEnvVar         = "GCP_PROJECT"

	GoogleApplicationCredentialsEnvVar     = "GOOGLE_APPLICATION_CREDENTIALS"
	GoogleApplicationCredentialsVolumeName = "google-application-credentials"
	GoogleApplicationCredentialsPath       = "/var/run/secrets/cloudstate.io/google-application-credentials"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CassandraStore

type CassandraStore struct {
	Config *config.CassandraConfig
}

func (*CassandraStore) InjectPodStoreConfig

func (s *CassandraStore) InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, container *corev1.Container, store *cloudstate.StatefulStore) error

func (*CassandraStore) ReconcileStatefulService

func (s *CassandraStore) ReconcileStatefulService(ctx context.Context, service *cloudstate.StatefulService, deployment *v1.Deployment, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, error)

func (*CassandraStore) ReconcileStatefulStore

func (s *CassandraStore) ReconcileStatefulStore(ctx context.Context, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, bool, error)

func (*CassandraStore) SetupWithStatefulServiceController

func (s *CassandraStore) SetupWithStatefulServiceController(builder *builder.Builder) error

func (*CassandraStore) SetupWithStatefulStoreController

func (s *CassandraStore) SetupWithStatefulStoreController(builder *builder.Builder) error

type InMemoryStore

type InMemoryStore struct {
	Config *config.InMemoryConfig
}

func (*InMemoryStore) InjectPodStoreConfig

func (s *InMemoryStore) InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, cloudstateSidecarContainer *corev1.Container, store *cloudstate.StatefulStore) error

func (*InMemoryStore) ReconcileStatefulService

func (s *InMemoryStore) ReconcileStatefulService(ctx context.Context, service *cloudstate.StatefulService, deployment *appsv1.Deployment, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, error)

func (*InMemoryStore) ReconcileStatefulStore

func (s *InMemoryStore) ReconcileStatefulStore(ctx context.Context, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, bool, error)

func (*InMemoryStore) SetupWithStatefulServiceController

func (s *InMemoryStore) SetupWithStatefulServiceController(builder *builder.Builder) error

func (*InMemoryStore) SetupWithStatefulStoreController

func (s *InMemoryStore) SetupWithStatefulStoreController(builder *builder.Builder) error

type MultiStores

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

func DefaultMultiStores

func DefaultMultiStores(client client.Client, scheme *runtime.Scheme, log logr.Logger, cfg *config.OperatorConfig) *MultiStores

func NewMultiStores

func NewMultiStores(client client.Client, stores map[StoreType]Store, cfg *config.OperatorConfig) *MultiStores

func (*MultiStores) InjectPodStoreConfig

func (m *MultiStores) InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, cloudstateSidecarContainer *corev1.Container) error

func (*MultiStores) ReconcileStatefulService

func (m *MultiStores) ReconcileStatefulService(ctx context.Context, service *v1alpha1.StatefulService, deployment *appsv1.Deployment) ([]v1alpha1.CloudstateCondition, error)

func (*MultiStores) ReconcileStatefulStore

func (m *MultiStores) ReconcileStatefulStore(ctx context.Context, store *v1alpha1.StatefulStore) ([]v1alpha1.CloudstateCondition, bool, error)

func (*MultiStores) SetupWithStatefulServiceController

func (m *MultiStores) SetupWithStatefulServiceController(builder *builder.Builder) error

func (*MultiStores) SetupWithStatefulStoreController

func (m *MultiStores) SetupWithStatefulStoreController(builder *builder.Builder) error

type NoStore

type NoStore struct {
	Config *config.NoStoreConfig
}

func (*NoStore) InjectPodStoreConfig

func (s *NoStore) InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, cloudstateSidecarContainer *corev1.Container, store *cloudstate.StatefulStore) error

func (*NoStore) ReconcileStatefulService

func (s *NoStore) ReconcileStatefulService(ctx context.Context, service *cloudstate.StatefulService, deployment *appsv1.Deployment, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, error)

func (*NoStore) ReconcileStatefulStore

func (s *NoStore) ReconcileStatefulStore(ctx context.Context, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, bool, error)

func (*NoStore) SetupWithStatefulServiceController

func (s *NoStore) SetupWithStatefulServiceController(builder *builder.Builder) error

func (*NoStore) SetupWithStatefulStoreController

func (s *NoStore) SetupWithStatefulStoreController(builder *builder.Builder) error

type PostgresStore

type PostgresStore struct {
	Client client.Client
	Scheme *runtime.Scheme
	Log    logr.Logger
	Config *config.PostgresConfig
	GCP    *config.GCPConfig
}

func (*PostgresStore) InjectPodStoreConfig

func (s *PostgresStore) InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, container *corev1.Container, store *cloudstate.StatefulStore) error

func (*PostgresStore) ReconcileStatefulService

func (s *PostgresStore) ReconcileStatefulService(ctx context.Context, service *cloudstate.StatefulService, deployment *appsv1.Deployment, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, error)

func (*PostgresStore) ReconcileStatefulStore

func (s *PostgresStore) ReconcileStatefulStore(ctx context.Context, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, bool, error)

func (*PostgresStore) SetupWithStatefulServiceController

func (s *PostgresStore) SetupWithStatefulServiceController(builder *builder.Builder) error

func (*PostgresStore) SetupWithStatefulStoreController

func (s *PostgresStore) SetupWithStatefulStoreController(builder *builder.Builder) error

type SpannerStore

type SpannerStore struct {
	Config *config.SpannerConfig
}

func (*SpannerStore) InjectPodStoreConfig

func (s *SpannerStore) InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod,
	container *corev1.Container, store *cloudstate.StatefulStore) error

func (*SpannerStore) ReconcileStatefulService

func (s *SpannerStore) ReconcileStatefulService(ctx context.Context, service *cloudstate.StatefulService,
	deployment *appsv1.Deployment, store *cloudstate.StatefulStore,
) ([]cloudstate.CloudstateCondition, error)

func (*SpannerStore) ReconcileStatefulStore

func (s *SpannerStore) ReconcileStatefulStore(ctx context.Context, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, bool, error)

func (*SpannerStore) SetupWithStatefulServiceController

func (s *SpannerStore) SetupWithStatefulServiceController(builder *builder.Builder) error

func (*SpannerStore) SetupWithStatefulStoreController

func (s *SpannerStore) SetupWithStatefulStoreController(builder *builder.Builder) error

type Store

type Store interface {
	InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, container *corev1.Container, store *cloudstate.StatefulStore) error

	ReconcileStatefulService(ctx context.Context, service *cloudstate.StatefulService, deployment *appsv1.Deployment, store *cloudstate.StatefulStore) ([]cloudstate.CloudstateCondition, error)
	SetupWithStatefulServiceController(builder *builder.Builder) error

	ReconcileStatefulStore(ctx context.Context, store *cloudstate.StatefulStore) (conditions []cloudstate.CloudstateCondition, updated bool, err error)
	SetupWithStatefulStoreController(builder *builder.Builder) error
}

type StoreType

type StoreType string
const (
	CloudstateStatefulStoreAnnotation = "cloudstate.io/stateful-store"

	CassandraStoreType StoreType = "cassandra"
	NoStoreType        StoreType = "no-store"
	InMemoryStoreType  StoreType = "in-memory"
	SpannerStoreType   StoreType = "spanner"
	PostgresStoreType  StoreType = "postgres"
)

type Stores

type Stores interface {
	// InjectPodStoreConfig injects configuration specific to a store.
	// At a minimum, the image that the container uses should be set. Additional environment variables specific to the
	// store may also be set, and volumes and mounts may be added if necessary. May also do some reconciliation of
	// other resources.
	InjectPodStoreConfig(ctx context.Context, name string, namespace string, pod *corev1.Pod, cloudstateSidecarContainer *corev1.Container) error

	ReconcileStatefulService(ctx context.Context, service *v1alpha1.StatefulService, deployment *appsv1.Deployment) ([]v1alpha1.CloudstateCondition, error)
	SetupWithStatefulServiceController(builder *builder.Builder) error

	ReconcileStatefulStore(ctx context.Context, store *v1alpha1.StatefulStore) (condition []v1alpha1.CloudstateCondition, updated bool, err error)
	SetupWithStatefulStoreController(builder *builder.Builder) error
}

Jump to

Keyboard shortcuts

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