Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
88735a7
Resize volume by changing pvc size if enabled in config. (#958)
yanchenko-igor Jul 3, 2020
c10d309
bump pgBouncer image (#1050)
FxKu Jul 8, 2020
b80f976
test coverage (#1055)
yanchenko-igor Jul 10, 2020
3759634
delete secrets the right way (#1054)
FxKu Jul 10, 2020
ec932f8
Port-forward service instead of pod (#1040)
toonsevrin Jul 15, 2020
002b47e
Use scram-sha-256 hash if postgresql parameter password_encryption se…
yanchenko-igor Jul 16, 2020
102a353
update dependencies (#1080)
FxKu Jul 29, 2020
ece341d
Allow pod environment variables to also be sourced from a secret (#946)
frittentheke Jul 30, 2020
aab9b0a
chart ui: fix target namespace to allow '*' (#1082)
arichardet Jul 30, 2020
3bee590
fix index in TestGenerateSpiloPodEnvVarswq (#1084)
FxKu Jul 30, 2020
47b11f7
change Clone attribute of PostgresSpec to *CloneDescription (#1020)
hlihhovac Jul 30, 2020
f3ddce8
fix random order for pod environment tests (#1085)
FxKu Jul 30, 2020
7cf2fae
[WIP] Extend infrastructure roles handling (#1064)
erthalion Aug 5, 2020
43163cf
allow using both infrastructure_roles_options (#1090)
FxKu Aug 10, 2020
0508266
Remove all secrets on delete incl. pooler (#1091)
FxKu Aug 10, 2020
dfd0dd9
set search_path for default roles (#1065)
FxKu Aug 11, 2020
fc9ee76
UI Service port forwarding internal port is updated to 80 from 8081. …
sonaysevik Aug 11, 2020
808030a
update go modules (#1097)
FxKu Aug 12, 2020
0d81f97
Added build and node directory to gitignore file. (#1102)
Jan-M Aug 12, 2020
3ddc56e
allow delete only if annotations meet configured criteria (#1069)
FxKu Aug 13, 2020
dab704c
Add kustomize support to Postgres UI. (#1086)
hoangelos Aug 26, 2020
248ce9f
Update to go 1.14.7 (#1122)
FxKu Aug 26, 2020
30c8675
update kind and use with old storage class (#1121)
FxKu Aug 28, 2020
5e93aab
improve e2e test debugging (#1107)
FxKu Aug 28, 2020
e03e9f9
add missing omitempty directive to the attributes of PostgresSpec (#1…
hlihhovac Aug 31, 2020
03437b6
Update issue templates (#1051)
FxKu Sep 3, 2020
d8884a4
Allow to overwrite default ExternalTrafficPolicy for the service (#1136)
yanchenko-igor Sep 15, 2020
d09e418
Set user and group in security context (#1083)
ricoberger Sep 15, 2020
ab95eaa
Fixes #1130 (#1139)
neelasha-09 Sep 22, 2020
2a21cc4
Compare Postgres pod priority on Sync (#1144)
sdudoladov Sep 23, 2020
ffdb47f
remove outdated GSOC info (#1148)
sdudoladov Sep 25, 2020
3b6dc4f
Improve e2e tests (#1111)
sdudoladov Sep 25, 2020
21475f4
Cleanup config examples (#1151)
FxKu Sep 30, 2020
38e1518
update kind (#1156)
sdudoladov Oct 2, 2020
692c721
Introduce ENABLE_JSON_LOGGING env variable (#1158)
dajudge Oct 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow to overwrite default ExternalTrafficPolicy for the service (zal…
…ando#1136)

* Allow to overwrite default ExternalTrafficPolicy for the service
  • Loading branch information
yanchenko-igor authored Sep 15, 2020
commit d8884a40038eef397aed0e504b5241820ef65c5f
3 changes: 3 additions & 0 deletions docs/reference/operator_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ In the CRD-based configuration they are grouped under the `load_balancer` key.
replaced with the hosted zone (the value of the `db_hosted_zone` parameter).
No other placeholders are allowed.

* **external_traffic_policy** define external traffic policy for the load
balancer, it will default to `Cluster` if undefined.

## AWS or GCP interaction

The options in this group configure operator interactions with non-Kubernetes
Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/acid.zalan.do/v1/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,17 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
"replica_dns_name_format": {
Type: "string",
},
"external_traffic_policy": {
Type: "string",
Enum: []apiextv1beta1.JSON{
{
Raw: []byte(`"Cluster"`),
},
{
Raw: []byte(`"Local"`),
},
},
},
},
},
"aws_or_gcp": {
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/acid.zalan.do/v1/operator_configuration_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type LoadBalancerConfiguration struct {
CustomServiceAnnotations map[string]string `json:"custom_service_annotations,omitempty"`
MasterDNSNameFormat config.StringTemplate `json:"master_dns_name_format,omitempty"`
ReplicaDNSNameFormat config.StringTemplate `json:"replica_dns_name_format,omitempty"`
ExternalTrafficPolicy string `json:"external_traffic_policy" default:"Cluster"`
}

// AWSGCPConfiguration defines the configuration for AWS
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/k8sres.go
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ func (c *Cluster) generateService(role PostgresRole, spec *acidv1.PostgresSpec)
}

c.logger.Debugf("final load balancer source ranges as seen in a service spec (not necessarily applied): %q", serviceSpec.LoadBalancerSourceRanges)
serviceSpec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyType(c.OpConfig.ExternalTrafficPolicy)
serviceSpec.Type = v1.ServiceTypeLoadBalancer
} else if role == Replica {
// before PR #258, the replica service was only created if allocated a LB
Expand Down
80 changes: 80 additions & 0 deletions pkg/cluster/k8sres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1742,3 +1742,83 @@ func TestSidecars(t *testing.T) {
})

}

func TestGenerateService(t *testing.T) {
var spec acidv1.PostgresSpec
var cluster *Cluster
var enableLB bool = true
spec = acidv1.PostgresSpec{
TeamID: "myapp", NumberOfInstances: 1,
Resources: acidv1.Resources{
ResourceRequests: acidv1.ResourceDescription{CPU: "1", Memory: "10"},
ResourceLimits: acidv1.ResourceDescription{CPU: "1", Memory: "10"},
},
Volume: acidv1.Volume{
Size: "1G",
},
Sidecars: []acidv1.Sidecar{
acidv1.Sidecar{
Name: "cluster-specific-sidecar",
},
acidv1.Sidecar{
Name: "cluster-specific-sidecar-with-resources",
Resources: acidv1.Resources{
ResourceRequests: acidv1.ResourceDescription{CPU: "210m", Memory: "0.8Gi"},
ResourceLimits: acidv1.ResourceDescription{CPU: "510m", Memory: "1.4Gi"},
},
},
acidv1.Sidecar{
Name: "replace-sidecar",
DockerImage: "overwrite-image",
},
},
EnableMasterLoadBalancer: &enableLB,
}

cluster = New(
Config{
OpConfig: config.Config{
PodManagementPolicy: "ordered_ready",
ProtectedRoles: []string{"admin"},
Auth: config.Auth{
SuperUsername: superUserName,
ReplicationUsername: replicationUserName,
},
Resources: config.Resources{
DefaultCPURequest: "200m",
DefaultCPULimit: "500m",
DefaultMemoryRequest: "0.7Gi",
DefaultMemoryLimit: "1.3Gi",
},
SidecarImages: map[string]string{
"deprecated-global-sidecar": "image:123",
},
SidecarContainers: []v1.Container{
v1.Container{
Name: "global-sidecar",
},
// will be replaced by a cluster specific sidecar with the same name
v1.Container{
Name: "replace-sidecar",
Image: "replaced-image",
},
},
Scalyr: config.Scalyr{
ScalyrAPIKey: "abc",
ScalyrImage: "scalyr-image",
ScalyrCPURequest: "220m",
ScalyrCPULimit: "520m",
ScalyrMemoryRequest: "0.9Gi",
// ise default memory limit
},
ExternalTrafficPolicy: "Cluster",
},
}, k8sutil.KubernetesClient{}, acidv1.Postgresql{}, logger, eventRecorder)

service := cluster.generateService(Master, &spec)
assert.Equal(t, v1.ServiceExternalTrafficPolicyTypeCluster, service.Spec.ExternalTrafficPolicy)
cluster.OpConfig.ExternalTrafficPolicy = "Local"
service = cluster.generateService(Master, &spec)
assert.Equal(t, v1.ServiceExternalTrafficPolicyTypeLocal, service.Spec.ExternalTrafficPolicy)

}
1 change: 1 addition & 0 deletions pkg/controller/operator_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
result.CustomServiceAnnotations = fromCRD.LoadBalancer.CustomServiceAnnotations
result.MasterDNSNameFormat = fromCRD.LoadBalancer.MasterDNSNameFormat
result.ReplicaDNSNameFormat = fromCRD.LoadBalancer.ReplicaDNSNameFormat
result.ExternalTrafficPolicy = util.Coalesce(fromCRD.LoadBalancer.ExternalTrafficPolicy, "Cluster")

// AWS or GCP config
result.WALES3Bucket = fromCRD.AWSGCP.WALES3Bucket
Expand Down
2 changes: 2 additions & 0 deletions pkg/util/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ type Config struct {
EnablePodAntiAffinity bool `name:"enable_pod_antiaffinity" default:"false"`
PodAntiAffinityTopologyKey string `name:"pod_antiaffinity_topology_key" default:"kubernetes.io/hostname"`
StorageResizeMode string `name:"storage_resize_mode" default:"ebs"`
// ExternalTrafficPolicy for load balancer
ExternalTrafficPolicy string `name:"external_traffic_policy" default:"Cluster"`
// deprecated and kept for backward compatibility
EnableLoadBalancer *bool `name:"enable_load_balancer"`
MasterDNSNameFormat StringTemplate `name:"master_dns_name_format" default:"{cluster}.{team}.{hostedzone}"`
Expand Down