diff --git a/helm/README.md b/helm/README.md index 66df70fd..e45237fc 100644 --- a/helm/README.md +++ b/helm/README.md @@ -2,8 +2,8 @@ DB Operator is Kubernetes operator ## Prerequisites -* Kubernetes 1.13+ -* Helm 2.11+ +* Kubernetes v1.14+ +* Helm v3.0.2+ ## Configuring helm client ``` @@ -47,6 +47,7 @@ The following table lists the configurable parameters of the db-operator chart a | `config.instance.google.proxy.image` | Container image of google cloud proxy | `gcr.io/cloudsql-docker/gce-proxy:1.11` | | `config.instance.google.proxy.nodeSelector` | Node labels for google cloud proxy pod assignment | `{}` | | `config.backup.nodeSelector` | Node labels for backup pod assignment | `{}` | +| `config.backup.activeDeadlineSeconds` | activeDeadlineSeconds of backup cronjob | `600` | | `config.backup.postgres.image` | Container image of backup cronjob (only for postgres databases) | `kloeckneri/pgdump-gcs:latest` | | `config.monitoring.nodeSelector` | Node labels for monitoring pod assignment | `{}` | | `config.monitoring.postgres.image` | Container image of prometheus exporter (only for postgres databases) | `wrouesnel/postgres_exporter:latest` | diff --git a/helm/db-operator-0.4.0.tgz b/helm/db-operator-0.4.0.tgz new file mode 100644 index 00000000..8e434b04 Binary files /dev/null and b/helm/db-operator-0.4.0.tgz differ diff --git a/helm/db-operator/Chart.yaml b/helm/db-operator/Chart.yaml index ba9d2606..cfdcfe6f 100644 --- a/helm/db-operator/Chart.yaml +++ b/helm/db-operator/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: A Database Operator name: db-operator -version: 0.3.0 +version: 0.4.0 diff --git a/helm/db-operator/templates/config.yaml b/helm/db-operator/templates/config.yaml index 186f1cb6..219ae4f7 100644 --- a/helm/db-operator/templates/config.yaml +++ b/helm/db-operator/templates/config.yaml @@ -21,6 +21,7 @@ data: proxy: image: {{ .Values.config.instance.percona.proxy.image }} backup: + activeDeadlineSeconds: {{ .Values.config.backup.activeDeadlineSeconds }} nodeSelector: {{ toYaml .Values.config.backup.nodeSelector | indent 8 }} postgres: diff --git a/helm/db-operator/values.yaml b/helm/db-operator/values.yaml index fb63c96a..48074876 100644 --- a/helm/db-operator/values.yaml +++ b/helm/db-operator/values.yaml @@ -37,6 +37,7 @@ config: proxy: image: severalnines/proxysql:2.0 backup: + activeDeadlineSeconds: 600 # 10m nodeSelector: {} postgres: image: "kloeckneri/pgdump-gcs:latest" diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 1b61d7ad..25e7e862 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -15,6 +15,7 @@ func TestLoadConfig(t *testing.T) { confStatic.Instances.Google.ClientSecretName = "cloudsql-readonly-serviceaccount" assert.Equal(t, confStatic.Instances.Google.ClientSecretName, confLoad.Instances.Google.ClientSecretName, "Values should be match") + assert.EqualValues(t, confLoad.Backup.ActiveDeadlineSeconds, int64(600)) } func TestLoadConfigFailCases(t *testing.T) { diff --git a/pkg/config/test/config_ok.yaml b/pkg/config/test/config_ok.yaml index 78e255ab..73f866bb 100644 --- a/pkg/config/test/config_ok.yaml +++ b/pkg/config/test/config_ok.yaml @@ -10,6 +10,7 @@ instance: image: severalnines/proxysql:2.0 backup: nodeSelector: {} + activeDeadlineSeconds: 600 postgres: image: postgresbackupimage:latest mysql: diff --git a/pkg/config/types.go b/pkg/config/types.go index a6c7db2b..e78a45e9 100644 --- a/pkg/config/types.go +++ b/pkg/config/types.go @@ -34,9 +34,10 @@ type proxyConfig struct { // backupConfig defines docker image for creating database dump by backup cronjob // backup cronjob will be created by db-operator when backup is enabled type backupConfig struct { - Postgres postgresBackupConfig `yaml:"postgres"` - Mysql mysqlBackupConfig `yaml:"mysql"` - NodeSelector map[string]string `yaml:"nodeSelector"` + Postgres postgresBackupConfig `yaml:"postgres"` + Mysql mysqlBackupConfig `yaml:"mysql"` + NodeSelector map[string]string `yaml:"nodeSelector"` + ActiveDeadlineSeconds int64 `yaml:"activeDeadlineSeconds"` } type postgresBackupConfig struct { diff --git a/pkg/controller/database/backup/cronjob.go b/pkg/controller/database/backup/cronjob.go index 9740a61c..008a820a 100644 --- a/pkg/controller/database/backup/cronjob.go +++ b/pkg/controller/database/backup/cronjob.go @@ -53,7 +53,7 @@ func buildCronJobSpec(dbcr *kciv1alpha1.Database) (batchv1beta1.CronJobSpec, err } func buildJobTemplate(dbcr *kciv1alpha1.Database) (batchv1beta1.JobTemplateSpec, error) { - ActiveDeadlineSeconds := int64(60 * 10) // 10m + ActiveDeadlineSeconds := int64(conf.Backup.ActiveDeadlineSeconds) BackoffLimit := int32(3) instance, err := dbcr.GetInstanceRef() if err != nil {