From 6f70879038779dd9ee6eb9dbee4ab1723aeef0ee Mon Sep 17 00:00:00 2001 From: "Md. Emruz Hossain" Date: Sun, 7 Jun 2020 02:20:29 +0600 Subject: [PATCH] Fix waitForDBReady() logic + Make timeout configurable (#35) Signed-off-by: hossainemruz --- Makefile | 6 +- api/crds/bindata.go | 12 +- ...stash.appscode.com_stashpostgreses.v1.yaml | 4 + ...er.stash.appscode.com_stashpostgreses.yaml | 4 + api/openapi-spec/swagger.json | 7 +- apis/installer/v1alpha1/generated.pb.go | 115 +++++++++++------- apis/installer/v1alpha1/generated.proto | 2 + apis/installer/v1alpha1/openapi_generated.go | 8 +- .../v1alpha1/stash_postgres_types.go | 1 + .../v1alpha1/stash_postgres_types_test.go | 2 +- charts/stash-postgres/README.md | 1 + .../templates/postgres-backup-function.yaml | 1 + .../templates/postgres-restore-function.yaml | 1 + .../values.openapiv3_schema.yaml | 4 + charts/stash-postgres/values.yaml | 3 + go.mod | 2 + pkg/backup.go | 7 +- pkg/restore.go | 7 +- pkg/util.go | 25 ++-- 19 files changed, 141 insertions(+), 71 deletions(-) diff --git a/Makefile b/Makefile index 134c036f6..c7a0779df 100644 --- a/Makefile +++ b/Makefile @@ -57,8 +57,8 @@ NEW_RESTIC_VER := 0.9.6 ### These variables should not need tweaking. ### -SRC_PKGS := cmd pkg -SRC_DIRS := $(SRC_PKGS) # directories which hold app source (not vendored) +SRC_PKGS := api apis cmd pkg +SRC_DIRS := $(SRC_PKGS) hack/gencrd # directories which hold app source (not vendored) DOCKER_PLATFORMS := linux/amd64 linux/arm64 BIN_PLATFORMS := $(DOCKER_PLATFORMS) @@ -410,7 +410,7 @@ unit-tests: $(BUILD_DIRS) ARCH=$(ARCH) \ OS=$(OS) \ VERSION=$(VERSION) \ - ./hack/test.sh $(SRC_DIRS) \ + ./hack/test.sh $(SRC_PKGS) \ " .PHONY: ct diff --git a/api/crds/bindata.go b/api/crds/bindata.go index d5ca00e5b..1f6b15d70 100644 --- a/api/crds/bindata.go +++ b/api/crds/bindata.go @@ -78,7 +78,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _installerStashAppscodeCom_stashpostgresesV1Yaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x54\x4d\x8f\xe3\x36\x0c\xbd\xe7\x57\x10\xe8\x61\x2f\x8d\x83\x45\x2f\x85\x6f\xc5\xb4\x87\x45\xbf\x16\x9b\xc5\xde\x19\x89\x71\xd8\x91\x25\x95\xa4\x82\x4e\x7f\x7d\x21\xd9\x9e\x49\x32\x99\xb4\x1b\xa0\x3e\x59\xfc\x12\xdf\x7b\x14\x31\xf3\x17\x12\xe5\x14\x7b\xc0\xcc\xf4\x97\x51\xac\x27\xed\x1e\xbf\xd7\x8e\xd3\xe6\xf8\x7e\xf5\xc8\xd1\xf7\xf0\x50\xd4\xd2\xf8\x89\x34\x15\x71\xf4\x23\xed\x39\xb2\x71\x8a\xab\x91\x0c\x3d\x1a\xf6\x2b\x00\x27\x84\xd5\xf8\x99\x47\x52\xc3\x31\xf7\x10\x4b\x08\x2b\x80\x80\x3b\x0a\x5a\x63\x00\x30\xe7\x1e\xd4\x50\x0f\x2b\x80\x88\x23\xcd\xa7\x9c\xd4\x06\x21\x25\xed\x38\xaa\x61\x08\x24\x5d\xf3\x74\x98\xb3\xba\xe4\xa9\x73\x69\x5c\x69\x26\x57\x2b\x0d\x92\x4a\xee\xe1\x66\xec\x74\xc1\x7c\xb1\x43\xa3\x21\x09\x2f\xe7\xf5\x73\x17\xf5\x7f\xc9\x6b\xc7\x09\xf4\xb6\xba\x3f\xce\x6d\x35\x7b\x60\xb5\x9f\x5f\xfb\x7e\x61\xb5\xe6\xcf\xa1\x08\x86\x57\x80\x9a\x4f\x39\x0e\x25\xa0\x5c\x78\x57\x00\xea\x52\xa6\x1e\x7e\xab\xad\x66\x74\xe4\x57\x00\xc7\x49\x97\xd6\xea\x7a\xa6\xe9\xf8\x1e\x43\x3e\xe0\xfb\xa9\x9c\x3b\xd0\x88\x13\x12\x80\x94\x29\xfe\xf0\xf1\xc3\x97\xef\xb6\x67\x66\x80\x2c\x29\x93\xd8\x33\xe8\xe9\x3b\x11\xfe\xc4\x0a\xe0\x49\x9d\x70\xb6\x36\x11\xef\x6a\xc1\x29\x0a\x7c\x55\x9c\x14\xec\x40\x4b\x6b\xe4\xe7\x1e\x20\xed\xc1\x0e\xac\x20\x94\x2b\xdc\x68\x6d\x0a\xce\x0a\x43\x0d\xc2\x08\x69\xf7\x07\x39\xeb\x60\x4b\x52\xcb\x80\x1e\x52\x09\x1e\x5c\x8a\x47\x12\x03\x21\x97\x86\xc8\x7f\x3f\xd7\x56\xb0\xd4\x2e\x0d\x68\x34\x93\xfc\xf2\x71\x34\x92\x88\x01\x8e\x18\x0a\x7d\x0b\x18\x3d\x8c\xf8\x04\x42\xf5\x16\x28\xf1\xa4\x5e\x0b\xd1\x0e\x7e\x4d\x42\xc0\x71\x9f\x7a\x38\x98\x65\xed\x37\x9b\x81\x6d\x19\x78\x97\xc6\xb1\x44\xb6\xa7\x8d\x4b\xd1\x84\x77\xc5\x92\xe8\xc6\xd3\x91\xc2\x46\x79\x58\xa3\xb8\x03\x1b\x39\x2b\x42\x1b\xcc\xbc\x6e\xad\x47\x6b\xaf\x66\xf4\xdf\xc8\xfc\x44\xf4\xdd\x59\xaf\xf6\x94\xdb\x9c\x0b\xc7\xe1\xc4\xd1\xe6\xec\x86\x02\x75\xd6\x80\x15\x70\x4e\x9d\x50\xbc\x10\x5d\x4d\x95\x9d\x4f\x3f\x6d\x3f\xc3\x72\x75\x13\xe3\x92\xfd\xc6\xfb\x4b\xa2\xbe\x48\x50\x09\xe3\xb8\x27\x99\x44\xdc\x4b\x1a\x5b\x4d\x8a\x3e\x27\x8e\xd6\x0e\x2e\x30\xc5\x4b\xfa\xb5\xec\x46\xb6\xaa\xfb\x9f\x85\xd4\xaa\x56\x1d\x3c\x60\x8c\xc9\x60\x47\x50\xb2\x47\x23\xdf\xc1\x87\x08\x0f\x38\x52\x78\x40\xa5\xff\x5d\x80\xca\xb4\xae\x2b\xb1\xff\x4d\x82\xd3\x05\x76\x19\x3c\xb1\x76\xe2\x58\x76\xcf\x1b\x7a\x9d\x2d\x85\x6d\x26\x57\xb5\xab\xf4\xcd\x0f\x65\x9f\x64\x8a\x81\x25\x68\x1e\xcb\x0b\x62\xf7\x1c\xe8\xcc\x74\xfd\x15\xd7\x6f\x87\xee\xb1\xe4\x4b\xeb\xad\x8c\xfa\xa1\x0c\x57\xed\x6f\xb2\xb4\x7c\x6e\xf4\x77\xe4\xbd\xc1\x66\x83\x5a\x42\xa8\xdb\xed\xf7\x23\x89\xb0\xa7\xd7\xd5\x6f\x54\xe6\x11\x87\x2b\x19\xb7\xb1\x0b\x0d\xac\x26\x4f\x77\xe1\x17\xca\x49\xd9\xd2\x9d\xe9\x86\xc3\x1d\x79\xf5\x7d\xb1\xd0\x15\xe6\xd7\xcf\x68\xae\xba\x96\x5e\xaf\x38\x0d\xbf\x4a\xa6\xbb\x25\x12\x52\x4b\xf2\xd5\x22\xdd\x39\xa0\x6f\x22\xb8\x4e\xe1\x7a\x7e\x3e\x17\xc6\x36\x56\x17\xb6\x19\xc7\xbf\x2f\x89\x57\x46\xad\x7b\xd6\xf7\x60\x52\xa6\xf4\x5a\xa8\xce\xed\x64\xf9\x27\x00\x00\xff\xff\x77\x7d\x57\x58\x84\x09\x00\x00") +var _installerStashAppscodeCom_stashpostgresesV1Yaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\x4d\x8f\xe3\x36\x0f\xbe\xe7\x57\x10\x78\x0f\x7b\x79\xe3\x60\xd0\xa2\x28\x7c\x2b\xa6\x3d\x2c\xfa\xb5\xd8\x2c\xf6\xce\xc8\x8c\xc3\x8e\x2c\xa9\x24\x95\x76\xfa\xeb\x0b\xc9\xf6\x4c\xe2\x64\xd2\x6e\x80\xea\x14\xf1\xe3\x11\xf9\x3c\x94\x62\x4c\xfc\x99\x44\x39\x86\x16\x30\x31\xfd\x69\x14\xca\x4e\x9b\xa7\x6f\xb5\xe1\xb8\x39\x3e\xac\x9e\x38\x74\x2d\x3c\x66\xb5\x38\x7c\x24\x8d\x59\x1c\x7d\x4f\x7b\x0e\x6c\x1c\xc3\x6a\x20\xc3\x0e\x0d\xdb\x15\x80\x13\xc2\x62\xfc\xc4\x03\xa9\xe1\x90\x5a\x08\xd9\xfb\x15\x80\xc7\x1d\x79\x2d\x31\x00\x98\x52\x0b\x6a\xa8\x87\x15\x40\xc0\x81\xa6\x5d\x8a\x6a\xbd\x90\x92\x36\x1c\xd4\xd0\x7b\x92\xa6\x7a\x1a\x4c\x49\x5d\xec\xa8\x71\x71\x58\x69\x22\x57\x90\x7a\x89\x39\xb5\x70\x33\x76\x3c\x60\x3a\xd8\xa1\x51\x1f\x85\xe7\xfd\xfa\xa5\x8a\xf2\x7b\xce\xab\xdb\xb1\xe9\x6d\x71\x7f\x98\xca\xaa\x76\xcf\x6a\x3f\x5e\xfa\x7e\x62\xb5\xea\x4f\x3e\x0b\xfa\x8b\x86\xaa\x4f\x39\xf4\xd9\xa3\x2c\xbc\x2b\x00\x75\x31\x51\x0b\xbf\x94\x52\x13\x3a\xea\x56\x00\xc7\x51\x97\x5a\xea\x7a\xa2\xe9\xf8\x80\x3e\x1d\xf0\x61\x84\x73\x07\x1a\x70\xec\x04\x20\x26\x0a\xdf\x7d\x78\xff\xf9\xab\xed\x99\x19\x20\x49\x4c\x24\xf6\xd2\xf4\xb8\x4e\x84\x3f\xb1\x02\x74\xa4\x4e\x38\x59\x9d\x88\x77\x05\x70\x8c\x82\xae\x28\x4e\x0a\x76\xa0\xb9\x34\xea\xa6\x1a\x20\xee\xc1\x0e\xac\x20\x94\x4a\xbb\xc1\xea\x14\x9c\x01\x43\x09\xc2\x00\x71\xf7\x1b\x39\x6b\x60\x4b\x52\x60\x40\x0f\x31\xfb\x0e\x5c\x0c\x47\x12\x03\x21\x17\xfb\xc0\x7f\xbd\x60\x2b\x58\xac\x87\x7a\x34\x9a\x48\x7e\x5d\x1c\x8c\x24\xa0\x87\x23\xfa\x4c\xff\x07\x0c\x1d\x0c\xf8\x0c\x42\xe5\x14\xc8\xe1\x04\xaf\x86\x68\x03\x3f\x47\x21\xe0\xb0\x8f\x2d\x1c\xcc\x92\xb6\x9b\x4d\xcf\x36\x0f\xbc\x8b\xc3\x90\x03\xdb\xf3\xc6\xc5\x60\xc2\xbb\x6c\x51\x74\xd3\xd1\x91\xfc\x46\xb9\x5f\xa3\xb8\x03\x1b\x39\xcb\x42\x1b\x4c\xbc\xae\xa5\x07\xab\xb7\x66\xe8\xfe\x27\xd3\x15\xd1\x77\x67\xb5\xda\x73\xaa\x73\x2e\x1c\xfa\x13\x47\x9d\xb3\x1b\x0a\x94\x59\x03\x56\xc0\x29\x75\xec\xe2\x95\xe8\x62\x2a\xec\x7c\xfc\x61\xfb\x09\xe6\xa3\xab\x18\x4b\xf6\x2b\xef\xaf\x89\xfa\x2a\x41\x21\x8c\xc3\x9e\x64\x14\x71\x2f\x71\xa8\x98\x14\xba\x14\x39\x58\xdd\x38\xcf\x14\x96\xf4\x6b\xde\x0d\x6c\x45\xf7\xdf\x33\xa9\x15\xad\x1a\x78\xc4\x10\xa2\xc1\x8e\x20\xa7\x0e\x8d\xba\x06\xde\x07\x78\xc4\x81\xfc\x23\x2a\xfd\xe7\x02\x14\xa6\x75\x5d\x88\xfd\x77\x12\x9c\x3e\x60\xcb\xe0\x91\xb5\x13\xc7\xfc\xf6\xbc\xa1\xd7\xd9\xa3\xb0\x4d\xe4\x8a\x76\x85\xbe\xe9\xa2\xec\xa3\x8c\x31\x30\x07\x4d\x63\xb9\x20\x76\xcf\x9e\xce\x4c\xd7\x6f\x71\x59\x3b\x74\x4f\x39\x2d\xad\xb7\x32\xca\x42\xe9\xaf\xda\xdf\x64\x69\x5e\x6e\xe8\xee\xc8\x7b\x83\xcd\xda\x6a\xf6\xbe\xbc\x6e\xbf\x1e\x49\x84\x3b\xba\x44\xbf\x81\xcc\x03\xf6\x57\x32\x6e\xf7\x2e\xd4\xb3\x9a\x3c\xdf\xd5\xbf\x50\x8a\xca\x16\xef\x4c\x37\xec\xef\xc8\x2b\xf7\x8b\x85\xae\x30\xbf\x7e\xe9\xe6\xaa\x6b\xae\xf5\x8a\xd3\xf0\x8b\x64\xba\x5b\x22\x21\xb5\x28\x5f\x2c\xd2\x9d\x03\x7a\xa3\x83\x3f\x90\xad\x7c\x98\xc4\x6c\x97\xc0\xfb\x28\x03\x5a\xf9\x98\xb0\x6f\xbe\x7e\x03\xb5\xfc\xd9\xf4\x24\xab\xf3\xee\xae\x29\xb3\x9e\x6e\xe5\xc2\x58\xa7\x75\x61\x9b\xe8\x59\x58\x4f\x6a\xfd\xe7\x57\xe9\xc2\xa8\xe5\x61\xef\x5a\x30\xc9\x23\x70\x39\xa2\x5c\x94\xd1\xf2\x77\x00\x00\x00\xff\xff\x4f\x98\xb7\xa2\xf5\x09\x00\x00") func installerStashAppscodeCom_stashpostgresesV1YamlBytes() ([]byte, error) { return bindataRead( @@ -93,12 +93,12 @@ func installerStashAppscodeCom_stashpostgresesV1Yaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "installer.stash.appscode.com_stashpostgreses.v1.yaml", size: 2436, mode: os.FileMode(420), modTime: time.Unix(1573722179, 0)} + info := bindataFileInfo{name: "installer.stash.appscode.com_stashpostgreses.v1.yaml", size: 2549, mode: os.FileMode(420), modTime: time.Unix(1573722179, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _installerStashAppscodeCom_stashpostgresesYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\x4d\x6f\xe4\x44\x13\xbe\xcf\xaf\x28\xe9\x7d\xa5\x05\x84\x3d\x44\x2b\x21\xf0\x05\xa1\x00\xd2\x8a\x05\x56\x9b\x65\x2f\xd1\x22\xd5\xb4\x6b\x3c\x45\xda\xdd\x4d\x55\x79\xd8\xe4\xd7\xa3\x6e\xdb\x93\xcc\x57\xd8\x44\xa2\x4f\xee\xa7\xbe\x9f\xaa\x6a\x19\x13\xbf\x27\x51\x8e\xa1\x01\x4c\x4c\x1f\x8d\x42\xbe\x69\x7d\xf3\x8d\xd6\x1c\x97\xdb\x8b\x15\x19\x5e\x2c\x6e\x38\xb4\x0d\x5c\x0e\x6a\xb1\x7f\x4b\x1a\x07\x71\xf4\x03\xad\x39\xb0\x71\x0c\x8b\x9e\x0c\x5b\x34\x6c\x16\x00\x4e\x08\x33\xf8\x8e\x7b\x52\xc3\x3e\x35\x10\x06\xef\x17\x00\x1e\x57\xe4\x35\xeb\x00\x60\x4a\x0d\xa8\xa1\x6e\x16\x00\x01\x7b\x9a\x6e\x29\xaa\x75\x42\x4a\x5a\x73\x50\x43\xef\x49\xea\x22\xa9\x31\x25\x75\xb1\xa5\xda\xc5\x7e\xa1\x89\x5c\xf6\xd4\x49\x1c\x52\x03\x8f\xea\x8e\x01\xa6\xc0\x0e\x8d\xba\x28\x3c\xdf\xab\x5d\x16\xf9\x7b\xb6\x2b\xd7\xb1\xe8\xab\x2c\x7e\x33\xa5\x55\x70\xcf\x6a\x3f\x1f\xcb\x5e\xb3\x5a\x91\x27\x3f\x08\xfa\xa3\x82\x8a\x4c\x39\x74\x83\x47\x39\x90\x2e\x00\x52\x56\x92\x2d\xfd\x1e\x6e\x42\xfc\x3b\xfc\xc4\xe4\x5b\x6d\x60\x8d\x5e\x73\x3a\xea\x62\xa2\x06\x7e\xcd\x95\x24\x74\xd4\x2e\x00\xb6\xe8\xb9\x2d\x64\x8f\xb5\xc4\x44\xe1\xfb\x37\xaf\xde\xbf\xbc\x72\x1b\xea\x71\x04\xb3\xe7\x98\x48\x6c\x57\xf2\xc8\xff\xae\xf3\x3b\x0c\xa0\x25\x75\xc2\xa9\x78\x84\x17\xd9\xd5\xa8\x03\x6d\xee\x35\x29\xd8\x86\x60\x3b\x62\xd4\x82\x96\x30\x10\xd7\x60\x1b\x56\x10\x2a\x35\x04\x2b\x29\x3d\x70\x0b\x59\x05\x03\xc4\xd5\x9f\xe4\xac\x86\xab\x5c\xa7\x28\xe8\x26\x0e\xbe\x05\x17\xc3\x96\xc4\x40\xc8\xc5\x2e\xf0\xdd\xce\xb3\x82\xc5\x12\xd2\xa3\xd1\x44\xee\x7c\x38\x18\x49\x40\x9f\x49\x18\xe8\x4b\xc0\xd0\x42\x8f\xb7\x20\x94\x63\xc0\x10\x1e\x78\x2b\x2a\x5a\xc3\x2f\x51\x08\x38\xac\x63\x03\x1b\xb3\xa4\xcd\x72\xd9\xb1\xcd\xb3\xee\x62\xdf\x0f\x81\xed\x76\xe9\x62\x30\xe1\xd5\x60\x51\x74\xd9\xd2\x96\xfc\x52\xb9\xab\x50\xdc\x86\x8d\x9c\x0d\x42\x4b\x4c\x5c\x95\xc4\x83\x95\x85\xe9\xdb\xff\xc9\xb4\x18\xfa\xe2\x41\xa6\x76\x9b\xca\x6c\x0b\x87\x6e\x07\x97\xc9\x3a\xcb\x7b\x9e\x2d\x60\x05\x9c\xcc\xc6\xfc\xef\xe9\xcd\x50\x66\xe5\xed\x8f\x57\xef\x60\x0e\x5a\x5a\xb0\xcf\x79\x61\xfb\xde\x4c\xef\x89\xcf\x44\x71\x58\x93\x8c\x8d\x5b\x4b\xec\x8b\x47\x0a\x6d\x8a\x1c\xac\x5c\x9c\x67\x0a\xfb\xa4\xeb\xb0\xea\xd9\x72\xa7\xff\x1a\x48\x2d\xf7\xa7\x86\x4b\x0c\x21\x1a\xac\x08\x86\xd4\xa2\x51\x5b\xc3\xab\x00\x97\xd8\x93\xbf\x44\xa5\xff\x9c\xf6\xcc\xb0\x56\x99\xd2\x7f\x27\xfe\xe1\x43\x35\x9f\x53\xeb\x91\x4f\x79\x95\xf6\x10\x80\x1e\x3f\xbe\xa6\xd0\xd9\xa6\x81\xaf\x5f\x1e\xc8\x12\x5a\x1e\xc9\x06\xfe\xb8\xc6\xea\xee\xc3\x67\xd7\x15\x56\x77\x5f\x55\xdf\x7e\xf8\xe2\x7a\xfa\xf8\xfc\xbb\xff\x1f\xd8\x9c\x4c\x72\x86\xc7\x06\xee\xe0\xf9\xc9\x3b\x39\x34\x7b\x2f\xd1\x55\x22\x97\x07\x28\x77\x71\xda\xd1\x75\x94\x51\x07\x66\xa5\x69\x2b\x60\xcd\x9e\x3e\x81\x8d\x15\xba\x9b\x21\x1d\xf2\x71\x4e\x3b\x1f\x94\xee\x04\x7a\xb6\xe6\xf1\xb8\xbe\x7d\xa2\xcd\x49\xae\xf2\x59\x0f\xde\xe7\x1e\xfe\xb6\x25\x11\x6e\x8f\x7a\x79\xd6\x27\xf7\xd8\x1d\x69\x3f\x56\xa9\x50\xc7\x6a\x72\xfb\xe4\x6a\x85\x52\x54\xb6\xf8\x0c\x53\xc3\xee\x89\x36\x79\x69\x59\xe8\x88\xdf\x6a\x97\xff\x09\xc1\x9c\xdf\x91\xc8\xf0\x93\x1b\xf1\xac\x26\x08\xa9\x45\x79\x52\x1b\x9e\x31\x70\x67\x72\x3e\x45\x55\x35\xad\xc0\x1e\x54\x46\x65\x0f\x99\xf2\x7e\x7c\x99\x0f\xa0\xed\xfc\x0f\xb6\xbd\x40\x9f\x36\x78\x71\x8f\x95\x82\xaa\xe9\x0f\xe9\x81\x18\xa0\xfc\x2c\xb4\x0d\x98\x0c\x63\xb4\x1c\x37\x0f\xee\x88\xfc\x13\x00\x00\xff\xff\x98\xc1\xf1\x0b\xdb\x09\x00\x00") +var _installerStashAppscodeCom_stashpostgresesYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\x5f\x8f\x1c\x35\x0c\x7f\xdf\x4f\x61\x09\xa4\x02\x62\x76\x39\x15\x55\x30\x2f\x08\x1d\x20\x55\x14\xa8\x7a\xa5\x2f\xa7\x22\x79\x33\xde\x59\x73\x99\x24\xd8\x9e\x6d\xef\x3e\x3d\x4a\x66\x66\x6f\xff\x1e\xbd\x93\xc8\xd3\xe4\xe7\x3f\xb1\x7f\xb6\x33\xc1\xc4\xef\x48\x94\x63\xa8\x01\x13\xd3\x47\xa3\x90\x77\x3a\xbf\xf9\x4e\xe7\x1c\x17\x9b\x8b\x25\x19\x5e\xcc\x6e\x38\x34\x35\x5c\xf6\x6a\xb1\x7b\x43\x1a\x7b\x71\xf4\x13\xad\x38\xb0\x71\x0c\xb3\x8e\x0c\x1b\x34\xac\x67\x00\x4e\x08\x33\xf8\x96\x3b\x52\xc3\x2e\xd5\x10\x7a\xef\x67\x00\x1e\x97\xe4\x35\xeb\x00\x60\x4a\x35\xa8\xa1\xae\x67\x00\x01\x3b\x1a\x77\x29\xaa\xb5\x42\x4a\x3a\xe7\xa0\x86\xde\x93\xcc\x8b\x64\x8e\x29\xa9\x8b\x0d\xcd\x5d\xec\x66\x9a\xc8\x65\x4f\xad\xc4\x3e\xd5\xf0\xa0\xee\x70\xc0\x78\xb0\x43\xa3\x36\x0a\x4f\xfb\x6a\x1b\x45\xfe\x9e\xec\xca\x76\x48\xfa\x2a\x8b\x5f\x8f\x61\x15\xdc\xb3\xda\xaf\xc7\xb2\x57\xac\x56\xe4\xc9\xf7\x82\xfe\x28\xa1\x22\x53\x0e\x6d\xef\x51\x0e\xa4\x33\x80\x94\x95\x64\x43\x7f\x86\x9b\x10\x3f\x84\x5f\x98\x7c\xa3\x35\xac\xd0\x6b\x0e\x47\x5d\x4c\x54\xc3\xef\x39\x93\x84\x8e\x9a\x19\xc0\x06\x3d\x37\x85\xec\x21\x97\x98\x28\xfc\xf8\xfa\xe5\xbb\xe7\x57\x6e\x4d\x1d\x0e\x60\xf6\x1c\x13\x89\x6d\x53\x1e\xf8\xdf\x56\x7e\x8b\x01\x34\xa4\x4e\x38\x15\x8f\xf0\x2c\xbb\x1a\x74\xa0\xc9\xb5\x26\x05\x5b\x13\x6c\x06\x8c\x1a\xd0\x72\x0c\xc4\x15\xd8\x9a\x15\x84\x4a\x0e\xc1\x4a\x48\x3b\x6e\x21\xab\x60\x80\xb8\xfc\x9b\x9c\xcd\xe1\x2a\xe7\x29\x0a\xba\x8e\xbd\x6f\xc0\xc5\xb0\x21\x31\x10\x72\xb1\x0d\x7c\xb7\xf5\xac\x60\xb1\x1c\xe9\xd1\x68\x24\x77\x5a\x1c\x8c\x24\xa0\xcf\x24\xf4\xf4\x35\x60\x68\xa0\xc3\x5b\x10\xca\x67\x40\x1f\x76\xbc\x15\x15\x9d\xc3\x6f\x51\x08\x38\xac\x62\x0d\x6b\xb3\xa4\xf5\x62\xd1\xb2\x4d\xbd\xee\x62\xd7\xf5\x81\xed\x76\xe1\x62\x30\xe1\x65\x6f\x51\x74\xd1\xd0\x86\xfc\x42\xb9\xad\x50\xdc\x9a\x8d\x9c\xf5\x42\x0b\x4c\x5c\x95\xc0\x83\x95\x81\xe9\x9a\xcf\x64\x1c\x0c\x7d\xb6\x13\xa9\xdd\xa6\xd2\xdb\xc2\xa1\xdd\xc2\xa5\xb3\xce\xf2\x9e\x7b\x0b\x58\x01\x47\xb3\x21\xfe\x7b\x7a\x33\x94\x59\x79\xf3\xf3\xd5\x5b\x98\x0e\x2d\x25\xd8\xe7\xbc\xb0\x7d\x6f\xa6\xf7\xc4\x67\xa2\x38\xac\x48\x86\xc2\xad\x24\x76\xc5\x23\x85\x26\x45\x0e\x56\x36\xce\x33\x85\x7d\xd2\xb5\x5f\x76\x6c\xb9\xd2\xff\xf4\xa4\x96\xeb\x33\x87\x4b\x0c\x21\x1a\x2c\x09\xfa\xd4\xa0\x51\x33\x87\x97\x01\x2e\xb1\x23\x7f\x89\x4a\xff\x3b\xed\x99\x61\xad\x32\xa5\xff\x4d\xfc\xee\x45\x35\xad\x53\xe3\x91\x57\xb9\x95\xf6\x10\x80\x0e\x3f\xbe\xa2\xd0\xda\xba\x86\x17\xcf\x0f\x64\x09\x2d\xb7\x64\x0d\x7f\x5d\x63\x75\xf7\xfe\x8b\xeb\x0a\xab\xbb\x6f\xaa\xef\xdf\x7f\x75\x3d\x7e\x7c\xf9\xc3\xe7\x07\x36\x27\x83\x9c\xe0\xa1\x80\x5b\x78\xba\xf2\x4e\x36\xcd\xde\x4d\x74\x95\xc8\xe5\x06\xca\x55\x1c\x67\x74\x15\x65\xd0\x81\x49\x69\x9c\x0a\x58\xb1\xa7\x4f\x60\x63\x89\xee\xa6\x4f\x87\x7c\x9c\xd3\xce\x0b\xa5\x3d\x81\x9e\xcd\x79\x58\xae\x6b\x1e\x69\x73\x92\xab\xbc\x56\xbd\xf7\xb9\x86\x7f\x6c\x48\x84\x9b\xa3\x5a\x9e\xf5\xc9\x1d\xb6\x47\xda\x0f\x65\x2a\xd4\xb2\x9a\xdc\x3e\x3a\x5b\xa1\x14\x95\x2d\x3e\xc1\xd4\xb0\x7d\xa4\x4d\x1e\x5a\x16\x3a\xe2\xb7\xda\xc6\x7f\x42\x30\xc5\x77\x24\x32\xfc\xe4\x42\x3c\xa9\x08\x42\x6a\x51\x1e\x55\x86\x27\x34\xdc\xd9\x98\x3f\x20\x5b\x7e\xc1\xc4\xde\x0e\x5d\xae\xa2\x74\x68\xf9\xcd\x61\x2f\xbe\x3d\xe9\x2f\xff\x9b\x5a\x92\xd9\x6e\x36\xc7\xdc\x57\xe3\x4c\xed\x41\xa5\xf7\xf6\x90\x91\x88\x3d\x6c\x27\xba\x87\x6f\x8d\x03\x68\x33\x3d\xf6\x36\x17\xe8\xd3\x1a\x2f\xee\xb1\xc2\x5c\x35\x3e\xc5\x76\xc4\x00\xe5\x55\xd2\xd4\x60\xd2\x0f\x51\xe4\x78\xf2\x84\x0c\xc8\xbf\x01\x00\x00\xff\xff\xcb\xef\x6f\xb6\x44\x0a\x00\x00") func installerStashAppscodeCom_stashpostgresesYamlBytes() ([]byte, error) { return bindataRead( @@ -113,7 +113,7 @@ func installerStashAppscodeCom_stashpostgresesYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "installer.stash.appscode.com_stashpostgreses.yaml", size: 2523, mode: os.FileMode(420), modTime: time.Unix(1573722179, 0)} + info := bindataFileInfo{name: "installer.stash.appscode.com_stashpostgreses.yaml", size: 2628, mode: os.FileMode(420), modTime: time.Unix(1573722179, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -215,8 +215,8 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "installer.stash.appscode.com_stashpostgreses.v1.yaml": &bintree{installerStashAppscodeCom_stashpostgresesV1Yaml, map[string]*bintree{}}, - "installer.stash.appscode.com_stashpostgreses.yaml": &bintree{installerStashAppscodeCom_stashpostgresesYaml, map[string]*bintree{}}, + "installer.stash.appscode.com_stashpostgreses.v1.yaml": {installerStashAppscodeCom_stashpostgresesV1Yaml, map[string]*bintree{}}, + "installer.stash.appscode.com_stashpostgreses.yaml": {installerStashAppscodeCom_stashpostgresesYaml, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory diff --git a/api/crds/installer.stash.appscode.com_stashpostgreses.v1.yaml b/api/crds/installer.stash.appscode.com_stashpostgreses.v1.yaml index 8c300d1b6..27914dd81 100644 --- a/api/crds/installer.stash.appscode.com_stashpostgreses.v1.yaml +++ b/api/crds/installer.stash.appscode.com_stashpostgreses.v1.yaml @@ -66,10 +66,14 @@ spec: args: type: string type: object + waitTimeout: + format: int64 + type: integer required: - backup - image - restore + - waitTimeout type: object type: object served: true diff --git a/api/crds/installer.stash.appscode.com_stashpostgreses.yaml b/api/crds/installer.stash.appscode.com_stashpostgreses.yaml index b9097eb6c..997fe41a6 100644 --- a/api/crds/installer.stash.appscode.com_stashpostgreses.yaml +++ b/api/crds/installer.stash.appscode.com_stashpostgreses.yaml @@ -69,10 +69,14 @@ spec: args: type: string type: object + waitTimeout: + format: int64 + type: integer required: - backup - image - restore + - waitTimeout type: object type: object version: v1alpha1 diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index dbf5558ca..ae1771188 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -967,7 +967,8 @@ "required": [ "image", "backup", - "restore" + "restore", + "waitTimeout" ], "properties": { "backup": { @@ -984,6 +985,10 @@ }, "restore": { "$ref": "#/definitions/dev.appscode.stash.postgres.apis.installer.v1alpha1.PostgresRestore" + }, + "waitTimeout": { + "type": "integer", + "format": "int64" } } }, diff --git a/apis/installer/v1alpha1/generated.pb.go b/apis/installer/v1alpha1/generated.pb.go index ac6203667..9b8b1fdd9 100644 --- a/apis/installer/v1alpha1/generated.pb.go +++ b/apis/installer/v1alpha1/generated.pb.go @@ -21,15 +21,13 @@ package v1alpha1 import ( fmt "fmt" - io "io" - - proto "github.com/gogo/protobuf/proto" - math "math" math_bits "math/bits" reflect "reflect" strings "strings" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -225,48 +223,49 @@ func init() { } var fileDescriptor_88259ff085b7e726 = []byte{ - // 641 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x3f, 0x6f, 0x13, 0x31, - 0x14, 0xcf, 0x91, 0xa4, 0x0d, 0x4e, 0xff, 0x61, 0x31, 0x44, 0x95, 0xb8, 0x56, 0x99, 0x3a, 0x80, - 0x8f, 0xa6, 0x08, 0x75, 0x61, 0xe0, 0x5a, 0x55, 0xaa, 0x44, 0x29, 0xb8, 0x4c, 0x88, 0x01, 0xe7, - 0xf2, 0xea, 0x1c, 0xc9, 0xe5, 0x2c, 0xdb, 0x89, 0xd4, 0x8d, 0x9d, 0x85, 0x8f, 0xd5, 0xb1, 0x0b, - 0x52, 0x05, 0x52, 0x45, 0xc3, 0x17, 0x41, 0xf6, 0xf9, 0xae, 0x49, 0xa3, 0x0a, 0x94, 0x6e, 0xe7, - 0xe7, 0xdf, 0x9f, 0xf7, 0xf3, 0xbd, 0x87, 0xf6, 0x94, 0x66, 0xaa, 0x4b, 0x98, 0x10, 0x2a, 0x4a, - 0x3b, 0x40, 0x3a, 0x30, 0x0a, 0x44, 0xaa, 0x34, 0x97, 0xa0, 0x02, 0x26, 0x62,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 0x6f, 0x85, 0x33, 0xc1, 0xf1, - 0x2e, 0x5a, 0x1a, 0xb0, 0x04, 0x8e, 0x47, 0x20, 0x65, 0xdc, 0x01, 0xf7, 0xeb, 0x1f, 0x3b, 0x85, - 0xa5, 0xb7, 0x13, 0x77, 0x74, 0x0a, 0x89, 0xf7, 0xd1, 0xda, 0xe9, 0xb0, 0xdf, 0x9f, 0x62, 0x67, - 0xd3, 0xd6, 0x70, 0xec, 0xb5, 0x83, 0x5b, 0xf7, 0x74, 0x86, 0x81, 0xdb, 0xa8, 0x1a, 0x9b, 0x2d, - 0xb3, 0x93, 0x5f, 0x6f, 0xbd, 0x9a, 0x2b, 0x7e, 0xbe, 0xa7, 0x13, 0xc9, 0x6d, 0x25, 0x93, 0xc6, - 0x3d, 0xb4, 0xd0, 0xb6, 0x4b, 0xd3, 0xa8, 0x58, 0x93, 0xbd, 0xb9, 0x4c, 0xa6, 0xf7, 0x2f, 0x5c, - 0x71, 0x56, 0x0b, 0xd9, 0x99, 0x3a, 0x0b, 0x9c, 0xa2, 0x45, 0x99, 0xad, 0x53, 0xa3, 0x6a, 0xdd, - 0xf6, 0xef, 0xe5, 0xe6, 0x56, 0x33, 0x5c, 0x75, 0x76, 0x8b, 0xae, 0x40, 0x73, 0x97, 0x90, 0x9c, - 0x5f, 0xfb, 0xa5, 0x8b, 0x6b, 0xbf, 0x74, 0x79, 0xed, 0x97, 0xbe, 0x8e, 0x7d, 0xef, 0x7c, 0xec, - 0x7b, 0x17, 0x63, 0xdf, 0xbb, 0x1c, 0xfb, 0xde, 0xef, 0xb1, 0xef, 0x7d, 0xff, 0xe3, 0x97, 0x3e, - 0xd6, 0x72, 0xe5, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xce, 0x9f, 0x91, 0x62, 0x21, 0x06, 0x00, - 0x00, + // 670 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53,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bd, + 0x7f, 0xd1, 0x92, 0xb3, 0x9a, 0xcb, 0xce, 0xd8, 0x59, 0x40, 0x01, 0xe6, 0x65, 0xb6, 0x4e, 0x7e, + 0xd5, 0xba, 0xed, 0xde, 0xc9, 0xcd, 0xad, 0x66, 0xb4, 0xec, 0xec, 0xe6, 0x5d, 0x01, 0xe7, 0x2e, + 0xf0, 0x19, 0xa8, 0x7f, 0x26, 0x5c, 0x1f, 0xf3, 0x84, 0x8a, 0x81, 0xf6, 0xe7, 0xd6, 0xbd, 0x8d, + 0x72, 0x74, 0xdf, 0xc1, 0xeb, 0xef, 0xc6, 0x57, 0x78, 0x12, 0x17, 0xa1, 0xb3, 0xab, 0xa0, 0x74, + 0x7e, 0x15, 0x94, 0x2e, 0xae, 0x82, 0xd2, 0x97, 0x51, 0xe0, 0x9d, 0x8d, 0x02, 0xef, 0x7c, 0x14, + 0x78, 0x17, 0xa3, 0xc0, 0xfb, 0x35, 0x0a, 0xbc, 0xef, 0xbf, 0x83, 0xd2, 0xfb, 0x5a, 0xde, 0xd0, + 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x7a, 0xd7, 0x7f, 0x58, 0x06, 0x00, 0x00, } func (m *ImageRef) Marshal() (dAtA []byte, err error) { @@ -478,6 +477,9 @@ func (m *StashPostgresSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.WaitTimeout)) + i-- + dAtA[i] = 0x30 { size, err := m.Restore.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -617,6 +619,7 @@ func (m *StashPostgresSpec) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.Restore.Size() n += 1 + l + sovGenerated(uint64(l)) + n += 1 + sovGenerated(uint64(m.WaitTimeout)) return n } @@ -696,6 +699,7 @@ func (this *StashPostgresSpec) String() string { `Image:` + strings.Replace(strings.Replace(this.Image.String(), "ImageRef", "ImageRef", 1), `&`, ``, 1) + `,`, `Backup:` + strings.Replace(strings.Replace(this.Backup.String(), "PostgresBackup", "PostgresBackup", 1), `&`, ``, 1) + `,`, `Restore:` + strings.Replace(strings.Replace(this.Restore.String(), "PostgresRestore", "PostgresRestore", 1), `&`, ``, 1) + `,`, + `WaitTimeout:` + fmt.Sprintf("%v", this.WaitTimeout) + `,`, `}`, }, "") return s @@ -1490,6 +1494,25 @@ func (m *StashPostgresSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WaitTimeout", wireType) + } + m.WaitTimeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WaitTimeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/apis/installer/v1alpha1/generated.proto b/apis/installer/v1alpha1/generated.proto index a5fbceeaa..45138b48a 100644 --- a/apis/installer/v1alpha1/generated.proto +++ b/apis/installer/v1alpha1/generated.proto @@ -78,5 +78,7 @@ message StashPostgresSpec { optional PostgresBackup backup = 4; optional PostgresRestore restore = 5; + + optional int64 waitTimeout = 6; } diff --git a/apis/installer/v1alpha1/openapi_generated.go b/apis/installer/v1alpha1/openapi_generated.go index 42e14cc53..80ea1acce 100644 --- a/apis/installer/v1alpha1/openapi_generated.go +++ b/apis/installer/v1alpha1/openapi_generated.go @@ -15715,8 +15715,14 @@ func schema_postgres_apis_installer_v1alpha1_StashPostgresSpec(ref common.Refere Ref: ref("stash.appscode.dev/postgres/apis/installer/v1alpha1.PostgresRestore"), }, }, + "waitTimeout": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, }, - Required: []string{"image", "backup", "restore"}, + Required: []string{"image", "backup", "restore", "waitTimeout"}, }, }, Dependencies: []string{ diff --git a/apis/installer/v1alpha1/stash_postgres_types.go b/apis/installer/v1alpha1/stash_postgres_types.go index 9d8addb3d..db0dd4d6c 100644 --- a/apis/installer/v1alpha1/stash_postgres_types.go +++ b/apis/installer/v1alpha1/stash_postgres_types.go @@ -50,6 +50,7 @@ type StashPostgresSpec struct { Image ImageRef `json:"image" protobuf:"bytes,3,opt,name=image"` Backup PostgresBackup `json:"backup" protobuf:"bytes,4,opt,name=backup"` Restore PostgresRestore `json:"restore" protobuf:"bytes,5,opt,name=restore"` + WaitTimeout int64 `json:"waitTimeout" protobuf:"varint,6,opt,name=waitTimeout"` } type ImageRef struct { diff --git a/apis/installer/v1alpha1/stash_postgres_types_test.go b/apis/installer/v1alpha1/stash_postgres_types_test.go index 50ca5307d..9f22c970a 100644 --- a/apis/installer/v1alpha1/stash_postgres_types_test.go +++ b/apis/installer/v1alpha1/stash_postgres_types_test.go @@ -41,7 +41,7 @@ func TestStashPostgresDefaultValues(t *testing.T) { } func compareStashPostgresDefaultValues() (string, error) { - data, err := ioutil.ReadFile("../../../../postgres/charts/stash-postgres/values.yaml") + data, err := ioutil.ReadFile("../../../charts/stash-postgres/values.yaml") if err != nil { return "", err } diff --git a/charts/stash-postgres/README.md b/charts/stash-postgres/README.md index 0498cec91..25fc5f4c2 100644 --- a/charts/stash-postgres/README.md +++ b/charts/stash-postgres/README.md @@ -54,6 +54,7 @@ The following table lists the configurable parameters of the `stash-postgres` ch | backup.cmd | Postgres dump command, can either be: pg_dumpall or pg_dump | `"pg_dumpall"` | | backup.args | Arguments to pass to `backup.cmd` command during backup process | `""` | | restore.args | Arguments to pass to `psql` command during restore process | `""` | +| waitTimeout | Number of seconds to wait for the database to be ready before backup/restore process. | `300` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example: diff --git a/charts/stash-postgres/templates/postgres-backup-function.yaml b/charts/stash-postgres/templates/postgres-backup-function.yaml index 9f03691f5..09635309f 100644 --- a/charts/stash-postgres/templates/postgres-backup-function.yaml +++ b/charts/stash-postgres/templates/postgres-backup-function.yaml @@ -21,6 +21,7 @@ spec: - --hostname=${HOSTNAME:=} - --backup-cmd=${backupCMD:={{ .Values.backup.cmd }}} # can specify dump command with either pg_dump or pg_dumpall - --pg-args=${args:={{ .Values.backup.args }}} # optional arguments pass to pgdump command + - --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}} # target information - --namespace=${NAMESPACE:=default} - --appbinding=${TARGET_NAME:=} diff --git a/charts/stash-postgres/templates/postgres-restore-function.yaml b/charts/stash-postgres/templates/postgres-restore-function.yaml index 29c9524c9..89acca50d 100644 --- a/charts/stash-postgres/templates/postgres-restore-function.yaml +++ b/charts/stash-postgres/templates/postgres-restore-function.yaml @@ -21,6 +21,7 @@ spec: - --hostname=${HOSTNAME:=} - --source-hostname=${SOURCE_HOSTNAME:=} - --pg-args=${args:={{ .Values.restore.args }}} # optional arguments pass to pgdump command + - --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}} # target information - --namespace=${NAMESPACE:=default} - --appbinding=${TARGET_NAME:=} diff --git a/charts/stash-postgres/values.openapiv3_schema.yaml b/charts/stash-postgres/values.openapiv3_schema.yaml index 194914149..7d7aae383 100644 --- a/charts/stash-postgres/values.openapiv3_schema.yaml +++ b/charts/stash-postgres/values.openapiv3_schema.yaml @@ -28,8 +28,12 @@ properties: args: type: string type: object + waitTimeout: + format: int64 + type: integer required: - backup - image - restore +- waitTimeout type: object diff --git a/charts/stash-postgres/values.yaml b/charts/stash-postgres/values.yaml index f9a83ce7a..9ad75df08 100644 --- a/charts/stash-postgres/values.yaml +++ b/charts/stash-postgres/values.yaml @@ -24,3 +24,6 @@ backup: restore: # Arguments to pass to `psql` command during restore process args: "" + +# Number of seconds to wait for the database to be ready before backup/restore process. +waitTimeout: 300 diff --git a/go.mod b/go.mod index 22a98cd79..3396bc8dd 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,14 @@ go 1.12 require ( github.com/appscode/go v0.0.0-20200323182826-54e98e09185a + github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 github.com/go-openapi/spec v0.19.3 github.com/gogo/protobuf v1.3.1 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/google/gofuzz v1.1.0 github.com/spf13/cobra v0.0.5 github.com/yudai/gojsondiff v1.0.0 + k8s.io/api v0.18.3 k8s.io/apiextensions-apiserver v0.18.3 k8s.io/apimachinery v0.18.3 k8s.io/client-go v12.0.0+incompatible diff --git a/pkg/backup.go b/pkg/backup.go index 3925a889c..be1b3a6df 100644 --- a/pkg/backup.go +++ b/pkg/backup.go @@ -39,6 +39,7 @@ func NewCmdBackup() *cobra.Command { masterURL string kubeconfigPath string opt = postgresOptions{ + waitTimeout: 300, backupOptions: restic.BackupOptions{ Host: restic.DefaultHost, StdinFileName: PgDumpFile, @@ -95,6 +96,7 @@ func NewCmdBackup() *cobra.Command { cmd.Flags().StringVar(&opt.backupCMD, "backup-cmd", opt.pgArgs, "Backup command to take a database dump (can only be pg_dumpall or pg_dump)") cmd.Flags().StringVar(&opt.pgArgs, "pg-args", opt.pgArgs, "Additional arguments") + cmd.Flags().Int32Var(&opt.waitTimeout, "wait-timeout", opt.waitTimeout, "Time limit to wait for the database to be ready") cmd.Flags().StringVar(&masterURL, "master", masterURL, "The address of the Kubernetes API server (overrides any value in kubeconfig)") cmd.Flags().StringVar(&kubeconfigPath, "kubeconfig", kubeconfigPath, "Path to kubeconfig file with authorization information (the master location is set by the master flag).") @@ -186,7 +188,10 @@ func (opt *postgresOptions) backupPostgreSQL() (*restic.BackupOutput, error) { } // wait for DB ready - waitForDBReady(appBinding.Spec.ClientConfig.Service.Name, appBinding.Spec.ClientConfig.Service.Port) + err = waitForDBReady(appBinding, appBindingSecret, opt.waitTimeout) + if err != nil { + return nil, err + } // Run backup return resticWrapper.RunBackup(opt.backupOptions) diff --git a/pkg/restore.go b/pkg/restore.go index 97bdb936e..cc2484950 100644 --- a/pkg/restore.go +++ b/pkg/restore.go @@ -38,6 +38,7 @@ func NewCmdRestore() *cobra.Command { masterURL string kubeconfigPath string opt = postgresOptions{ + waitTimeout: 300, setupOptions: restic.SetupOptions{ ScratchDir: restic.DefaultScratchDir, EnableCache: false, @@ -93,6 +94,7 @@ func NewCmdRestore() *cobra.Command { } cmd.Flags().StringVar(&opt.pgArgs, "pg-args", opt.pgArgs, "Additional arguments") + cmd.Flags().Int32Var(&opt.waitTimeout, "wait-timeout", opt.waitTimeout, "Time limit to wait for the database to be ready") cmd.Flags().StringVar(&masterURL, "master", masterURL, "The address of the Kubernetes API server (overrides any value in kubeconfig)") cmd.Flags().StringVar(&kubeconfigPath, "kubeconfig", kubeconfigPath, "Path to kubeconfig file with authorization information (the master location is set by the master flag).") @@ -169,7 +171,10 @@ func (opt *postgresOptions) restorePostgreSQL() (*restic.RestoreOutput, error) { } // wait for DB ready - waitForDBReady(appBinding.Spec.ClientConfig.Service.Name, appBinding.Spec.ClientConfig.Service.Port) + err = waitForDBReady(appBinding, appBindingSecret, opt.waitTimeout) + if err != nil { + return nil, err + } // Run dump return resticWrapper.Dump(opt.dumpOptions) diff --git a/pkg/util.go b/pkg/util.go index 693c2a34a..51158b2d1 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -18,13 +18,14 @@ package pkg import ( "fmt" - "os/exec" - "time" "stash.appscode.dev/apimachinery/pkg/restic" "github.com/appscode/go/log" + "github.com/codeskyblue/go-sh" + core "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" + "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" appcatalog_cs "kmodules.xyz/custom-resources/client/clientset/versioned" ) @@ -47,20 +48,22 @@ type postgresOptions struct { backupCMD string pgArgs string outputDir string + waitTimeout int32 setupOptions restic.SetupOptions backupOptions restic.BackupOptions dumpOptions restic.DumpOptions } -func waitForDBReady(host string, port int32) { - log.Infoln("Checking database connection") - cmd := fmt.Sprintf(`nc "%s" "%d" -w 30`, host, port) - for { - if err := exec.Command(cmd).Run(); err != nil { - break - } - log.Infoln("Waiting... database is not ready yet") - time.Sleep(5 * time.Second) +func waitForDBReady(appBinding *v1alpha1.AppBinding, secret *core.Secret, waitTimeout int32) error { + log.Infoln("Waiting for the database to be ready.....") + shell := sh.NewSession() + shell.SetEnv(EnvPgPassword, string(secret.Data[PostgresPassword])) + args := []interface{}{ + fmt.Sprintf("--host=%s", appBinding.Spec.ClientConfig.Service.Name), + fmt.Sprintf("--port=%d", appBinding.Spec.ClientConfig.Service.Port), + fmt.Sprintf("--username=%s", secret.Data[PostgresUser]), + fmt.Sprintf("--timeout=%d", waitTimeout), } + return shell.Command("pg_isready", args...).Run() }