v110

package
v0.0.0-...-9ed255f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppStatePending AppState = "pending"
	AppStateInit             = "initializing"
	AppStateReady            = "ready"
	AppStateError            = "error"
)
View Source
const (
	ConditionTrue    ConditionStatus = "True"
	ConditionFalse                   = "False"
	ConditionUnknown                 = "Unknown"
)
View Source
const (
	ClusterReady   ClusterConditionType = "ClusterReady"
	ClusterInit                         = "ClusterInitializing"
	ClusterRSInit                       = "ReplsetInitialized"
	ClusterRSReady                      = "ReplsetReady"
	ClusterError                        = "Error"
)
View Source
const (
	MongodChiperModeUnset MongodChiperMode = ""
	MongodChiperModeCBC                    = "AES256-CBC"
	MongodChiperModeGCM                    = "AES256-GCM"
)
View Source
const (
	PlatformUndef      Platform = ""
	PlatformKubernetes          = "kubernetes"
	PlatformOpenshift           = "openshift"
)

Variables

View Source
var Bundle = []k8s.BundleObject{
	{
		Kind: "CustomResourceDefinition",
		Name: "perconaservermongodbs.psmdb.percona.com",
		Data: `
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: perconaservermongodbs.psmdb.percona.com
spec:
  group: psmdb.percona.com
  names:
    kind: PerconaServerMongoDB
    listKind: PerconaServerMongoDBList
    plural: perconaservermongodbs
    singular: perconaservermongodb
    shortNames:
    - psmdb
  scope: Namespaced
  versions:
    - name: v1
      storage: true
      served: true
    - name: v1alpha1
      storage: false
      served: true
  additionalPrinterColumns:
    - name: Status
      type: string
      JSONPath: .status.state
    - name: Age
      type: date
      JSONPath: .metadata.creationTimestamp
  subresources:
    status: {}
`,
	},
	{
		Kind: "CustomResourceDefinition",
		Name: "perconaservermongodbbackups.psmdb.percona.com",
		Data: `
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: perconaservermongodbbackups.psmdb.percona.com
spec:
  group: psmdb.percona.com
  names:
    kind: PerconaServerMongoDBBackup
    listKind: PerconaServerMongoDBBackupList
    plural: perconaservermongodbbackups
    singular: perconaservermongodbbackup
    shortNames:
    - psmdb-backup
  scope: Namespaced
  versions:
    - name: v1
      storage: true
      served: true
  additionalPrinterColumns:
    - name: Cluster
      type: string
      description: Cluster name
      JSONPath: .spec.psmdbCluster
    - name: Storage
      type: string
      description: Storage name from psmdb spec
      JSONPath: .spec.storageName
    - name: Destination
      type: string
      description: Backup destination
      JSONPath: .status.destination
    - name: Status
      type: string
      description: Job status
      JSONPath: .status.state
    - name: Completed
      description: Completed time
      type: date
      JSONPath: .status.completed
    - name: Age
      type: date
      JSONPath: .metadata.creationTimestamp
  subresources:
    status: {}
`,
	},
	{
		Kind: "CustomResourceDefinition",
		Name: "perconaservermongodbrestores.psmdb.percona.com",
		Data: `
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: perconaservermongodbrestores.psmdb.percona.com
spec:
  group: psmdb.percona.com
  names:
    kind: PerconaServerMongoDBRestore
    listKind: PerconaServerMongoDBRestoreList
    plural: perconaservermongodbrestores
    singular: perconaservermongodbrestore
    shortNames:
    - psmdb-restore
  scope: Namespaced
  versions:
    - name: v1
      storage: true
      served: true
  additionalPrinterColumns:
    - name: Cluster
      type: string
      description: Cluster name
      JSONPath: .spec.clusterName
    - name: Status
      type: string
      description: Job status
      JSONPath: .status.state
    - name: Age
      type: date
      JSONPath: .metadata.creationTimestamp
  subresources:
    status: {}
`,
	},
	{
		Kind: "Role",
		Name: "percona-server-mongodb-operator",
		Data: `
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: percona-server-mongodb-operator
rules:
  - apiGroups:
    - psmdb.percona.com
    resources:
    - perconaservermongodbs
    - perconaservermongodbs/status
    - perconaservermongodbbackups
    - perconaservermongodbbackups/status
    - perconaservermongodbrestores
    - perconaservermongodbrestores/status
    verbs:
    - get
    - list
    - update
    - watch
    - create
  - apiGroups:
    - ""
    resources:
    - pods
    - pods/exec
    - services
    - persistentvolumeclaims
    - secrets
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
  - apiGroups:
    - apps
    resources:
    - deployments
    - replicasets
    - statefulsets
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
  - apiGroups:
    - batch
    resources:
    - cronjobs
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
  - apiGroups:
    - policy
    resources:
    - poddisruptionbudgets
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
  - apiGroups:
    - certmanager.k8s.io
    resources:
    - issuers
    - certificates
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
    - deletecollection
`,
	},
	{
		Kind: "RoleBinding",
		Name: "default-account-percona-server-mongodb-operator",
		Data: `
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: default-account-percona-server-mongodb-operator
subjects:
- kind: ServiceAccount
  name: default
roleRef:
  kind: Role
  name: percona-server-mongodb-operator
  apiGroup: rbac.authorization.k8s.io
`,
	},
	{
		Kind: "Deployment",
		Name: "percona-server-mongodb-operator",
		Data: `
apiVersion: apps/v1
kind: Deployment
metadata:
  name: percona-server-mongodb-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: percona-server-mongodb-operator
  template:
    metadata:
      labels:
        name: percona-server-mongodb-operator
    spec:
      containers:
        - name: percona-server-mongodb-operator
          image: {{image}}
          ports:
          - containerPort: 60000
            name: metrics
          command:
          - percona-server-mongodb-operator
          imagePullPolicy: Always
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: OPERATOR_NAME
              value: percona-server-mongodb-operator
            - name: RESYNC_PERIOD
              value: 5s
            - name: LOG_VERBOSE
              value: "false"
`,
	},
}

Functions

This section is empty.

Types

type AppState

type AppState string

type Arbiter

type Arbiter struct {
	Enabled bool  `json:"enabled"`
	Size    int32 `json:"size"`
	MultiAZ
}

type AuditLogDestination

type AuditLogDestination string
var AuditLogDestinationFile AuditLogDestination = "file"

type AuditLogFormat

type AuditLogFormat string
var (
	AuditLogFormatBSON AuditLogFormat = "BSON"
	AuditLogFormatJSON AuditLogFormat = "JSON"
)

type BackupCompressionType

type BackupCompressionType string
var (
	BackupCompressionGzip BackupCompressionType = "gzip"
)

type BackupCoordinatorSpec

type BackupCoordinatorSpec struct {
	Resources                   *corev1.ResourceRequirements `json:"resources,omitempty"`
	StorageClass                string                       `json:"storageClass,omitempty"`
	EnableClientsLogging        bool                         `json:"enableClientsLogging,omitempty"`
	LivenessInitialDelaySeconds *int32                       `json:"livenessDelaySec,omitempty"`
	MultiAZ
}

type BackupDestinationType

type BackupDestinationType string
var (
	BackupDestinationS3   BackupDestinationType = "s3"
	BackupDestinationFile BackupDestinationType = "file"
)

type BackupSpec

type BackupSpec struct {
	Enabled          bool                             `json:"enabled"`
	Debug            bool                             `json:"debug"`
	RestartOnFailure *bool                            `json:"restartOnFailure,omitempty"`
	Coordinator      BackupCoordinatorSpec            `json:"coordinator,omitempty"`
	Storages         map[string]k8s.BackupStorageSpec `json:"storages,omitempty"`
	Image            string                           `json:"image,omitempty"`
	Tasks            []BackupTaskSpec                 `json:"tasks,omitempty"`
}

type BackupTaskSpec

type BackupTaskSpec struct {
	Name            string                `json:"name"`
	Enabled         bool                  `json:"enabled"`
	Schedule        string                `json:"schedule,omitempty"`
	StorageName     string                `json:"storageName,omitempty"`
	CompressionType BackupCompressionType `json:"compressionType,omitempty"`
}

type ClusterCondition

type ClusterCondition struct {
	Status             ConditionStatus      `json:"status"`
	Type               ClusterConditionType `json:"type"`
	LastTransitionTime metav1.Time          `json:"lastTransitionTime,omitempty"`
	Reason             string               `json:"reason,omitempty"`
	Message            string               `json:"message,omitempty"`
}

type ClusterConditionType

type ClusterConditionType string

type ClusterRole

type ClusterRole string
const (
	ClusterRoleShardSvr  ClusterRole = "shardsvr"
	ClusterRoleConfigSvr ClusterRole = "configsvr"
)

type ConditionStatus

type ConditionStatus string

type Expose

type Expose struct {
	Enabled    bool               `json:"enabled"`
	ExposeType corev1.ServiceType `json:"exposeType,omitempty"`
}

type MongodChiperMode

type MongodChiperMode string

MongodChiperMode is a cipher mode used by Data-at-Rest Encryption

type MongodSpec

type MongodSpec struct {
	Net                *MongodSpecNet                `json:"net,omitempty"`
	AuditLog           *MongodSpecAuditLog           `json:"auditLog,omitempty"`
	OperationProfiling *MongodSpecOperationProfiling `json:"operationProfiling,omitempty"`
	Replication        *MongodSpecReplication        `json:"replication,omitempty"`
	Security           *MongodSpecSecurity           `json:"security,omitempty"`
	SetParameter       *MongodSpecSetParameter       `json:"setParameter,omitempty"`
	Storage            *MongodSpecStorage            `json:"storage,omitempty"`
}

type MongodSpecAuditLog

type MongodSpecAuditLog struct {
	Destination AuditLogDestination `json:"destination,omitempty"`
	Format      AuditLogFormat      `json:"format,omitempty"`
	Filter      string              `json:"filter,omitempty"`
}

type MongodSpecInMemory

type MongodSpecInMemory struct {
	EngineConfig *MongodSpecInMemoryEngineConfig `json:"engineConfig,omitempty"`
}

type MongodSpecInMemoryEngineConfig

type MongodSpecInMemoryEngineConfig struct {
	InMemorySizeRatio float64 `json:"inMemorySizeRatio,omitempty"`
}

type MongodSpecMMAPv1

type MongodSpecMMAPv1 struct {
	NsSize     int  `json:"nsSize,omitempty"`
	Smallfiles bool `json:"smallfiles,omitempty"`
}

type MongodSpecNet

type MongodSpecNet struct {
	Port     int32 `json:"port,omitempty"`
	HostPort int32 `json:"hostPort,omitempty"`
}

type MongodSpecOperationProfiling

type MongodSpecOperationProfiling struct {
	Mode              OperationProfilingMode `json:"mode,omitempty"`
	SlowOpThresholdMs int                    `json:"slowOpThresholdMs,omitempty"`
	RateLimit         int                    `json:"rateLimit,omitempty"`
}

type MongodSpecReplication

type MongodSpecReplication struct {
	OplogSizeMB int `json:"oplogSizeMB,omitempty"`
}

type MongodSpecSecurity

type MongodSpecSecurity struct {
	RedactClientLogData  bool             `json:"redactClientLogData,omitempty"`
	EnableEncryption     *bool            `json:"enableEncryption,omitempty"`
	EncryptionKeySecret  string           `json:"encryptionKeySecret,omitempty"`
	EncryptionCipherMode MongodChiperMode `json:"encryptionCipherMode,omitempty"`
}

type MongodSpecSetParameter

type MongodSpecSetParameter struct {
	TTLMonitorSleepSecs                   int `json:"ttlMonitorSleepSecs,omitempty"`
	WiredTigerConcurrentReadTransactions  int `json:"wiredTigerConcurrentReadTransactions,omitempty"`
	WiredTigerConcurrentWriteTransactions int `json:"wiredTigerConcurrentWriteTransactions,omitempty"`
}

type MongodSpecStorage

type MongodSpecStorage struct {
	Engine         StorageEngine         `json:"engine,omitempty"`
	DirectoryPerDB bool                  `json:"directoryPerDB,omitempty"`
	SyncPeriodSecs int                   `json:"syncPeriodSecs,omitempty"`
	InMemory       *MongodSpecInMemory   `json:"inMemory,omitempty"`
	MMAPv1         *MongodSpecMMAPv1     `json:"mmapv1,omitempty"`
	WiredTiger     *MongodSpecWiredTiger `json:"wiredTiger,omitempty"`
}

type MongodSpecWiredTiger

type MongodSpecWiredTiger struct {
	CollectionConfig *MongodSpecWiredTigerCollectionConfig `json:"collectionConfig,omitempty"`
	EngineConfig     *MongodSpecWiredTigerEngineConfig     `json:"engineConfig,omitempty"`
	IndexConfig      *MongodSpecWiredTigerIndexConfig      `json:"indexConfig,omitempty"`
}

type MongodSpecWiredTigerCollectionConfig

type MongodSpecWiredTigerCollectionConfig struct {
	BlockCompressor *WiredTigerCompressor `json:"blockCompressor,omitempty"`
}

type MongodSpecWiredTigerEngineConfig

type MongodSpecWiredTigerEngineConfig struct {
	CacheSizeRatio      float64               `json:"cacheSizeRatio,omitempty"`
	DirectoryForIndexes bool                  `json:"directoryForIndexes,omitempty"`
	JournalCompressor   *WiredTigerCompressor `json:"journalCompressor,omitempty"`
}

type MongodSpecWiredTigerIndexConfig

type MongodSpecWiredTigerIndexConfig struct {
	PrefixCompression bool `json:"prefixCompression,omitempty"`
}

type MongosSpec

type MongosSpec struct {
	*ResourcesSpec `json:"resources,omitempty"`
	Port           int32 `json:"port,omitempty"`
	HostPort       int32 `json:"hostPort,omitempty"`
}

type MultiAZ

type MultiAZ struct {
	Affinity            *PodAffinity             `json:"affinity,omitempty"`
	NodeSelector        map[string]string        `json:"nodeSelector,omitempty"`
	Tolerations         []corev1.Toleration      `json:"tolerations,omitempty"`
	PriorityClassName   string                   `json:"priorityClassName,omitempty"`
	Annotations         map[string]string        `json:"annotations,omitempty"`
	Labels              map[string]string        `json:"labels,omitempty"`
	PodDisruptionBudget *PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
}

type OperationProfilingMode

type OperationProfilingMode string
const (
	OperationProfilingModeAll    OperationProfilingMode = "all"
	OperationProfilingModeSlowOp OperationProfilingMode = "slowOp"
)

type PMMSpec

type PMMSpec struct {
	Enabled    bool   `json:"enabled,omitempty"`
	ServerHost string `json:"serverHost,omitempty"`
	Image      string `json:"image,omitempty"`
}

type PerconaServerMongoDB

type PerconaServerMongoDB struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   PerconaServerMongoDBSpec   `json:"spec,omitempty"`
	Status PerconaServerMongoDBStatus `json:"status,omitempty"`

	StorageClassesAllocated PerconaServerMongoDBStorageClasses `json:"StorageClassesAllocated,omitempty"`
	StorageSizeAllocated    PerconaServerMongoDBStorageSizes   `json:"StorageSizeAllocated,omitempty"`
}

PerconaServerMongoDB is the Schema for the perconaservermongodbs API

func (*PerconaServerMongoDB) GetCR

func (cr *PerconaServerMongoDB) GetCR() (string, error)

func (*PerconaServerMongoDB) GetName

func (cr *PerconaServerMongoDB) GetName() string

func (*PerconaServerMongoDB) MarshalRequests

func (cr *PerconaServerMongoDB) MarshalRequests() error

func (*PerconaServerMongoDB) NewReplSet

func (cr *PerconaServerMongoDB) NewReplSet(name string, c config.ClusterConfig) error

func (*PerconaServerMongoDB) SetLabels

func (cr *PerconaServerMongoDB) SetLabels(labels map[string]string)

func (*PerconaServerMongoDB) SetNew

func (*PerconaServerMongoDB) UpdateWith

func (cr *PerconaServerMongoDB) UpdateWith(c config.ClusterConfig, s3 *k8s.BackupStorageSpec) (err error)

func (*PerconaServerMongoDB) Upgrade

func (cr *PerconaServerMongoDB) Upgrade(imgs map[string]string)

Upgrade upgrades culster with given images

type PerconaServerMongoDBList

type PerconaServerMongoDBList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PerconaServerMongoDB `json:"items"`
}

PerconaServerMongoDBList contains a list of PerconaServerMongoDB

type PerconaServerMongoDBSpec

type PerconaServerMongoDBSpec struct {
	Pause            bool                          `json:"pause,omitempty"`
	Platform         *Platform                     `json:"platform,omitempty"`
	Image            string                        `json:"image,omitempty"`
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	RunUID           int64                         `json:"runUid,omitempty"`
	UnsafeConf       bool                          `json:"allowUnsafeConfigurations"`
	Mongod           *MongodSpec                   `json:"mongod,omitempty"`
	Replsets         []*ReplsetSpec                `json:"replsets,omitempty"`
	Secrets          *SecretsSpec                  `json:"secrets,omitempty"`
	Backup           BackupSpec                    `json:"backup,omitempty"`
	ImagePullPolicy  corev1.PullPolicy             `json:"imagePullPolicy,omitempty"`
	PMM              PMMSpec                       `json:"pmm,omitempty"`
}

PerconaServerMongoDBSpec defines the desired state of PerconaServerMongoDB

type PerconaServerMongoDBStatus

type PerconaServerMongoDBStatus struct {
	Status     AppState                  `json:"state,omitempty"`
	Message    string                    `json:"message,omitempty"`
	Conditions []ClusterCondition        `json:"conditions,omitempty"`
	Replsets   map[string]*ReplsetStatus `json:"replsets,omitempty"`
}

PerconaServerMongoDBStatus defines the observed state of PerconaServerMongoDB

type PerconaServerMongoDBStorageClasses

type PerconaServerMongoDBStorageClasses struct {
	BackupCoordinator string `json:"backup-coordinator,omitempty"`
	DataPod           string `json:"mongod,omitempty"`
}

type PerconaServerMongoDBStorageSizes

type PerconaServerMongoDBStorageSizes struct {
	BackupCoordinator string `json:"backup-coordinator,omitempty"`
	DataPod           string `json:"mongod,omitempty"`
}

type Platform

type Platform string

type PodAffinity

type PodAffinity struct {
	TopologyKey *string          `json:"antiAffinityTopologyKey,omitempty"`
	Advanced    *corev1.Affinity `json:"advanced,omitempty"`
}

type PodDisruptionBudgetSpec

type PodDisruptionBudgetSpec struct {
	MinAvailable   *intstr.IntOrString `json:"minAvailable,omitempty"`
	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

type ReplsetMemberStatus

type ReplsetMemberStatus struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

type ReplsetSpec

type ReplsetSpec struct {
	Resources                    *ResourcesSpec `json:"resources,omitempty"`
	Name                         string         `json:"name"`
	Size                         int32          `json:"size"`
	ClusterRole                  ClusterRole    `json:"clusterRole,omitempty"`
	Arbiter                      Arbiter        `json:"arbiter,omitempty"`
	Expose                       Expose         `json:"expose,omitempty"`
	VolumeSpec                   *VolumeSpec    `json:"volumeSpec,omitempty"`
	ReadinessInitialDelaySeconds *int32         `json:"readinessDelaySec,omitempty"`
	LivenessInitialDelaySeconds  *int32         `json:"livenessDelaySec,omitempty"`
	MultiAZ
}

type ReplsetStatus

type ReplsetStatus struct {
	Members     []*ReplsetMemberStatus `json:"members,omitempty"`
	ClusterRole ClusterRole            `json:"clusterRole,omitempty"`

	Initialized bool     `json:"initialized,omitempty"`
	Size        int32    `json:"size"`
	Ready       int32    `json:"ready"`
	Status      AppState `json:"status,omitempty"`
	Message     string   `json:"message,omitempty"`
}

type ResourceSpecRequirements

type ResourceSpecRequirements struct {
	CPU    string `json:"cpu,omitempty"`
	Memory string `json:"memory,omitempty"`
}

type ResourcesSpec

type ResourcesSpec struct {
	Limits   *ResourceSpecRequirements `json:"limits,omitempty"`
	Requests *ResourceSpecRequirements `json:"requests,omitempty"`
}

type SecretsSpec

type SecretsSpec struct {
	Users       string `json:"users,omitempty"`
	SSL         string `json:"ssl,omitempty"`
	SSLInternal string `json:"sslInternal,omitempty"`
}

type StorageEngine

type StorageEngine string
var (
	StorageEngineWiredTiger StorageEngine = "wiredTiger"
	StorageEngineInMemory   StorageEngine = "inMemory"
	StorageEngineMMAPv1     StorageEngine = "mmapv1"
)

type VolumeSpec

type VolumeSpec struct {
	// EmptyDir represents a temporary directory that shares a pod's lifetime.
	EmptyDir *corev1.EmptyDirVolumeSource `json:"emptyDir,omitempty"`

	// HostPath represents a pre-existing file or directory on the host machine
	// that is directly exposed to the container.
	HostPath *corev1.HostPathVolumeSource `json:"hostPath,omitempty"`

	// PersistentVolumeClaim represents a reference to a PersistentVolumeClaim.
	// It has the highest level of precedence, followed by HostPath and
	// EmptyDir. And represents the PVC specification.
	PersistentVolumeClaim *corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaim,omitempty"`
}

type WiredTigerCompressor

type WiredTigerCompressor string
var (
	WiredTigerCompressorNone   WiredTigerCompressor = "none"
	WiredTigerCompressorSnappy WiredTigerCompressor = "snappy"
	WiredTigerCompressorZlib   WiredTigerCompressor = "zlib"
)

Jump to

Keyboard shortcuts

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