This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Samples

1 - RecoveryPlan

1.1 - Generic Applications

The following RecoveryPlan synchronize many Kubernetes resources between the source and destination clusters:

  • Deployments
  • ConfigMaps
  • Secrets
  • Services
  • CronJobs
apiVersion: dr.astronetes.io/v1alpha1
kind: RecoveryPlan
metadata:
  name: applications
spec:
  suspend: false
  forceNamespaceCreation: true
  sourceClusterRef:
    name: source
    namespace: dr-maqueta
  destinationClusterRef:
    name: destination
    namespace: dr-maqueta
  resources:
    - group: apps
      version: v1
      resource: deployments
      transformation:
        patch:
          - op: replace
            path: /spec/replicas
            value: 0
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled
      recoveryProcess:
        fromPatch:
          - op: replace
            path: /spec/replicas
            value: 1
    - version: v1
      resource: services
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled
    - version: v1
      resource: secrets
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled
    - version: v1
      resource: configmaps
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled
    - group: batch
      version: v1
      resource: cronjobs
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled

1.2 - Namespaces

This RecoveryPlan synchronize namespaces between the source and destination clusters.

apiVersion: dr.astronetes.io/v1alpha1
kind: RecoveryPlan
metadata:
  name: ns
spec:
  suspend: false 
  sourceClusterRef:
    name: source
    namespace: dr-maqueta
  destinationClusterRef:
    name: destination
    namespace: dr-maqueta
  resources:
    - version: v1
      resource: namespaces
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled

1.3 - Secrets

This RecoveryPlan synchronize the secrets between the source and destination clusters.

apiVersion: dr.astronetes.io/v1alpha1
kind: RecoveryPlan
metadata:
  name: apps-pre
spec:
  suspend: false
  forceNamespaceCreation: true
  sourceClusterRef:
    name: source
    namespace: dr-maqueta
  destinationClusterRef:
    name: destination
    namespace: dr-maqueta
  resources:
    - version: v1
      resource: secrets
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled

1.4 - Services

This RecoveryPlan synchronize the Services between the source and destination clusters.

apiVersion: dr.astronetes.io/v1alpha1
kind: RecoveryPlan
metadata:
  name: apps-pre
spec:
  suspend: false
  forceNamespaceCreation: true
  sourceClusterRef:
    name: source
    namespace: dr-maqueta
  destinationClusterRef:
    name: destination
    namespace: dr-maqueta
  resources:
    - version: v1
      resource: services
      filters:
        selector:
          matchLabels:
            disaster-recovery: enabled
      transformation:
        patch:
          - op: remove
            path: /spec/clusterIP
          - op: remove
            path: /spec/clusterIPs