Enable backward compatibility for enable_load_balancer setting from operator configmap
This commit is contained in:
parent
931b48fcbb
commit
a8862aeee1
|
|
@ -239,6 +239,8 @@ For any Postgresql/Spilo cluster an operator creates two separate k8s services:
|
||||||
|
|
||||||
For backward compatibility with already configured clusters we maintain in a cluster manifest older parameter names, namely `useLoadBalancer` for enabling the master service's load balancer and `replicaLoadBalancer` for the replica service. If set, these params take precedence over the newer `enableMasterLoadBalancer` and `enableReplicaLoadBalancer`. Note that in older versions of the operator (before PR #258) `replicaLoadBalancer` was responsible for both creating the replica service and attaching an LB to it; now the service is always created (since k8s service typically is free in the cloud setting), and this param only attaches an LB (that typically costs money).
|
For backward compatibility with already configured clusters we maintain in a cluster manifest older parameter names, namely `useLoadBalancer` for enabling the master service's load balancer and `replicaLoadBalancer` for the replica service. If set, these params take precedence over the newer `enableMasterLoadBalancer` and `enableReplicaLoadBalancer`. Note that in older versions of the operator (before PR #258) `replicaLoadBalancer` was responsible for both creating the replica service and attaching an LB to it; now the service is always created (since k8s service typically is free in the cloud setting), and this param only attaches an LB (that typically costs money).
|
||||||
|
|
||||||
|
For the same reason of compatibility, we maintain the `enable_load_balancer` setting in the operator config map that was previously used to attach a LB to the master service. Its value is examined after the deprecated `useLoadBalancer` setting from the Postgresql manifest but before the recommended `enableMasterLoadBalancer`. There is no equivalent option for the replica service since the service used to be always created with a load balancer.
|
||||||
|
|
||||||
# Setup development environment
|
# Setup development environment
|
||||||
|
|
||||||
The following steps guide you through the setup to work on the operator itself.
|
The following steps guide you through the setup to work on the operator itself.
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@ data:
|
||||||
team_admin_role: "admin"
|
team_admin_role: "admin"
|
||||||
teams_api_url: http://fake-teams-api.default.svc.cluster.local
|
teams_api_url: http://fake-teams-api.default.svc.cluster.local
|
||||||
workers: "4"
|
workers: "4"
|
||||||
enable_master_load_balancer: "true"
|
# turn on/off load balancers for all Postgres clusters managed by the operator
|
||||||
|
# LB settings in cluster manifests take priority over these settings
|
||||||
|
# enable_master_load_balancer: "true"
|
||||||
# enable_replica_load_balancer: "true"
|
# enable_replica_load_balancer: "true"
|
||||||
api_port: "8080"
|
api_port: "8080"
|
||||||
ring_log_lines: "100"
|
ring_log_lines: "100"
|
||||||
|
|
|
||||||
|
|
@ -696,8 +696,11 @@ func (c *Cluster) shouldCreateLoadBalancerForService(role PostgresRole, spec *sp
|
||||||
return *spec.UseLoadBalancer
|
return *spec.UseLoadBalancer
|
||||||
}
|
}
|
||||||
|
|
||||||
if spec.EnableMasterLoadBalancer != nil {
|
// `enable_load_balancer`` governs LB for a master service
|
||||||
return *spec.EnableMasterLoadBalancer
|
// there is no equivalent operator configmap option for the replica LB
|
||||||
|
if c.OpConfig.EnableLoadBalancer != nil {
|
||||||
|
c.logger.Debugf("The operator configmap sets the deprecated `enable_load_balancer` param. Consider using the `enable_master_load_balancer` or `enable_replica_load_balancer` instead.", c.Name)
|
||||||
|
return *c.OpConfig.EnableLoadBalancer
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.OpConfig.EnableMasterLoadBalancer
|
return c.OpConfig.EnableMasterLoadBalancer
|
||||||
|
|
|
||||||
|
|
@ -67,31 +67,33 @@ type Config struct {
|
||||||
Resources
|
Resources
|
||||||
Auth
|
Auth
|
||||||
Scalyr
|
Scalyr
|
||||||
WatchedNamespace string `name:"watched_namespace"` // special values: "*" means 'watch all namespaces', the empty string "" means 'watch a namespace where operator is deployed to'
|
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:"etcd-client.default.svc.cluster.local:2379"`
|
EtcdHost string `name:"etcd_host" default:"etcd-client.default.svc.cluster.local:2379"`
|
||||||
DockerImage string `name:"docker_image" default:"registry.opensource.zalan.do/acid/spiloprivate-9.6:1.2-p4"`
|
DockerImage string `name:"docker_image" default:"registry.opensource.zalan.do/acid/spiloprivate-9.6:1.2-p4"`
|
||||||
ServiceAccountName string `name:"service_account_name" default:"operator"`
|
ServiceAccountName string `name:"service_account_name" default:"operator"`
|
||||||
DbHostedZone string `name:"db_hosted_zone" default:"db.example.com"`
|
DbHostedZone string `name:"db_hosted_zone" default:"db.example.com"`
|
||||||
EtcdScope string `name:"etcd_scope" default:"service"`
|
EtcdScope string `name:"etcd_scope" default:"service"`
|
||||||
WALES3Bucket string `name:"wal_s3_bucket"`
|
WALES3Bucket string `name:"wal_s3_bucket"`
|
||||||
KubeIAMRole string `name:"kube_iam_role"`
|
KubeIAMRole string `name:"kube_iam_role"`
|
||||||
DebugLogging bool `name:"debug_logging" default:"true"`
|
DebugLogging bool `name:"debug_logging" default:"true"`
|
||||||
EnableDBAccess bool `name:"enable_database_access" default:"true"`
|
EnableDBAccess bool `name:"enable_database_access" default:"true"`
|
||||||
EnableTeamsAPI bool `name:"enable_teams_api" default:"true"`
|
EnableTeamsAPI bool `name:"enable_teams_api" default:"true"`
|
||||||
EnableTeamSuperuser bool `name:"enable_team_superuser" default:"false"`
|
EnableTeamSuperuser bool `name:"enable_team_superuser" default:"false"`
|
||||||
TeamAdminRole string `name:"team_admin_role" default:"admin"`
|
TeamAdminRole string `name:"team_admin_role" default:"admin"`
|
||||||
EnableMasterLoadBalancer bool `name:"enable_master_load_balancer" default:"false"`
|
EnableMasterLoadBalancer bool `name:"enable_master_load_balancer" default:"false"`
|
||||||
EnableReplicaLoadBalancer bool `name:"enable_replica_load_balancer" default:"false"`
|
EnableReplicaLoadBalancer bool `name:"enable_replica_load_balancer" default:"false"`
|
||||||
MasterDNSNameFormat stringTemplate `name:"master_dns_name_format" default:"{cluster}.{team}.{hostedzone}"`
|
// deprecated and kept for backward compatibility
|
||||||
ReplicaDNSNameFormat stringTemplate `name:"replica_dns_name_format" default:"{cluster}-repl.{team}.{hostedzone}"`
|
EnableLoadBalancer *bool `name:"enable_load_balancer" default:"true"`
|
||||||
PDBNameFormat stringTemplate `name:"pdb_name_format" default:"postgres-{cluster}-pdb"`
|
MasterDNSNameFormat stringTemplate `name:"master_dns_name_format" default:"{cluster}.{team}.{hostedzone}"`
|
||||||
Workers uint32 `name:"workers" default:"4"`
|
ReplicaDNSNameFormat stringTemplate `name:"replica_dns_name_format" default:"{cluster}-repl.{team}.{hostedzone}"`
|
||||||
APIPort int `name:"api_port" default:"8080"`
|
PDBNameFormat stringTemplate `name:"pdb_name_format" default:"postgres-{cluster}-pdb"`
|
||||||
RingLogLines int `name:"ring_log_lines" default:"100"`
|
Workers uint32 `name:"workers" default:"4"`
|
||||||
ClusterHistoryEntries int `name:"cluster_history_entries" default:"1000"`
|
APIPort int `name:"api_port" default:"8080"`
|
||||||
TeamAPIRoleConfiguration map[string]string `name:"team_api_role_configuration" default:"log_statement:all"`
|
RingLogLines int `name:"ring_log_lines" default:"100"`
|
||||||
PodTerminateGracePeriod time.Duration `name:"pod_terminate_grace_period" default:"5m"`
|
ClusterHistoryEntries int `name:"cluster_history_entries" default:"1000"`
|
||||||
ProtectedRoles []string `name:"protected_role_names" default:"admin"`
|
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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustMarshal marshals the config or panics
|
// MustMarshal marshals the config or panics
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue