config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSGCPConfiguration

type AWSGCPConfiguration struct {
	WALES3Bucket string `json:"wal_s3_bucket,omitempty"`
	AWSRegion    string `json:"aws_region,omitempty"`
	LogS3Bucket  string `json:"log_s3_bucket,omitempty"`
	KubeIAMRole  string `json:"kube_iam_role,omitempty"`
}

type Auth

type Auth struct {
	SecretNameTemplate            stringTemplate      `name:"secret_name_template" default:"{username}.{cluster}.credentials.{tprkind}.{tprgroup}"`
	PamRoleName                   string              `name:"pam_role_name" default:"zalandos"`
	PamConfiguration              string              `name:"pam_configuration" default:"https://info.example.com/oauth2/tokeninfo?access_token= uid realm=/employees"`
	TeamsAPIUrl                   string              `name:"teams_api_url" default:"https://teams.example.com/api/"`
	OAuthTokenSecretName          spec.NamespacedName `name:"oauth_token_secret_name" default:"postgresql-operator"`
	InfrastructureRolesSecretName spec.NamespacedName `name:"infrastructure_roles_secret_name"`
	SuperUsername                 string              `name:"super_username" default:"postgres"`
	ReplicationUsername           string              `name:"replication_username" default:"standby"`
}

Auth describes authentication specific configuration parameters

type CRD

type CRD struct {
	ReadyWaitInterval time.Duration `name:"ready_wait_interval" default:"4s"`
	ReadyWaitTimeout  time.Duration `name:"ready_wait_timeout" default:"30s"`
	ResyncPeriod      time.Duration `name:"resync_period" default:"30m"`
	RepairPeriod      time.Duration `name:"repair_period" default:"5m"`
}

CRD describes CustomResourceDefinition specific configuration parameters

type Config

type Config struct {
	CRD
	Resources
	Auth
	Scalyr

	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
	DockerImage      string            `name:"docker_image" default:"registry.opensource.zalan.do/acid/spilo-cdp-10:1.4-p8"`
	Sidecars         map[string]string `name:"sidecar_docker_images"`
	// default name `operator` enables backward compatibility with the older ServiceAccountName field
	PodServiceAccountName string `name:"pod_service_account_name" default:"operator"`
	// value of this string must be valid JSON or YAML; see initPodServiceAccount
	PodServiceAccountDefinition            string `name:"pod_service_account_definition" default:""`
	PodServiceAccountRoleBindingDefinition string `name:"pod_service_account_role_binding_definition" default:""`
	DbHostedZone                           string `name:"db_hosted_zone" default:"db.example.com"`
	AWSRegion                              string `name:"aws_region" default:"eu-central-1"`
	WALES3Bucket                           string `name:"wal_s3_bucket"`
	LogS3Bucket                            string `name:"log_s3_bucket"`
	KubeIAMRole                            string `name:"kube_iam_role"`
	DebugLogging                           bool   `name:"debug_logging" default:"true"`
	EnableDBAccess                         bool   `name:"enable_database_access" default:"true"`
	EnableTeamsAPI                         bool   `name:"enable_teams_api" default:"true"`
	EnableTeamSuperuser                    bool   `name:"enable_team_superuser" default:"false"`
	TeamAdminRole                          string `name:"team_admin_role" default:"admin"`
	EnableMasterLoadBalancer               bool   `name:"enable_master_load_balancer" default:"true"`
	EnableReplicaLoadBalancer              bool   `name:"enable_replica_load_balancer" default:"false"`
	// deprecated and kept for backward compatibility
	EnableLoadBalancer       *bool             `name:"enable_load_balancer"`
	MasterDNSNameFormat      stringTemplate    `name:"master_dns_name_format" default:"{cluster}.{team}.{hostedzone}"`
	ReplicaDNSNameFormat     stringTemplate    `name:"replica_dns_name_format" default:"{cluster}-repl.{team}.{hostedzone}"`
	PDBNameFormat            stringTemplate    `name:"pdb_name_format" default:"postgres-{cluster}-pdb"`
	Workers                  uint32            `name:"workers" default:"4"`
	APIPort                  int               `name:"api_port" default:"8080"`
	RingLogLines             int               `name:"ring_log_lines" default:"100"`
	ClusterHistoryEntries    int               `name:"cluster_history_entries" default:"1000"`
	TeamAPIRoleConfiguration map[string]string `name:"team_api_role_configuration" default:"log_statement:all"`
	PodTerminateGracePeriod  time.Duration     `name:"pod_terminate_grace_period" default:"5m"`
	ProtectedRoles           []string          `name:"protected_role_names" default:"admin"`
}

Config describes operator config

func Copy

func Copy(c *Config) Config

Copy creates a copy of the config

func NewFromMap

func NewFromMap(m map[string]string) *Config

NewFromMap creates Config from the map

func (Config) MustMarshal

func (c Config) MustMarshal() string

MustMarshal marshals the config or panics

type KubernetesMetaConfiguration

type KubernetesMetaConfiguration struct {
	PodServiceAccountName string `json:"pod_service_account_name,omitempty"`
	// TODO: change it to the proper json
	PodServiceAccountDefinition            string              `json:"pod_service_account_definition,omitempty"`
	PodServiceAccountRoleBindingDefinition string              `json:"pod_service_account_role_binding_definition,omitempty"`
	PodTerminateGracePeriod                spec.Duration       `json:"pod_terminate_grace_period,omitempty"`
	WatchedNamespace                       string              `json:"watched_namespace,omitempty"`
	PDBNameFormat                          stringTemplate      `json:"pdb_name_format,omitempty"`
	SecretNameTemplate                     stringTemplate      `json:"secret_name_template,omitempty"`
	OAuthTokenSecretName                   spec.NamespacedName `json:"oauth_token_secret_name,omitempty"`
	InfrastructureRolesSecretName          spec.NamespacedName `json:"infrastructure_roles_secret_name,omitempty"`
	PodRoleLabel                           string              `json:"pod_role_label,omitempty"`
	ClusterLabels                          map[string]string   `json:"cluster_labels,omitempty"`
	ClusterNameLabel                       string              `json:"cluster_name_label,omitempty"`
	NodeReadinessLabel                     map[string]string   `json:"node_readiness_label,omitempty"`
	// TODO: use a proper toleration structure?
	PodToleration map[string]string `json:"toleration,omitempty"`
	// TODO: use namespacedname
	PodEnvironmentConfigMap string `json:"pod_environment_configmap,omitempty"`
	PodPriorityClassName    string `json:"pod_priority_class_name,omitempty"`
}

type LoadBalancerConfiguration

type LoadBalancerConfiguration struct {
	DbHostedZone              string         `json:"db_hosted_zone,omitempty"`
	EnableMasterLoadBalancer  bool           `json:"enable_master_load_balancer,omitempty"`
	EnableReplicaLoadBalancer bool           `json:"enable_replica_load_balancer,omitempty"`
	MasterDNSNameFormat       stringTemplate `json:"master_dns_name_format,omitempty"`
	ReplicaDNSNameFormat      stringTemplate `json:"replica_dns_name_format,omitempty"`
}

type LoggingRESTAPIConfiguration

type LoggingRESTAPIConfiguration struct {
	APIPort               int `json:"api_port,omitempty"`
	RingLogLines          int `json:"ring_log_lines,omitempty"`
	ClusterHistoryEntries int `json:"cluster_history_entries,omitempty"`
}

type OperatorConfiguration

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

	Configuration OperatorConfigurationData `json:"configuration"`
	Error         error                     `json:"-"`
}

func (*OperatorConfiguration) DeepCopy

func (*OperatorConfiguration) DeepCopyInto

func (opc *OperatorConfiguration) DeepCopyInto(out *OperatorConfiguration)

func (*OperatorConfiguration) DeepCopyObject

func (opc *OperatorConfiguration) DeepCopyObject() runtime.Object

func (*OperatorConfiguration) UnmarshalJSON

func (opc *OperatorConfiguration) UnmarshalJSON(data []byte) error

type OperatorConfigurationCopy

type OperatorConfigurationCopy OperatorConfiguration

type OperatorConfigurationData

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               spec.Duration                `json:"resync_period,omitempty"`
	RepairPeriod               spec.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"`
	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"`
}

type OperatorConfigurationList

type OperatorConfigurationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []OperatorConfiguration `json:"items"`
}

func (*OperatorConfigurationList) DeepCopy

func (*OperatorConfigurationList) DeepCopyInto

func (opcl *OperatorConfigurationList) DeepCopyInto(out *OperatorConfigurationList)

func (*OperatorConfigurationList) DeepCopyObject

func (opcl *OperatorConfigurationList) DeepCopyObject() runtime.Object

func (*OperatorConfigurationList) UnmarshalJSON

func (opcl *OperatorConfigurationList) UnmarshalJSON(data []byte) error

type OperatorConfigurationListCopy

type OperatorConfigurationListCopy OperatorConfigurationList

type OperatorConfigurationUsers

type OperatorConfigurationUsers struct {
	SuperUserName            string            `json:"superuser_name,omitempty"`
	Replication              string            `json:"replication_user_name,omitempty"`
	ProtectedRoles           []string          `json:"protected_roles,omitempty"`
	TeamAPIRoleConfiguration map[string]string `json:"team_api_role_configuration,omitempty"`
}

type OperatorDebugConfiguration

type OperatorDebugConfiguration struct {
	DebugLogging   bool `json:"debug_logging,omitempty"`
	EnableDBAccess bool `json:"enable_database_access,omitempty"`
}

type OperatorTimeouts

type OperatorTimeouts struct {
	ResourceCheckInterval  spec.Duration `json:"resource_check_interval,omitempty"`
	ResourceCheckTimeout   spec.Duration `json:"resource_check_timeout,omitempty"`
	PodLabelWaitTimeout    spec.Duration `json:"pod_label_wait_timeout,omitempty"`
	PodDeletionWaitTimeout spec.Duration `json:"pod_deletion_wait_timeout,omitempty"`
	ReadyWaitInterval      spec.Duration `json:"ready_wait_interval,omitempty"`
	ReadyWaitTimeout       spec.Duration `json:"ready_wait_timeout,omitempty"`
}

type PostgresPodResourcesDefaults

type PostgresPodResourcesDefaults struct {
	DefaultCPURequest    string `json:"default_cpu_request,omitempty"`
	DefaultMemoryRequest string `json:"default_memory_request,omitempty"`
	DefaultCPULimit      string `json:"default_cpu_limit,omitempty"`
	DefaultMemoryLimit   string `json:"default_memory_limit,omitempty"`
}

type PostgresUsersConfiguration

type PostgresUsersConfiguration struct {
	SuperUsername       string `json:"super_username,omitempty"`
	ReplicationUsername string `json:"replication_username,omitempty"`
}

type Resources

type Resources struct {
	ResourceCheckInterval   time.Duration     `name:"resource_check_interval" default:"3s"`
	ResourceCheckTimeout    time.Duration     `name:"resource_check_timeout" default:"10m"`
	PodLabelWaitTimeout     time.Duration     `name:"pod_label_wait_timeout" default:"10m"`
	PodDeletionWaitTimeout  time.Duration     `name:"pod_deletion_wait_timeout" default:"10m"`
	PodTerminateGracePeriod time.Duration     `name:"pod_terminate_grace_period" default:"5m"`
	PodPriorityClassName    string            `name:"pod_priority_class_name"`
	ClusterLabels           map[string]string `name:"cluster_labels" default:"application:spilo"`
	ClusterNameLabel        string            `name:"cluster_name_label" default:"cluster-name"`
	PodRoleLabel            string            `name:"pod_role_label" default:"spilo-role"`
	PodToleration           map[string]string `name:"toleration" default:""`
	DefaultCPURequest       string            `name:"default_cpu_request" default:"100m"`
	DefaultMemoryRequest    string            `name:"default_memory_request" default:"100Mi"`
	DefaultCPULimit         string            `name:"default_cpu_limit" default:"3"`
	DefaultMemoryLimit      string            `name:"default_memory_limit" default:"1Gi"`
	PodEnvironmentConfigMap string            `name:"pod_environment_configmap" default:""`
	NodeReadinessLabel      map[string]string `name:"node_readiness_label" default:""`
	MaxInstances            int32             `name:"max_instances" default:"-1"`
	MinInstances            int32             `name:"min_instances" default:"-1"`
}

Resources describes kubernetes resource specific configuration parameters

type Scalyr

type Scalyr struct {
	ScalyrAPIKey        string `name:"scalyr_api_key" default:""`
	ScalyrImage         string `name:"scalyr_image" default:""`
	ScalyrServerURL     string `name:"scalyr_server_url" default:"https://upload.eu.scalyr.com"`
	ScalyrCPURequest    string `name:"scalyr_cpu_request" default:"100m"`
	ScalyrMemoryRequest string `name:"scalyr_memory_request" default:"50Mi"`
	ScalyrCPULimit      string `name:"scalyr_cpu_limit" default:"1"`
	ScalyrMemoryLimit   string `name:"scalyr_memory_limit" default:"1Gi"`
}

Scalyr holds the configuration for the Scalyr Agent sidecar for log shipping:

type ScalyrConfiguration

type ScalyrConfiguration struct {
	ScalyrAPIKey        string `json:"scalyr_api_key,omitempty"`
	ScalyrImage         string `json:"scalyr_image,omitempty"`
	ScalyrServerURL     string `json:"scalyr_server_url,omitempty"`
	ScalyrCPURequest    string `json:"scalyr_cpu_request,omitempty"`
	ScalyrMemoryRequest string `json:"scalyr_memory_request,omitempty"`
	ScalyrCPULimit      string `json:"scalyr_cpu_limit,omitempty"`
	ScalyrMemoryLimit   string `json:"scalyr_memory_limit,omitempty"`
}

type TeamsAPIConfiguration

type TeamsAPIConfiguration struct {
	EnableTeamsAPI           bool              `json:"enable_teams_api,omitempty"`
	TeamsAPIUrl              string            `json:"teams_api_url,omitempty"`
	TeamAPIRoleConfiguration map[string]string `json:"team_api_role_configuration,omitempty"`
	EnableTeamSuperuser      bool              `json:"enable_team_superuser,omitempty"`
	TeamAdminRole            string            `json:"team_admin_role,omitempty"`
	PamRoleName              string            `json:"pam_role_name,omitempty"`
	PamConfiguration         string            `json:"pam_configuration,omitempty"`
	ProtectedRoles           []string          `json:"protected_role_names,omitempty"`
}

Jump to

Keyboard shortcuts

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