Skip to content

Commit

Permalink
Add HA annotation to embedded cluster backups (#4666)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh authored Jun 6, 2024
1 parent ec36187 commit d9dc847
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/kotsadmsnapshot/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/pkg/errors"
downstreamtypes "github.com/replicatedhq/kots/pkg/api/downstream/types"
apptypes "github.com/replicatedhq/kots/pkg/app/types"
"github.com/replicatedhq/kots/pkg/embeddedcluster"
"github.com/replicatedhq/kots/pkg/k8sutil"
"github.com/replicatedhq/kots/pkg/kotsadm"
kotsadmtypes "github.com/replicatedhq/kots/pkg/kotsadm/types"
Expand Down Expand Up @@ -371,10 +372,20 @@ func CreateInstanceBackup(ctx context.Context, cluster *downstreamtypes.Downstre
backupAnnotations["kots.io/apps-sequences"] = marshalledAppsSequences
backupAnnotations["kots.io/apps-versions"] = marshalledAppVersions
backupAnnotations["kots.io/is-airgap"] = strconv.FormatBool(kotsadm.IsAirgap())

if util.IsEmbeddedCluster() {
kbClient, err := k8sutil.GetKubeClient(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get kubeclient: %w", err)
}
installation, err := embeddedcluster.GetCurrentInstallation(ctx, kbClient)
if err != nil {
return nil, fmt.Errorf("failed to get current installation: %w", err)
}
backupAnnotations["kots.io/embedded-cluster"] = "true"
backupAnnotations["kots.io/embedded-cluster-id"] = util.EmbeddedClusterID()
backupAnnotations["kots.io/embedded-cluster-version"] = util.EmbeddedClusterVersion()
backupAnnotations["kots.io/embedded-cluster-is-ha"] = strconv.FormatBool(installation.Spec.HighAvailability)
}

includeClusterResources := true
Expand Down

0 comments on commit d9dc847

Please sign in to comment.