Sketch operator conf/docs

This commit is contained in:
Sergey Dudoladov
2019-01-08 14:40:43 +01:00
parent ad397045f7
commit 4088e0090f
8 changed files with 76 additions and 25 deletions
@@ -120,25 +120,26 @@ type ScalyrConfiguration struct {
}
type OperatorConfigurationData struct {
EtcdHost string `json:"etcd_host,omitempty"`
DockerImage string `json:"docker_image,omitempty"`
Workers uint32 `json:"workers,omitempty"`
MinInstances int32 `json:"min_instances,omitempty"`
MaxInstances int32 `json:"max_instances,omitempty"`
ResyncPeriod Duration `json:"resync_period,omitempty"`
RepairPeriod Duration `json:"repair_period,omitempty"`
Sidecars map[string]string `json:"sidecar_docker_images,omitempty"`
PostgresUsersConfiguration PostgresUsersConfiguration `json:"users"`
Kubernetes KubernetesMetaConfiguration `json:"kubernetes"`
PostgresPodResources PostgresPodResourcesDefaults `json:"postgres_pod_resources"`
SetMemoryRequestToLimit bool `json:"set_memory_request_to_limit,omitempty"`
Timeouts OperatorTimeouts `json:"timeouts"`
LoadBalancer LoadBalancerConfiguration `json:"load_balancer"`
AWSGCP AWSGCPConfiguration `json:"aws_or_gcp"`
OperatorDebug OperatorDebugConfiguration `json:"debug"`
TeamsAPI TeamsAPIConfiguration `json:"teams_api"`
LoggingRESTAPI LoggingRESTAPIConfiguration `json:"logging_rest_api"`
Scalyr ScalyrConfiguration `json:"scalyr"`
EtcdHost string `json:"etcd_host,omitempty"`
DockerImage string `json:"docker_image,omitempty"`
Workers uint32 `json:"workers,omitempty"`
MinInstances int32 `json:"min_instances,omitempty"`
MaxInstances int32 `json:"max_instances,omitempty"`
ResyncPeriod Duration `json:"resync_period,omitempty"`
RepairPeriod Duration `json:"repair_period,omitempty"`
Sidecars map[string]string `json:"sidecar_docker_images,omitempty"`
PostgresUsersConfiguration PostgresUsersConfiguration `json:"users"`
Kubernetes KubernetesMetaConfiguration `json:"kubernetes"`
PostgresPodResources PostgresPodResourcesDefaults `json:"postgres_pod_resources"`
SetMemoryRequestToLimit bool `json:"set_memory_request_to_limit,omitempty"`
Timeouts OperatorTimeouts `json:"timeouts"`
LoadBalancer LoadBalancerConfiguration `json:"load_balancer"`
AWSGCP AWSGCPConfiguration `json:"aws_or_gcp"`
OperatorDebug OperatorDebugConfiguration `json:"debug"`
TeamsAPI TeamsAPIConfiguration `json:"teams_api"`
LoggingRESTAPI LoggingRESTAPIConfiguration `json:"logging_rest_api"`
Scalyr ScalyrConfiguration `json:"scalyr"`
LogicalBackup OperatorLogicalBackupConfiguration `json:"logical_backup"`
}
type OperatorConfigurationUsers struct {
@@ -149,3 +150,10 @@ type OperatorConfigurationUsers struct {
}
type Duration time.Duration
type OperatorLogicalBackupConfiguration struct {
EnableLogicalBackup bool `json:"enable_logical_backup,omitempty"`
LogicalBackupSchedule string `json:"logical_backup_schedule,omitempty"`
LogicalBackupDockerImage string `json:"logical_backup_docker_image,omitempty"`
LogicalBackupS3Bucket string `json:"logical_backup_s3_bucket,omitempty"`
}
+2 -5
View File
@@ -129,11 +129,8 @@ type UserFlags []string
// PostgresStatus contains status of the PostgreSQL cluster (running, creation failed etc.)
type PostgresStatus string
// CronSchedule is a convenience alias for string
type CronSchedule string
// LogicalBackup contains config of a k8s cron job responsible for running pg_dumpall
type LogicalBackup struct {
EnableLogicalBackup bool `json:"enable_logical_backup,omitempty"`
LogicalBackupSchedule CronSchedule `json:"logical_backup_schedule,omitempty"`
EnableLogicalBackup bool `json:"enable_logical_backup,omitempty"`
LogicalBackupSchedule string `json:"logical_backup_schedule,omitempty"`
}
+5
View File
@@ -97,5 +97,10 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
result.ScalyrCPULimit = fromCRD.Scalyr.ScalyrCPULimit
result.ScalyrMemoryLimit = fromCRD.Scalyr.ScalyrMemoryLimit
result.EnableLogicalBackup = fromCRD.LogicalBackup.EnableLogicalBackup
result.LogicalBackupSchedule = fromCRD.LogicalBackup.LogicalBackupSchedule
result.LogicalBackupDockerImage = fromCRD.LogicalBackup.LogicalBackupDockerImage
result.LogicalBackupS3Bucket = fromCRD.LogicalBackup.LogicalBackupS3Bucket
return result
}
+9
View File
@@ -64,12 +64,21 @@ type Scalyr struct {
ScalyrMemoryLimit string `name:"scalyr_memory_limit" default:"1Gi"`
}
// LogicalBackup
type LogicalBackup struct {
EnableLogicalBackup bool `json:"enable_logical_backup,omitempty"`
LogicalBackupSchedule string `json:"logical_backup_schedule,omitempty"`
LogicalBackupDockerImage string `json:"logical_backup_docker_image,omitempty"`
LogicalBackupS3Bucket string `json:"logical_backup_s3_bucket,omitempty"`
}
// Config describes operator config
type Config struct {
CRD
Resources
Auth
Scalyr
LogicalBackup
WatchedNamespace string `name:"watched_namespace"` // special values: "*" means 'watch all namespaces', the empty string "" means 'watch a namespace where operator is deployed to'
EtcdHost string `name:"etcd_host" default:""` // special values: the empty string "" means Patroni will use k8s as a DCS