dataresidency

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Overview

dataresidency holds the typed objects that define the schemas for default DataResidency for all components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigMapName

func ConfigMapName() string

ConfigMapName returns the name of the configmap to read for default data residency settings.

func ToContext

func ToContext(ctx context.Context, c *Config) context.Context

ToContext attaches the provided Config to the provided context, returning the new context with the Config attached.

Types

type Config

type Config struct {
	DataResidencyDefaults *Defaults
}

Config holds the collection of configurations that we attach to contexts. +k8s:deepcopy-gen=false

func FromContext

func FromContext(ctx context.Context) *Config

FromContext extracts a Config from the provided context.

func FromContextOrDefaults

func FromContextOrDefaults(ctx context.Context) *Config

FromContextOrDefaults is like FromContext, but when no Config is attached it returns a Config populated with the defaults for each of the Config fields.

type Defaults

type Defaults struct {
	// ClusterDefaults are the data residency defaults to use for all namepaces
	ClusterDefaults ScopedDefaults `json:"clusterDefaults,omitempty"`
}

Defaults includes the default values to be populated by the Webhook.

func NewDefaultsConfigFromConfigMap

func NewDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*Defaults, error)

NewDefaultsConfigFromConfigMap creates a Defaults from the supplied configMap.

func NewDefaultsConfigFromMap

func NewDefaultsConfigFromMap(data map[string]string) (*Defaults, error)

NewDefaultsConfigFromMap creates a Defaults from the supplied Map.

func (*Defaults) AllowedPersistenceRegions

func (d *Defaults) AllowedPersistenceRegions() []string

AllowedPersistenceRegions gets the AllowedPersistenceRegions setting in the default.

func (*Defaults) ComputeAllowedPersistenceRegions

func (d *Defaults) ComputeAllowedPersistenceRegions(topicConfig *pubsub.TopicConfig, clusterRegion string) bool

ComputeAllowedPersistenceRegions computes the final message storage policy in topicConfig. Return true if the topicConfig is updated.

func (*Defaults) DeepCopy

func (in *Defaults) DeepCopy() *Defaults

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Defaults.

func (*Defaults) DeepCopyInto

func (in *Defaults) DeepCopyInto(out *Defaults)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Defaults) Global added in v0.21.0

func (d *Defaults) Global() bool

Global gets the Global setting in the default.

type ScopedDefaults

type ScopedDefaults struct {
	// AllowedPersistenceRegions specifies the regions allowed for data
	// storage. Eg "us-east1". An empty configuration means no data residency
	// constraints.
	AllowedPersistenceRegions []string `json:"messagestoragepolicy.allowedpersistenceregions,omitempty"`
	// Global is an indicator that no data residency is set, the topic will follow Org Policy
	Global bool `json:"messagestoragepolicy.global,omitempty"`
}

ScopedDefaults are the data residency setting defaults.

func (*ScopedDefaults) DeepCopy

func (in *ScopedDefaults) DeepCopy() *ScopedDefaults

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScopedDefaults.

func (*ScopedDefaults) DeepCopyInto

func (in *ScopedDefaults) DeepCopyInto(out *ScopedDefaults)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Store

type Store struct {
	*configmap.UntypedStore
}

Store is a typed wrapper around configmap.Untyped store to handle our ConfigMaps. +k8s:deepcopy-gen=false

func NewStore

func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store

NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.

func (*Store) Load

func (s *Store) Load() *Config

Load creates a Config from the current config state of the Store.

func (*Store) ToContext

func (s *Store) ToContext(ctx context.Context) context.Context

ToContext attaches the current Config state to the provided context.

type StoreSingleton

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

+k8s:deepcopy-gen=false

func (*StoreSingleton) Store

func (s *StoreSingleton) Store(ctx context.Context, cmw configmap.Watcher) *Store

Jump to

Keyboard shortcuts

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