From ec8422de04fe565b98db20817e6513690e354e60 Mon Sep 17 00:00:00 2001 From: Muthu Chidambaram Date: Tue, 31 Oct 2023 17:55:30 -0500 Subject: [PATCH] [BACKPORT 2.18.4][PLAT-11075] Allowing exclusion of releases/prometheus in YBA-installer backups Summary: Fixes for backups in YBA-installer that allowed exclusion of prometheus and releases went into 2.18.3 and were missed for 2.18.4.0. We might as well also get them into 2.18.4.1. Test Plan: check generated yba-ctl binary for exclude flags Reviewers: dshubin, sanketh Reviewed By: dshubin Subscribers: yugaware Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D29829 --- managed/yba-installer/cmd/backup.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/managed/yba-installer/cmd/backup.go b/managed/yba-installer/cmd/backup.go index 74c5147e8f3e..8ad5a82d9ab7 100644 --- a/managed/yba-installer/cmd/backup.go +++ b/managed/yba-installer/cmd/backup.go @@ -21,7 +21,7 @@ import ( // CreateBackupScript calls the yb_platform_backup.sh script with the correct args. func CreateBackupScript(outputPath string, dataDir string, - excludePrometheus bool, skipRestart bool, verbose bool, plat Platform) { + excludePrometheus bool, excludeReleases bool, skipRestart bool, verbose bool, plat Platform) { fileName := plat.backupScript() err := os.Chmod(fileName, 0777) @@ -34,7 +34,10 @@ func CreateBackupScript(outputPath string, dataDir string, args := []string{"create", "--output", outputPath, "--data_dir", dataDir, "--yba_installer"} if excludePrometheus { - args = append(args, "--exclude-prometheus") + args = append(args, "--exclude_prometheus") + } + if excludeReleases { + args = append(args, "--exclude_releases") } if skipRestart { args = append(args, "--skip_restart") @@ -151,6 +154,7 @@ func createPgPass() { func createBackupCmd() *cobra.Command { var dataDir string var excludePrometheus bool + var excludeReleases bool var skipRestart bool var verbose bool @@ -180,7 +184,8 @@ func createBackupCmd() *cobra.Command { outputPath := args[0] if plat, ok := services["yb-platform"].(Platform); ok { - CreateBackupScript(outputPath, dataDir, excludePrometheus, skipRestart, verbose, plat) + CreateBackupScript(outputPath, dataDir, excludePrometheus, excludeReleases, skipRestart, + verbose, plat) } else { log.Fatal("Could not cast service to Platform struct.") } @@ -191,6 +196,8 @@ func createBackupCmd() *cobra.Command { "data directory to be backed up") createBackup.Flags().BoolVar(&excludePrometheus, "exclude_prometheus", false, "exclude prometheus metric data from backup (default: false)") + createBackup.Flags().BoolVar(&excludeReleases, "exclude_releases", false, + "exclude prometheus metric data from backup (default: false)") createBackup.Flags().BoolVar(&skipRestart, "skip_restart", false, "don't restart processes during execution (default: false)") createBackup.Flags().BoolVar(&verbose, "verbose", false,