gcp.gkebackup.RestorePlanIamMember
Explore with Pulumi AI
Represents a Restore Plan instance.
To get more information about RestorePlan, see:
- API documentation
- How-to Guides
Example Usage
Gkebackup Restoreplan All Namespaces
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "restore-all-ns-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "restore-all-ns",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const allNs = new gcp.gkebackup.RestorePlan("all_ns", {
name: "restore-all-ns",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
allNamespaces: true,
namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
clusterResourceRestoreScope: {
allGroupKinds: true,
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="restore-all-ns-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="restore-all-ns",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
all_ns = gcp.gkebackup.RestorePlan("all_ns",
name="restore-all-ns",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
all_namespaces=True,
namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
all_group_kinds=True,
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("restore-all-ns-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("restore-all-ns"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "all_ns", &gkebackup.RestorePlanArgs{
Name: pulumi.String("restore-all-ns"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
AllNamespaces: pulumi.Bool(true),
NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
AllGroupKinds: pulumi.Bool(true),
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "restore-all-ns-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "restore-all-ns",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var allNs = new Gcp.GkeBackup.RestorePlan("all_ns", new()
{
Name = "restore-all-ns",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
AllNamespaces = true,
NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
AllGroupKinds = true,
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("restore-all-ns-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("restore-all-ns")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var allNs = new RestorePlan("allNs", RestorePlanArgs.builder()
.name("restore-all-ns")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.allNamespaces(true)
.namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
.volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.allGroupKinds(true)
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: restore-all-ns-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: restore-all-ns
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
allNs:
type: gcp:gkebackup:RestorePlan
name: all_ns
properties:
name: restore-all-ns
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
allNamespaces: true
namespacedResourceRestoreMode: FAIL_ON_CONFLICT
volumeDataRestorePolicy: RESTORE_VOLUME_DATA_FROM_BACKUP
clusterResourceRestoreScope:
allGroupKinds: true
clusterResourceConflictPolicy: USE_EXISTING_VERSION
Gkebackup Restoreplan Rollback Namespace
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "rollback-ns-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "rollback-ns",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const rollbackNs = new gcp.gkebackup.RestorePlan("rollback_ns", {
name: "rollback-ns-rp",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
selectedNamespaces: {
namespaces: ["my-ns"],
},
namespacedResourceRestoreMode: "DELETE_AND_RESTORE",
volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
clusterResourceRestoreScope: {
selectedGroupKinds: [
{
resourceGroup: "apiextension.k8s.io",
resourceKind: "CustomResourceDefinition",
},
{
resourceGroup: "storage.k8s.io",
resourceKind: "StorageClass",
},
],
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="rollback-ns-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="rollback-ns",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
rollback_ns = gcp.gkebackup.RestorePlan("rollback_ns",
name="rollback-ns-rp",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
selected_namespaces=gcp.gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs(
namespaces=["my-ns"],
),
namespaced_resource_restore_mode="DELETE_AND_RESTORE",
volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
selected_group_kinds=[
gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs(
resource_group="apiextension.k8s.io",
resource_kind="CustomResourceDefinition",
),
gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs(
resource_group="storage.k8s.io",
resource_kind="StorageClass",
),
],
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("rollback-ns-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("rollback-ns"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "rollback_ns", &gkebackup.RestorePlanArgs{
Name: pulumi.String("rollback-ns-rp"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
SelectedNamespaces: &gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs{
Namespaces: pulumi.StringArray{
pulumi.String("my-ns"),
},
},
NamespacedResourceRestoreMode: pulumi.String("DELETE_AND_RESTORE"),
VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
SelectedGroupKinds: gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArray{
&gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs{
ResourceGroup: pulumi.String("apiextension.k8s.io"),
ResourceKind: pulumi.String("CustomResourceDefinition"),
},
&gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs{
ResourceGroup: pulumi.String("storage.k8s.io"),
ResourceKind: pulumi.String("StorageClass"),
},
},
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "rollback-ns-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "rollback-ns",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var rollbackNs = new Gcp.GkeBackup.RestorePlan("rollback_ns", new()
{
Name = "rollback-ns-rp",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
SelectedNamespaces = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedNamespacesArgs
{
Namespaces = new[]
{
"my-ns",
},
},
NamespacedResourceRestoreMode = "DELETE_AND_RESTORE",
VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
SelectedGroupKinds = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs
{
ResourceGroup = "apiextension.k8s.io",
ResourceKind = "CustomResourceDefinition",
},
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs
{
ResourceGroup = "storage.k8s.io",
ResourceKind = "StorageClass",
},
},
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigSelectedNamespacesArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("rollback-ns-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("rollback-ns")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var rollbackNs = new RestorePlan("rollbackNs", RestorePlanArgs.builder()
.name("rollback-ns-rp")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.selectedNamespaces(RestorePlanRestoreConfigSelectedNamespacesArgs.builder()
.namespaces("my-ns")
.build())
.namespacedResourceRestoreMode("DELETE_AND_RESTORE")
.volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.selectedGroupKinds(
RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs.builder()
.resourceGroup("apiextension.k8s.io")
.resourceKind("CustomResourceDefinition")
.build(),
RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs.builder()
.resourceGroup("storage.k8s.io")
.resourceKind("StorageClass")
.build())
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: rollback-ns-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: rollback-ns
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
rollbackNs:
type: gcp:gkebackup:RestorePlan
name: rollback_ns
properties:
name: rollback-ns-rp
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
selectedNamespaces:
namespaces:
- my-ns
namespacedResourceRestoreMode: DELETE_AND_RESTORE
volumeDataRestorePolicy: RESTORE_VOLUME_DATA_FROM_BACKUP
clusterResourceRestoreScope:
selectedGroupKinds:
- resourceGroup: apiextension.k8s.io
resourceKind: CustomResourceDefinition
- resourceGroup: storage.k8s.io
resourceKind: StorageClass
clusterResourceConflictPolicy: USE_EXISTING_VERSION
Gkebackup Restoreplan Protected Application
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "rollback-app-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "rollback-app",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const rollbackApp = new gcp.gkebackup.RestorePlan("rollback_app", {
name: "rollback-app-rp",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
selectedApplications: {
namespacedNames: [{
name: "my-app",
namespace: "my-ns",
}],
},
namespacedResourceRestoreMode: "DELETE_AND_RESTORE",
volumeDataRestorePolicy: "REUSE_VOLUME_HANDLE_FROM_BACKUP",
clusterResourceRestoreScope: {
noGroupKinds: true,
},
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="rollback-app-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="rollback-app",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
rollback_app = gcp.gkebackup.RestorePlan("rollback_app",
name="rollback-app-rp",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
selected_applications=gcp.gkebackup.RestorePlanRestoreConfigSelectedApplicationsArgs(
namespaced_names=[gcp.gkebackup.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs(
name="my-app",
namespace="my-ns",
)],
),
namespaced_resource_restore_mode="DELETE_AND_RESTORE",
volume_data_restore_policy="REUSE_VOLUME_HANDLE_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
no_group_kinds=True,
),
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("rollback-app-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("rollback-app"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "rollback_app", &gkebackup.RestorePlanArgs{
Name: pulumi.String("rollback-app-rp"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
SelectedApplications: &gkebackup.RestorePlanRestoreConfigSelectedApplicationsArgs{
NamespacedNames: gkebackup.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArray{
&gkebackup.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs{
Name: pulumi.String("my-app"),
Namespace: pulumi.String("my-ns"),
},
},
},
NamespacedResourceRestoreMode: pulumi.String("DELETE_AND_RESTORE"),
VolumeDataRestorePolicy: pulumi.String("REUSE_VOLUME_HANDLE_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
NoGroupKinds: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "rollback-app-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "rollback-app",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var rollbackApp = new Gcp.GkeBackup.RestorePlan("rollback_app", new()
{
Name = "rollback-app-rp",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
SelectedApplications = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedApplicationsArgs
{
NamespacedNames = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs
{
Name = "my-app",
Namespace = "my-ns",
},
},
},
NamespacedResourceRestoreMode = "DELETE_AND_RESTORE",
VolumeDataRestorePolicy = "REUSE_VOLUME_HANDLE_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
NoGroupKinds = true,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigSelectedApplicationsArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("rollback-app-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("rollback-app")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var rollbackApp = new RestorePlan("rollbackApp", RestorePlanArgs.builder()
.name("rollback-app-rp")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.selectedApplications(RestorePlanRestoreConfigSelectedApplicationsArgs.builder()
.namespacedNames(RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs.builder()
.name("my-app")
.namespace("my-ns")
.build())
.build())
.namespacedResourceRestoreMode("DELETE_AND_RESTORE")
.volumeDataRestorePolicy("REUSE_VOLUME_HANDLE_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.noGroupKinds(true)
.build())
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: rollback-app-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: rollback-app
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
rollbackApp:
type: gcp:gkebackup:RestorePlan
name: rollback_app
properties:
name: rollback-app-rp
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
selectedApplications:
namespacedNames:
- name: my-app
namespace: my-ns
namespacedResourceRestoreMode: DELETE_AND_RESTORE
volumeDataRestorePolicy: REUSE_VOLUME_HANDLE_FROM_BACKUP
clusterResourceRestoreScope:
noGroupKinds: true
Gkebackup Restoreplan All Cluster Resources
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "all-groupkinds-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "all-groupkinds",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const allClusterResources = new gcp.gkebackup.RestorePlan("all_cluster_resources", {
name: "all-groupkinds-rp",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
noNamespaces: true,
namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
clusterResourceRestoreScope: {
allGroupKinds: true,
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="all-groupkinds-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="all-groupkinds",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
all_cluster_resources = gcp.gkebackup.RestorePlan("all_cluster_resources",
name="all-groupkinds-rp",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
no_namespaces=True,
namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
all_group_kinds=True,
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("all-groupkinds-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("all-groupkinds"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "all_cluster_resources", &gkebackup.RestorePlanArgs{
Name: pulumi.String("all-groupkinds-rp"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
NoNamespaces: pulumi.Bool(true),
NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
AllGroupKinds: pulumi.Bool(true),
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "all-groupkinds-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "all-groupkinds",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var allClusterResources = new Gcp.GkeBackup.RestorePlan("all_cluster_resources", new()
{
Name = "all-groupkinds-rp",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
NoNamespaces = true,
NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
AllGroupKinds = true,
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("all-groupkinds-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("all-groupkinds")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var allClusterResources = new RestorePlan("allClusterResources", RestorePlanArgs.builder()
.name("all-groupkinds-rp")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.noNamespaces(true)
.namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.allGroupKinds(true)
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: all-groupkinds-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: all-groupkinds
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
allClusterResources:
type: gcp:gkebackup:RestorePlan
name: all_cluster_resources
properties:
name: all-groupkinds-rp
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
noNamespaces: true
namespacedResourceRestoreMode: FAIL_ON_CONFLICT
clusterResourceRestoreScope:
allGroupKinds: true
clusterResourceConflictPolicy: USE_EXISTING_VERSION
Gkebackup Restoreplan Rename Namespace
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "rename-ns-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "rename-ns",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const renameNs = new gcp.gkebackup.RestorePlan("rename_ns", {
name: "rename-ns-rp",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
selectedNamespaces: {
namespaces: ["ns1"],
},
namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
volumeDataRestorePolicy: "REUSE_VOLUME_HANDLE_FROM_BACKUP",
clusterResourceRestoreScope: {
noGroupKinds: true,
},
transformationRules: [
{
description: "rename namespace from ns1 to ns2",
resourceFilter: {
groupKinds: [{
resourceKind: "Namespace",
}],
jsonPath: ".metadata[?(@.name == 'ns1')]",
},
fieldActions: [{
op: "REPLACE",
path: "/metadata/name",
value: "ns2",
}],
},
{
description: "move all resources from ns1 to ns2",
resourceFilter: {
namespaces: ["ns1"],
},
fieldActions: [{
op: "REPLACE",
path: "/metadata/namespace",
value: "ns2",
}],
},
],
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="rename-ns-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="rename-ns",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
rename_ns = gcp.gkebackup.RestorePlan("rename_ns",
name="rename-ns-rp",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
selected_namespaces=gcp.gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs(
namespaces=["ns1"],
),
namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
volume_data_restore_policy="REUSE_VOLUME_HANDLE_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
no_group_kinds=True,
),
transformation_rules=[
gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleArgs(
description="rename namespace from ns1 to ns2",
resource_filter=gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs(
group_kinds=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs(
resource_kind="Namespace",
)],
json_path=".metadata[?(@.name == 'ns1')]",
),
field_actions=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs(
op="REPLACE",
path="/metadata/name",
value="ns2",
)],
),
gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleArgs(
description="move all resources from ns1 to ns2",
resource_filter=gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs(
namespaces=["ns1"],
),
field_actions=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs(
op="REPLACE",
path="/metadata/namespace",
value="ns2",
)],
),
],
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("rename-ns-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("rename-ns"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "rename_ns", &gkebackup.RestorePlanArgs{
Name: pulumi.String("rename-ns-rp"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
SelectedNamespaces: &gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs{
Namespaces: pulumi.StringArray{
pulumi.String("ns1"),
},
},
NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
VolumeDataRestorePolicy: pulumi.String("REUSE_VOLUME_HANDLE_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
NoGroupKinds: pulumi.Bool(true),
},
TransformationRules: gkebackup.RestorePlanRestoreConfigTransformationRuleArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleArgs{
Description: pulumi.String("rename namespace from ns1 to ns2"),
ResourceFilter: &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs{
GroupKinds: gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs{
ResourceKind: pulumi.String("Namespace"),
},
},
JsonPath: pulumi.String(".metadata[?(@.name == 'ns1')]"),
},
FieldActions: gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs{
Op: pulumi.String("REPLACE"),
Path: pulumi.String("/metadata/name"),
Value: pulumi.String("ns2"),
},
},
},
&gkebackup.RestorePlanRestoreConfigTransformationRuleArgs{
Description: pulumi.String("move all resources from ns1 to ns2"),
ResourceFilter: &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs{
Namespaces: pulumi.StringArray{
pulumi.String("ns1"),
},
},
FieldActions: gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs{
Op: pulumi.String("REPLACE"),
Path: pulumi.String("/metadata/namespace"),
Value: pulumi.String("ns2"),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "rename-ns-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "rename-ns",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var renameNs = new Gcp.GkeBackup.RestorePlan("rename_ns", new()
{
Name = "rename-ns-rp",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
SelectedNamespaces = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedNamespacesArgs
{
Namespaces = new[]
{
"ns1",
},
},
NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
VolumeDataRestorePolicy = "REUSE_VOLUME_HANDLE_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
NoGroupKinds = true,
},
TransformationRules = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleArgs
{
Description = "rename namespace from ns1 to ns2",
ResourceFilter = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs
{
GroupKinds = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs
{
ResourceKind = "Namespace",
},
},
JsonPath = ".metadata[?(@.name == 'ns1')]",
},
FieldActions = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleFieldActionArgs
{
Op = "REPLACE",
Path = "/metadata/name",
Value = "ns2",
},
},
},
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleArgs
{
Description = "move all resources from ns1 to ns2",
ResourceFilter = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs
{
Namespaces = new[]
{
"ns1",
},
},
FieldActions = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleFieldActionArgs
{
Op = "REPLACE",
Path = "/metadata/namespace",
Value = "ns2",
},
},
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigSelectedNamespacesArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("rename-ns-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("rename-ns")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var renameNs = new RestorePlan("renameNs", RestorePlanArgs.builder()
.name("rename-ns-rp")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.selectedNamespaces(RestorePlanRestoreConfigSelectedNamespacesArgs.builder()
.namespaces("ns1")
.build())
.namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
.volumeDataRestorePolicy("REUSE_VOLUME_HANDLE_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.noGroupKinds(true)
.build())
.transformationRules(
RestorePlanRestoreConfigTransformationRuleArgs.builder()
.description("rename namespace from ns1 to ns2")
.resourceFilter(RestorePlanRestoreConfigTransformationRuleResourceFilterArgs.builder()
.groupKinds(RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs.builder()
.resourceKind("Namespace")
.build())
.jsonPath(".metadata[?(@.name == 'ns1')]")
.build())
.fieldActions(RestorePlanRestoreConfigTransformationRuleFieldActionArgs.builder()
.op("REPLACE")
.path("/metadata/name")
.value("ns2")
.build())
.build(),
RestorePlanRestoreConfigTransformationRuleArgs.builder()
.description("move all resources from ns1 to ns2")
.resourceFilter(RestorePlanRestoreConfigTransformationRuleResourceFilterArgs.builder()
.namespaces("ns1")
.build())
.fieldActions(RestorePlanRestoreConfigTransformationRuleFieldActionArgs.builder()
.op("REPLACE")
.path("/metadata/namespace")
.value("ns2")
.build())
.build())
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: rename-ns-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: rename-ns
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
renameNs:
type: gcp:gkebackup:RestorePlan
name: rename_ns
properties:
name: rename-ns-rp
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
selectedNamespaces:
namespaces:
- ns1
namespacedResourceRestoreMode: FAIL_ON_CONFLICT
volumeDataRestorePolicy: REUSE_VOLUME_HANDLE_FROM_BACKUP
clusterResourceRestoreScope:
noGroupKinds: true
transformationRules:
- description: rename namespace from ns1 to ns2
resourceFilter:
groupKinds:
- resourceKind: Namespace
jsonPath: .metadata[?(@.name == 'ns1')]
fieldActions:
- op: REPLACE
path: /metadata/name
value: ns2
- description: move all resources from ns1 to ns2
resourceFilter:
namespaces:
- ns1
fieldActions:
- op: REPLACE
path: /metadata/namespace
value: ns2
Gkebackup Restoreplan Second Transformation
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "transform-rule-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "transform-rule",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const transformRule = new gcp.gkebackup.RestorePlan("transform_rule", {
name: "transform-rule-rp",
description: "copy nginx env variables",
labels: {
app: "nginx",
},
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
excludedNamespaces: {
namespaces: ["my-ns"],
},
namespacedResourceRestoreMode: "DELETE_AND_RESTORE",
volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
clusterResourceRestoreScope: {
excludedGroupKinds: [{
resourceGroup: "apiextension.k8s.io",
resourceKind: "CustomResourceDefinition",
}],
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
transformationRules: [{
description: "Copy environment variables from the nginx container to the install init container.",
resourceFilter: {
groupKinds: [{
resourceKind: "Pod",
resourceGroup: "",
}],
jsonPath: ".metadata[?(@.name == 'nginx')]",
},
fieldActions: [{
op: "COPY",
path: "/spec/initContainers/0/env",
fromPath: "/spec/containers/0/env",
}],
}],
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="transform-rule-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="transform-rule",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
transform_rule = gcp.gkebackup.RestorePlan("transform_rule",
name="transform-rule-rp",
description="copy nginx env variables",
labels={
"app": "nginx",
},
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
excluded_namespaces=gcp.gkebackup.RestorePlanRestoreConfigExcludedNamespacesArgs(
namespaces=["my-ns"],
),
namespaced_resource_restore_mode="DELETE_AND_RESTORE",
volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
excluded_group_kinds=[gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs(
resource_group="apiextension.k8s.io",
resource_kind="CustomResourceDefinition",
)],
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
transformation_rules=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleArgs(
description="Copy environment variables from the nginx container to the install init container.",
resource_filter=gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs(
group_kinds=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs(
resource_kind="Pod",
resource_group="",
)],
json_path=".metadata[?(@.name == 'nginx')]",
),
field_actions=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs(
op="COPY",
path="/spec/initContainers/0/env",
from_path="/spec/containers/0/env",
)],
)],
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("transform-rule-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("transform-rule"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "transform_rule", &gkebackup.RestorePlanArgs{
Name: pulumi.String("transform-rule-rp"),
Description: pulumi.String("copy nginx env variables"),
Labels: pulumi.StringMap{
"app": pulumi.String("nginx"),
},
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
ExcludedNamespaces: &gkebackup.RestorePlanRestoreConfigExcludedNamespacesArgs{
Namespaces: pulumi.StringArray{
pulumi.String("my-ns"),
},
},
NamespacedResourceRestoreMode: pulumi.String("DELETE_AND_RESTORE"),
VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
ExcludedGroupKinds: gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArray{
&gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs{
ResourceGroup: pulumi.String("apiextension.k8s.io"),
ResourceKind: pulumi.String("CustomResourceDefinition"),
},
},
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
TransformationRules: gkebackup.RestorePlanRestoreConfigTransformationRuleArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleArgs{
Description: pulumi.String("Copy environment variables from the nginx container to the install init container."),
ResourceFilter: &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs{
GroupKinds: gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs{
ResourceKind: pulumi.String("Pod"),
ResourceGroup: pulumi.String(""),
},
},
JsonPath: pulumi.String(".metadata[?(@.name == 'nginx')]"),
},
FieldActions: gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArray{
&gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs{
Op: pulumi.String("COPY"),
Path: pulumi.String("/spec/initContainers/0/env"),
FromPath: pulumi.String("/spec/containers/0/env"),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "transform-rule-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "transform-rule",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var transformRule = new Gcp.GkeBackup.RestorePlan("transform_rule", new()
{
Name = "transform-rule-rp",
Description = "copy nginx env variables",
Labels =
{
{ "app", "nginx" },
},
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
ExcludedNamespaces = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigExcludedNamespacesArgs
{
Namespaces = new[]
{
"my-ns",
},
},
NamespacedResourceRestoreMode = "DELETE_AND_RESTORE",
VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
ExcludedGroupKinds = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs
{
ResourceGroup = "apiextension.k8s.io",
ResourceKind = "CustomResourceDefinition",
},
},
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
TransformationRules = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleArgs
{
Description = "Copy environment variables from the nginx container to the install init container.",
ResourceFilter = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs
{
GroupKinds = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs
{
ResourceKind = "Pod",
ResourceGroup = "",
},
},
JsonPath = ".metadata[?(@.name == 'nginx')]",
},
FieldActions = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleFieldActionArgs
{
Op = "COPY",
Path = "/spec/initContainers/0/env",
FromPath = "/spec/containers/0/env",
},
},
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigExcludedNamespacesArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("transform-rule-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("transform-rule")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var transformRule = new RestorePlan("transformRule", RestorePlanArgs.builder()
.name("transform-rule-rp")
.description("copy nginx env variables")
.labels(Map.of("app", "nginx"))
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.excludedNamespaces(RestorePlanRestoreConfigExcludedNamespacesArgs.builder()
.namespaces("my-ns")
.build())
.namespacedResourceRestoreMode("DELETE_AND_RESTORE")
.volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.excludedGroupKinds(RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs.builder()
.resourceGroup("apiextension.k8s.io")
.resourceKind("CustomResourceDefinition")
.build())
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.transformationRules(RestorePlanRestoreConfigTransformationRuleArgs.builder()
.description("Copy environment variables from the nginx container to the install init container.")
.resourceFilter(RestorePlanRestoreConfigTransformationRuleResourceFilterArgs.builder()
.groupKinds(RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs.builder()
.resourceKind("Pod")
.resourceGroup("")
.build())
.jsonPath(".metadata[?(@.name == 'nginx')]")
.build())
.fieldActions(RestorePlanRestoreConfigTransformationRuleFieldActionArgs.builder()
.op("COPY")
.path("/spec/initContainers/0/env")
.fromPath("/spec/containers/0/env")
.build())
.build())
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: transform-rule-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: transform-rule
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
transformRule:
type: gcp:gkebackup:RestorePlan
name: transform_rule
properties:
name: transform-rule-rp
description: copy nginx env variables
labels:
app: nginx
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
excludedNamespaces:
namespaces:
- my-ns
namespacedResourceRestoreMode: DELETE_AND_RESTORE
volumeDataRestorePolicy: RESTORE_VOLUME_DATA_FROM_BACKUP
clusterResourceRestoreScope:
excludedGroupKinds:
- resourceGroup: apiextension.k8s.io
resourceKind: CustomResourceDefinition
clusterResourceConflictPolicy: USE_EXISTING_VERSION
transformationRules:
- description: Copy environment variables from the nginx container to the install init container.
resourceFilter:
groupKinds:
- resourceKind: Pod
resourceGroup:
jsonPath: .metadata[?(@.name == 'nginx')]
fieldActions:
- op: COPY
path: /spec/initContainers/0/env
fromPath: /spec/containers/0/env
Gkebackup Restoreplan Gitops Mode
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "gitops-mode-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "gitops-mode",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const gitopsMode = new gcp.gkebackup.RestorePlan("gitops_mode", {
name: "gitops-mode",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
allNamespaces: true,
namespacedResourceRestoreMode: "MERGE_SKIP_ON_CONFLICT",
volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
clusterResourceRestoreScope: {
allGroupKinds: true,
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="gitops-mode-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="gitops-mode",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
gitops_mode = gcp.gkebackup.RestorePlan("gitops_mode",
name="gitops-mode",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
all_namespaces=True,
namespaced_resource_restore_mode="MERGE_SKIP_ON_CONFLICT",
volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
all_group_kinds=True,
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("gitops-mode-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("gitops-mode"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "gitops_mode", &gkebackup.RestorePlanArgs{
Name: pulumi.String("gitops-mode"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
AllNamespaces: pulumi.Bool(true),
NamespacedResourceRestoreMode: pulumi.String("MERGE_SKIP_ON_CONFLICT"),
VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
AllGroupKinds: pulumi.Bool(true),
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "gitops-mode-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "gitops-mode",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var gitopsMode = new Gcp.GkeBackup.RestorePlan("gitops_mode", new()
{
Name = "gitops-mode",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
AllNamespaces = true,
NamespacedResourceRestoreMode = "MERGE_SKIP_ON_CONFLICT",
VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
AllGroupKinds = true,
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("gitops-mode-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("gitops-mode")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var gitopsMode = new RestorePlan("gitopsMode", RestorePlanArgs.builder()
.name("gitops-mode")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.allNamespaces(true)
.namespacedResourceRestoreMode("MERGE_SKIP_ON_CONFLICT")
.volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.allGroupKinds(true)
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: gitops-mode-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: gitops-mode
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
gitopsMode:
type: gcp:gkebackup:RestorePlan
name: gitops_mode
properties:
name: gitops-mode
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
allNamespaces: true
namespacedResourceRestoreMode: MERGE_SKIP_ON_CONFLICT
volumeDataRestorePolicy: RESTORE_VOLUME_DATA_FROM_BACKUP
clusterResourceRestoreScope:
allGroupKinds: true
clusterResourceConflictPolicy: USE_EXISTING_VERSION
Gkebackup Restoreplan Restore Order
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "restore-order-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "restore-order",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const restoreOrder = new gcp.gkebackup.RestorePlan("restore_order", {
name: "restore-order",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
allNamespaces: true,
namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
clusterResourceRestoreScope: {
allGroupKinds: true,
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
restoreOrder: {
groupKindDependencies: [
{
satisfying: {
resourceGroup: "stable.example.com",
resourceKind: "kindA",
},
requiring: {
resourceGroup: "stable.example.com",
resourceKind: "kindB",
},
},
{
satisfying: {
resourceGroup: "stable.example.com",
resourceKind: "kindB",
},
requiring: {
resourceGroup: "stable.example.com",
resourceKind: "kindC",
},
},
],
},
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="restore-order-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="restore-order",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
restore_order = gcp.gkebackup.RestorePlan("restore_order",
name="restore-order",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
all_namespaces=True,
namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
all_group_kinds=True,
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
restore_order=gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderArgs(
group_kind_dependencies=[
gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs(
satisfying=gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs(
resource_group="stable.example.com",
resource_kind="kindA",
),
requiring=gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs(
resource_group="stable.example.com",
resource_kind="kindB",
),
),
gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs(
satisfying=gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs(
resource_group="stable.example.com",
resource_kind="kindB",
),
requiring=gcp.gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs(
resource_group="stable.example.com",
resource_kind="kindC",
),
),
],
),
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("restore-order-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("restore-order"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "restore_order", &gkebackup.RestorePlanArgs{
Name: pulumi.String("restore-order"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
AllNamespaces: pulumi.Bool(true),
NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
AllGroupKinds: pulumi.Bool(true),
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
RestoreOrder: &gkebackup.RestorePlanRestoreConfigRestoreOrderArgs{
GroupKindDependencies: gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArray{
&gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs{
Satisfying: &gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs{
ResourceGroup: pulumi.String("stable.example.com"),
ResourceKind: pulumi.String("kindA"),
},
Requiring: &gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs{
ResourceGroup: pulumi.String("stable.example.com"),
ResourceKind: pulumi.String("kindB"),
},
},
&gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs{
Satisfying: &gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs{
ResourceGroup: pulumi.String("stable.example.com"),
ResourceKind: pulumi.String("kindB"),
},
Requiring: &gkebackup.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs{
ResourceGroup: pulumi.String("stable.example.com"),
ResourceKind: pulumi.String("kindC"),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "restore-order-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "restore-order",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var restoreOrder = new Gcp.GkeBackup.RestorePlan("restore_order", new()
{
Name = "restore-order",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
AllNamespaces = true,
NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
AllGroupKinds = true,
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
RestoreOrder = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderArgs
{
GroupKindDependencies = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs
{
Satisfying = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs
{
ResourceGroup = "stable.example.com",
ResourceKind = "kindA",
},
Requiring = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs
{
ResourceGroup = "stable.example.com",
ResourceKind = "kindB",
},
},
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs
{
Satisfying = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs
{
ResourceGroup = "stable.example.com",
ResourceKind = "kindB",
},
Requiring = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs
{
ResourceGroup = "stable.example.com",
ResourceKind = "kindC",
},
},
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigRestoreOrderArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("restore-order-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("restore-order")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var restoreOrder = new RestorePlan("restoreOrder", RestorePlanArgs.builder()
.name("restore-order")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.allNamespaces(true)
.namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
.volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.allGroupKinds(true)
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.restoreOrder(RestorePlanRestoreConfigRestoreOrderArgs.builder()
.groupKindDependencies(
RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs.builder()
.satisfying(RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs.builder()
.resourceGroup("stable.example.com")
.resourceKind("kindA")
.build())
.requiring(RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs.builder()
.resourceGroup("stable.example.com")
.resourceKind("kindB")
.build())
.build(),
RestorePlanRestoreConfigRestoreOrderGroupKindDependencyArgs.builder()
.satisfying(RestorePlanRestoreConfigRestoreOrderGroupKindDependencySatisfyingArgs.builder()
.resourceGroup("stable.example.com")
.resourceKind("kindB")
.build())
.requiring(RestorePlanRestoreConfigRestoreOrderGroupKindDependencyRequiringArgs.builder()
.resourceGroup("stable.example.com")
.resourceKind("kindC")
.build())
.build())
.build())
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: restore-order-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: restore-order
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
restoreOrder:
type: gcp:gkebackup:RestorePlan
name: restore_order
properties:
name: restore-order
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
allNamespaces: true
namespacedResourceRestoreMode: FAIL_ON_CONFLICT
volumeDataRestorePolicy: RESTORE_VOLUME_DATA_FROM_BACKUP
clusterResourceRestoreScope:
allGroupKinds: true
clusterResourceConflictPolicy: USE_EXISTING_VERSION
restoreOrder:
groupKindDependencies:
- satisfying:
resourceGroup: stable.example.com
resourceKind: kindA
requiring:
resourceGroup: stable.example.com
resourceKind: kindB
- satisfying:
resourceGroup: stable.example.com
resourceKind: kindB
requiring:
resourceGroup: stable.example.com
resourceKind: kindC
Gkebackup Restoreplan Volume Res
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.container.Cluster("primary", {
name: "volume-res-cluster",
location: "us-central1",
initialNodeCount: 1,
workloadIdentityConfig: {
workloadPool: "my-project-name.svc.id.goog",
},
addonsConfig: {
gkeBackupAgentConfig: {
enabled: true,
},
},
deletionProtection: "",
network: "default",
subnetwork: "default",
});
const basic = new gcp.gkebackup.BackupPlan("basic", {
name: "volume-res",
cluster: primary.id,
location: "us-central1",
backupConfig: {
includeVolumeData: true,
includeSecrets: true,
allNamespaces: true,
},
});
const volumeRes = new gcp.gkebackup.RestorePlan("volume_res", {
name: "volume-res",
location: "us-central1",
backupPlan: basic.id,
cluster: primary.id,
restoreConfig: {
allNamespaces: true,
namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
volumeDataRestorePolicy: "NO_VOLUME_DATA_RESTORATION",
clusterResourceRestoreScope: {
allGroupKinds: true,
},
clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
volumeDataRestorePolicyBindings: [{
policy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
volumeType: "GCE_PERSISTENT_DISK",
}],
},
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.container.Cluster("primary",
name="volume-res-cluster",
location="us-central1",
initial_node_count=1,
workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
workload_pool="my-project-name.svc.id.goog",
),
addons_config=gcp.container.ClusterAddonsConfigArgs(
gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
enabled=True,
),
),
deletion_protection="",
network="default",
subnetwork="default")
basic = gcp.gkebackup.BackupPlan("basic",
name="volume-res",
cluster=primary.id,
location="us-central1",
backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
include_volume_data=True,
include_secrets=True,
all_namespaces=True,
))
volume_res = gcp.gkebackup.RestorePlan("volume_res",
name="volume-res",
location="us-central1",
backup_plan=basic.id,
cluster=primary.id,
restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
all_namespaces=True,
namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
volume_data_restore_policy="NO_VOLUME_DATA_RESTORATION",
cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
all_group_kinds=True,
),
cluster_resource_conflict_policy="USE_EXISTING_VERSION",
volume_data_restore_policy_bindings=[gcp.gkebackup.RestorePlanRestoreConfigVolumeDataRestorePolicyBindingArgs(
policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
volume_type="GCE_PERSISTENT_DISK",
)],
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
Name: pulumi.String("volume-res-cluster"),
Location: pulumi.String("us-central1"),
InitialNodeCount: pulumi.Int(1),
WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
},
AddonsConfig: &container.ClusterAddonsConfigArgs{
GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
Enabled: pulumi.Bool(true),
},
},
DeletionProtection: pulumi.Bool(""),
Network: pulumi.String("default"),
Subnetwork: pulumi.String("default"),
})
if err != nil {
return err
}
basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
Name: pulumi.String("volume-res"),
Cluster: primary.ID(),
Location: pulumi.String("us-central1"),
BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
IncludeVolumeData: pulumi.Bool(true),
IncludeSecrets: pulumi.Bool(true),
AllNamespaces: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = gkebackup.NewRestorePlan(ctx, "volume_res", &gkebackup.RestorePlanArgs{
Name: pulumi.String("volume-res"),
Location: pulumi.String("us-central1"),
BackupPlan: basic.ID(),
Cluster: primary.ID(),
RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
AllNamespaces: pulumi.Bool(true),
NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
VolumeDataRestorePolicy: pulumi.String("NO_VOLUME_DATA_RESTORATION"),
ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
AllGroupKinds: pulumi.Bool(true),
},
ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
VolumeDataRestorePolicyBindings: gkebackup.RestorePlanRestoreConfigVolumeDataRestorePolicyBindingArray{
&gkebackup.RestorePlanRestoreConfigVolumeDataRestorePolicyBindingArgs{
Policy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
VolumeType: pulumi.String("GCE_PERSISTENT_DISK"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.Container.Cluster("primary", new()
{
Name = "volume-res-cluster",
Location = "us-central1",
InitialNodeCount = 1,
WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
{
WorkloadPool = "my-project-name.svc.id.goog",
},
AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
{
GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
{
Enabled = true,
},
},
DeletionProtection = "",
Network = "default",
Subnetwork = "default",
});
var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
{
Name = "volume-res",
Cluster = primary.Id,
Location = "us-central1",
BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
{
IncludeVolumeData = true,
IncludeSecrets = true,
AllNamespaces = true,
},
});
var volumeRes = new Gcp.GkeBackup.RestorePlan("volume_res", new()
{
Name = "volume-res",
Location = "us-central1",
BackupPlan = basic.Id,
Cluster = primary.Id,
RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
{
AllNamespaces = true,
NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
VolumeDataRestorePolicy = "NO_VOLUME_DATA_RESTORATION",
ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
{
AllGroupKinds = true,
},
ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
VolumeDataRestorePolicyBindings = new[]
{
new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigVolumeDataRestorePolicyBindingArgs
{
Policy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
VolumeType = "GCE_PERSISTENT_DISK",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Cluster;
import com.pulumi.gcp.container.ClusterArgs;
import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
import com.pulumi.gcp.gkebackup.BackupPlan;
import com.pulumi.gcp.gkebackup.BackupPlanArgs;
import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
import com.pulumi.gcp.gkebackup.RestorePlan;
import com.pulumi.gcp.gkebackup.RestorePlanArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Cluster("primary", ClusterArgs.builder()
.name("volume-res-cluster")
.location("us-central1")
.initialNodeCount(1)
.workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
.workloadPool("my-project-name.svc.id.goog")
.build())
.addonsConfig(ClusterAddonsConfigArgs.builder()
.gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
.enabled(true)
.build())
.build())
.deletionProtection("")
.network("default")
.subnetwork("default")
.build());
var basic = new BackupPlan("basic", BackupPlanArgs.builder()
.name("volume-res")
.cluster(primary.id())
.location("us-central1")
.backupConfig(BackupPlanBackupConfigArgs.builder()
.includeVolumeData(true)
.includeSecrets(true)
.allNamespaces(true)
.build())
.build());
var volumeRes = new RestorePlan("volumeRes", RestorePlanArgs.builder()
.name("volume-res")
.location("us-central1")
.backupPlan(basic.id())
.cluster(primary.id())
.restoreConfig(RestorePlanRestoreConfigArgs.builder()
.allNamespaces(true)
.namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
.volumeDataRestorePolicy("NO_VOLUME_DATA_RESTORATION")
.clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
.allGroupKinds(true)
.build())
.clusterResourceConflictPolicy("USE_EXISTING_VERSION")
.volumeDataRestorePolicyBindings(RestorePlanRestoreConfigVolumeDataRestorePolicyBindingArgs.builder()
.policy("RESTORE_VOLUME_DATA_FROM_BACKUP")
.volumeType("GCE_PERSISTENT_DISK")
.build())
.build())
.build());
}
}
resources:
primary:
type: gcp:container:Cluster
properties:
name: volume-res-cluster
location: us-central1
initialNodeCount: 1
workloadIdentityConfig:
workloadPool: my-project-name.svc.id.goog
addonsConfig:
gkeBackupAgentConfig:
enabled: true
deletionProtection:
network: default
subnetwork: default
basic:
type: gcp:gkebackup:BackupPlan
properties:
name: volume-res
cluster: ${primary.id}
location: us-central1
backupConfig:
includeVolumeData: true
includeSecrets: true
allNamespaces: true
volumeRes:
type: gcp:gkebackup:RestorePlan
name: volume_res
properties:
name: volume-res
location: us-central1
backupPlan: ${basic.id}
cluster: ${primary.id}
restoreConfig:
allNamespaces: true
namespacedResourceRestoreMode: FAIL_ON_CONFLICT
volumeDataRestorePolicy: NO_VOLUME_DATA_RESTORATION
clusterResourceRestoreScope:
allGroupKinds: true
clusterResourceConflictPolicy: USE_EXISTING_VERSION
volumeDataRestorePolicyBindings:
- policy: RESTORE_VOLUME_DATA_FROM_BACKUP
volumeType: GCE_PERSISTENT_DISK
Create RestorePlanIamMember Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RestorePlanIamMember(name: string, args: RestorePlanIamMemberArgs, opts?: CustomResourceOptions);
@overload
def RestorePlanIamMember(resource_name: str,
args: RestorePlanIamMemberArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RestorePlanIamMember(resource_name: str,
opts: Optional[ResourceOptions] = None,
member: Optional[str] = None,
role: Optional[str] = None,
condition: Optional[RestorePlanIamMemberConditionArgs] = None,
location: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None)
func NewRestorePlanIamMember(ctx *Context, name string, args RestorePlanIamMemberArgs, opts ...ResourceOption) (*RestorePlanIamMember, error)
public RestorePlanIamMember(string name, RestorePlanIamMemberArgs args, CustomResourceOptions? opts = null)
public RestorePlanIamMember(String name, RestorePlanIamMemberArgs args)
public RestorePlanIamMember(String name, RestorePlanIamMemberArgs args, CustomResourceOptions options)
type: gcp:gkebackup:RestorePlanIamMember
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RestorePlanIamMemberArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RestorePlanIamMemberArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RestorePlanIamMemberArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RestorePlanIamMemberArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RestorePlanIamMemberArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var restorePlanIamMemberResource = new Gcp.GkeBackup.RestorePlanIamMember("restorePlanIamMemberResource", new()
{
Member = "string",
Role = "string",
Condition = new Gcp.GkeBackup.Inputs.RestorePlanIamMemberConditionArgs
{
Expression = "string",
Title = "string",
Description = "string",
},
Location = "string",
Name = "string",
Project = "string",
});
example, err := gkebackup.NewRestorePlanIamMember(ctx, "restorePlanIamMemberResource", &gkebackup.RestorePlanIamMemberArgs{
Member: pulumi.String("string"),
Role: pulumi.String("string"),
Condition: &gkebackup.RestorePlanIamMemberConditionArgs{
Expression: pulumi.String("string"),
Title: pulumi.String("string"),
Description: pulumi.String("string"),
},
Location: pulumi.String("string"),
Name: pulumi.String("string"),
Project: pulumi.String("string"),
})
var restorePlanIamMemberResource = new RestorePlanIamMember("restorePlanIamMemberResource", RestorePlanIamMemberArgs.builder()
.member("string")
.role("string")
.condition(RestorePlanIamMemberConditionArgs.builder()
.expression("string")
.title("string")
.description("string")
.build())
.location("string")
.name("string")
.project("string")
.build());
restore_plan_iam_member_resource = gcp.gkebackup.RestorePlanIamMember("restorePlanIamMemberResource",
member="string",
role="string",
condition=gcp.gkebackup.RestorePlanIamMemberConditionArgs(
expression="string",
title="string",
description="string",
),
location="string",
name="string",
project="string")
const restorePlanIamMemberResource = new gcp.gkebackup.RestorePlanIamMember("restorePlanIamMemberResource", {
member: "string",
role: "string",
condition: {
expression: "string",
title: "string",
description: "string",
},
location: "string",
name: "string",
project: "string",
});
type: gcp:gkebackup:RestorePlanIamMember
properties:
condition:
description: string
expression: string
title: string
location: string
member: string
name: string
project: string
role: string
RestorePlanIamMember Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The RestorePlanIamMember resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the RestorePlanIamMember resource produces the following output properties:
Look up Existing RestorePlanIamMember Resource
Get an existing RestorePlanIamMember resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RestorePlanIamMemberState, opts?: CustomResourceOptions): RestorePlanIamMember
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
condition: Optional[RestorePlanIamMemberConditionArgs] = None,
etag: Optional[str] = None,
location: Optional[str] = None,
member: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
role: Optional[str] = None) -> RestorePlanIamMember
func GetRestorePlanIamMember(ctx *Context, name string, id IDInput, state *RestorePlanIamMemberState, opts ...ResourceOption) (*RestorePlanIamMember, error)
public static RestorePlanIamMember Get(string name, Input<string> id, RestorePlanIamMemberState? state, CustomResourceOptions? opts = null)
public static RestorePlanIamMember get(String name, Output<String> id, RestorePlanIamMemberState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
Supporting Types
RestorePlanIamMemberCondition, RestorePlanIamMemberConditionArgs
- Expression string
- Title string
- Description string
- Expression string
- Title string
- Description string
- expression String
- title String
- description String
- expression string
- title string
- description string
- expression str
- title str
- description str
- expression String
- title String
- description String
Import
RestorePlan can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/restorePlans/{{name}}
{{project}}/{{location}}/{{name}}
{{location}}/{{name}}
When using the pulumi import
command, RestorePlan can be imported using one of the formats above. For example:
$ pulumi import gcp:gkebackup/restorePlanIamMember:RestorePlanIamMember default projects/{{project}}/locations/{{location}}/restorePlans/{{name}}
$ pulumi import gcp:gkebackup/restorePlanIamMember:RestorePlanIamMember default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:gkebackup/restorePlanIamMember:RestorePlanIamMember default {{location}}/{{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.