Skip to content

Commit 6fbc752

Browse files
authored
Merge pull request #47 from kloeckner-i/METAL-2613/backup_activedeadlineseconds
METAL-2613 configurable activedeadline seconds
2 parents b1c5b7e + 29ea46d commit 6fbc752

9 files changed

Lines changed: 13 additions & 7 deletions

File tree

helm/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
DB Operator is Kubernetes operator
33

44
## Prerequisites
5-
* Kubernetes 1.13+
6-
* Helm 2.11+
5+
* Kubernetes v1.14+
6+
* Helm v3.0.2+
77

88
## Configuring helm client
99
```
@@ -47,6 +47,7 @@ The following table lists the configurable parameters of the db-operator chart a
4747
| `config.instance.google.proxy.image` | Container image of google cloud proxy | `gcr.io/cloudsql-docker/gce-proxy:1.11` |
4848
| `config.instance.google.proxy.nodeSelector` | Node labels for google cloud proxy pod assignment | `{}` |
4949
| `config.backup.nodeSelector` | Node labels for backup pod assignment | `{}` |
50+
| `config.backup.activeDeadlineSeconds` | activeDeadlineSeconds of backup cronjob | `600` |
5051
| `config.backup.postgres.image` | Container image of backup cronjob (only for postgres databases) | `kloeckneri/pgdump-gcs:latest` |
5152
| `config.monitoring.nodeSelector` | Node labels for monitoring pod assignment | `{}` |
5253
| `config.monitoring.postgres.image` | Container image of prometheus exporter (only for postgres databases) | `wrouesnel/postgres_exporter:latest` |

helm/db-operator-0.4.0.tgz

5.79 KB
Binary file not shown.

helm/db-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ apiVersion: v1
22
appVersion: "1.0"
33
description: A Database Operator
44
name: db-operator
5-
version: 0.3.0
5+
version: 0.4.0

helm/db-operator/templates/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ data:
2121
proxy:
2222
image: {{ .Values.config.instance.percona.proxy.image }}
2323
backup:
24+
activeDeadlineSeconds: {{ .Values.config.backup.activeDeadlineSeconds }}
2425
nodeSelector:
2526
{{ toYaml .Values.config.backup.nodeSelector | indent 8 }}
2627
postgres:

helm/db-operator/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ config:
3737
proxy:
3838
image: severalnines/proxysql:2.0
3939
backup:
40+
activeDeadlineSeconds: 600 # 10m
4041
nodeSelector: {}
4142
postgres:
4243
image: "kloeckneri/pgdump-gcs:latest"

pkg/config/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func TestLoadConfig(t *testing.T) {
1515

1616
confStatic.Instances.Google.ClientSecretName = "cloudsql-readonly-serviceaccount"
1717
assert.Equal(t, confStatic.Instances.Google.ClientSecretName, confLoad.Instances.Google.ClientSecretName, "Values should be match")
18+
assert.EqualValues(t, confLoad.Backup.ActiveDeadlineSeconds, int64(600))
1819
}
1920

2021
func TestLoadConfigFailCases(t *testing.T) {

pkg/config/test/config_ok.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ instance:
1010
image: severalnines/proxysql:2.0
1111
backup:
1212
nodeSelector: {}
13+
activeDeadlineSeconds: 600
1314
postgres:
1415
image: postgresbackupimage:latest
1516
mysql:

pkg/config/types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ type proxyConfig struct {
3434
// backupConfig defines docker image for creating database dump by backup cronjob
3535
// backup cronjob will be created by db-operator when backup is enabled
3636
type backupConfig struct {
37-
Postgres postgresBackupConfig `yaml:"postgres"`
38-
Mysql mysqlBackupConfig `yaml:"mysql"`
39-
NodeSelector map[string]string `yaml:"nodeSelector"`
37+
Postgres postgresBackupConfig `yaml:"postgres"`
38+
Mysql mysqlBackupConfig `yaml:"mysql"`
39+
NodeSelector map[string]string `yaml:"nodeSelector"`
40+
ActiveDeadlineSeconds int64 `yaml:"activeDeadlineSeconds"`
4041
}
4142

4243
type postgresBackupConfig struct {

pkg/controller/database/backup/cronjob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func buildCronJobSpec(dbcr *kciv1alpha1.Database) (batchv1beta1.CronJobSpec, err
5353
}
5454

5555
func buildJobTemplate(dbcr *kciv1alpha1.Database) (batchv1beta1.JobTemplateSpec, error) {
56-
ActiveDeadlineSeconds := int64(60 * 10) // 10m
56+
ActiveDeadlineSeconds := int64(conf.Backup.ActiveDeadlineSeconds)
5757
BackoffLimit := int32(3)
5858
instance, err := dbcr.GetInstanceRef()
5959
if err != nil {

0 commit comments

Comments
 (0)