Skip to content

GCP.GKEBackup reference

Source: src/GCP/GKEBackup/BackupChannel.ts

A Backup for GKE backup channel that authorizes storing backups in a destination project.

Changing backupChannelId, location, or destinationProject replaces the channel. Description and labels update in place.

Generated name

const channel = yield* GCP.GKEBackup.BackupChannel("CrossProject", {
destinationProject: "projects/my-backup-project",
});

Explicit id, destination, and labels

const channel = yield* GCP.GKEBackup.BackupChannel("CrossProject", {
backupChannelId: "app-backups",
destinationProject: "projects/my-backup-project",
description: "cross-project backups",
labels: { env: "prod" },
});
const channel = yield* GCP.GKEBackup.BackupChannel("CrossProject", {
destinationProject: "projects/my-backup-project",
description: "cross-project backups v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/GKEBackup/BackupPlan.ts

A Backup for GKE backup plan — the configuration and schedule for a line of cluster backups.

Changing backupPlanId, location, or cluster replaces the plan. Description, labels, retention, schedule, backup config, and deactivated update in place.

Generated name

const plan = yield* GCP.GKEBackup.BackupPlan("Nightly", {
cluster: cluster.name,
backupConfig: { allNamespaces: true },
});

Cron schedule and retention

const plan = yield* GCP.GKEBackup.BackupPlan("Nightly", {
cluster: cluster.name,
backupSchedule: { cronSchedule: "0 2 * * *" },
retentionPolicy: { backupRetainDays: 14, backupDeleteLockDays: 1 },
labels: { env: "prod" },
});
const plan = yield* GCP.GKEBackup.BackupPlan("Nightly", {
cluster: cluster.name,
description: "nightly backups v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/GKEBackup/BackupPlansBackup.ts

A Backup for GKE backup — a point-in-time capture of a cluster under a BackupPlan.

Changing backupId, backupPlan, or location replaces the backup. Description, labels, deleteLockDays, and retainDays update in place (deleteLockDays and retainDays may only increase).

Manual backup

const backup = yield* GCP.GKEBackup.BackupPlansBackup("Nightly", {
backupPlan: plan.name,
});

Retention overrides

const backup = yield* GCP.GKEBackup.BackupPlansBackup("Nightly", {
backupPlan: plan.name,
deleteLockDays: 7,
retainDays: 30,
description: "pre-release",
labels: { env: "prod" },
});
const backup = yield* GCP.GKEBackup.BackupPlansBackup("Nightly", {
backupPlan: plan.name,
description: "pre-release v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/GKEBackup/RestoreChannel.ts

A Backup for GKE restore channel that authorizes restoring backups into a destination project.

Changing restoreChannelId, location, or destinationProject replaces the channel. Description and labels update in place.

RestoreChannel: Creating a Restore Channel

Section titled “RestoreChannel: Creating a Restore Channel”

Generated name

const channel = yield* GCP.GKEBackup.RestoreChannel("CrossProject", {
destinationProject: "projects/my-restore-project",
});

Explicit id, destination, and labels

const channel = yield* GCP.GKEBackup.RestoreChannel("CrossProject", {
restoreChannelId: "app-restores",
destinationProject: "projects/my-restore-project",
description: "cross-project restores",
labels: { env: "prod" },
});

RestoreChannel: Updating a Restore Channel

Section titled “RestoreChannel: Updating a Restore Channel”
const channel = yield* GCP.GKEBackup.RestoreChannel("CrossProject", {
destinationProject: "projects/my-restore-project",
description: "cross-project restores v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/GKEBackup/RestorePlan.ts

A Backup for GKE restore plan — the configuration for restoring Backups from a BackupPlan into a target cluster.

Changing restorePlanId, location, cluster, or backupPlan replaces the plan. Description, labels, and restoreConfig update in place.

Restore all namespaces

const plan = yield* GCP.GKEBackup.RestorePlan("Rollback", {
cluster: cluster.name,
backupPlan: backupPlan.name,
restoreConfig: {
allNamespaces: true,
namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
volumeDataRestorePolicy: "NO_VOLUME_DATA_RESTORATION",
},
});

Selected namespaces

const plan = yield* GCP.GKEBackup.RestorePlan("Rollback", {
cluster: cluster.name,
backupPlan: backupPlan.name,
restoreConfig: {
selectedNamespaces: { namespaces: ["app"] },
namespacedResourceRestoreMode: "MERGE_SKIP_ON_CONFLICT",
},
labels: { env: "prod" },
});
const plan = yield* GCP.GKEBackup.RestorePlan("Rollback", {
cluster: cluster.name,
backupPlan: backupPlan.name,
restoreConfig: { allNamespaces: true },
description: "rollback v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/GKEBackup/RestorePlansRestore.ts

A Backup for GKE restore — a request to restore a Backup into the target cluster of a RestorePlan.

Changing restoreId, restorePlan, location, backup, filter, or volumeDataRestorePolicyOverrides replaces the restore. Description and labels update in place.

Restore a backup

const restore = yield* GCP.GKEBackup.RestorePlansRestore("Rollback", {
restorePlan: plan.name,
backup: backup.name,
});

Filtered restore

const restore = yield* GCP.GKEBackup.RestorePlansRestore("Rollback", {
restorePlan: plan.name,
backup: backup.name,
filter: {
inclusionFilters: [{ namespace: "app" }],
},
description: "app-only rollback",
labels: { env: "prod" },
});
const restore = yield* GCP.GKEBackup.RestorePlansRestore("Rollback", {
restorePlan: plan.name,
backup: backup.name,
description: "app-only rollback v2",
labels: { env: "prod", team: "platform" },
});