Skip to content

Commit f5a04a8

Browse files
authored
Merge pull request #25 from kloeckner-i/METAL-1890/fix
METAL-1890/fix
2 parents 8031dec + ea72039 commit f5a04a8

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

pkg/apis/kci/v1alpha1/dbinstance_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type PerconaCluster struct {
5555
type BackendServer struct {
5656
Host string `json:"host"`
5757
Port uint16 `json:"port"`
58-
MaxConnection uint8 `json:"maxConn"`
58+
MaxConnection uint16 `json:"maxConn"`
5959
ReadOnly bool `json:"readonly,omitempty"`
6060
}
6161

pkg/utils/proxy/cloudproxy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ func (cp *CloudProxy) deploymentSpec() (v1apps.DeploymentSpec, error) {
8989
},
9090
}
9191

92+
terminationGracePeriodSeconds := int64(120) // force kill pod after this time
93+
9294
return v1apps.DeploymentSpec{
9395
Replicas: &replicas,
9496
Selector: &metav1.LabelSelector{
@@ -106,6 +108,7 @@ func (cp *CloudProxy) deploymentSpec() (v1apps.DeploymentSpec, error) {
106108
Affinity: &v1.Affinity{
107109
PodAntiAffinity: podAntiAffinity(cp.Labels),
108110
},
111+
TerminationGracePeriodSeconds: &terminationGracePeriodSeconds,
109112
},
110113
},
111114
}, nil
@@ -115,12 +118,14 @@ func (cp *CloudProxy) container() (v1.Container, error) {
115118
RunAsUser := int64(2)
116119
AllowPrivilegeEscalation := false
117120
instanceArg := fmt.Sprintf("-instances=%s=tcp:0.0.0.0:%s", cp.InstanceConnectionName, strconv.FormatInt(int64(cp.Port), 10))
121+
timeoutSecond := 60 // wait given seconds after SIGTERM
122+
timeoutArg := fmt.Sprintf("-term_timeout=%ss", strconv.FormatInt(int64(timeoutSecond), 10))
118123

119124
return v1.Container{
120125
Name: "cloudsql-proxy",
121126
Image: conf.Instances.Google.ProxyConfig.Image,
122127
Command: []string{"/cloud_sql_proxy"},
123-
Args: []string{instanceArg, "-credential_file=/srv/gcloud/credentials.json"},
128+
Args: []string{instanceArg, "-credential_file=/srv/gcloud/credentials.json", timeoutArg},
124129
SecurityContext: &v1.SecurityContext{
125130
RunAsUser: &RunAsUser,
126131
AllowPrivilegeEscalation: &AllowPrivilegeEscalation,

0 commit comments

Comments
 (0)