#--------------------------------------------------------------------------
# Licensed Materials - Property of IBM
#
# (C) Copyright IBM Corporation 2019.
#
# US Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corporation.
#--------------------------------------------------------------------------

apiVersion: v1
data:
  backup_original.yaml: "apiVersion: velero.io/v1\nkind: Backup\nmetadata:\n  name: BACKUP-NAME\n  namespace: velero\nspec:\n  ttl: 72h0m0s\n  includeClusterResources: true\n  includedNamespaces:\n  - '*'\n  excludedNamespaces:\n  - openshift\n  - openshift-apiserver\n  - openshift-apiserver-operator\n  - openshift-authentication\n  - openshift-authentication-operator\n  - openshift-cloud-credential-operator\n  - openshift-cluster-machine-approver \n  - openshift-cluster-node-tuning-operator\n  - openshift-cluster-samples-operator\n  - openshift-cluster-storage-operator\n  - openshift-cluster-version  \n  - openshift-config \n  - openshift-config-managed\n  - openshift-console\n  - openshift-console-operator\n  - openshift-controller-manager \n  - openshift-controller-manager-operator\n  - openshift-dns\n  - openshift-dns-operator\n  - openshift-etcd\n  - openshift-image-registry\n  - openshift-infra\n  - openshift-ingress \n  - openshift-ingress-operator\n  - openshift-insights\n  - openshift-kni-infra\n  - openshift-kube-apiserver\n  - openshift-kube-apiserver-operator\n  - openshift-kube-controller-manager\n  - openshift-kube-controller-manager-operator\n  - openshift-kube-proxy\n  - openshift-kube-scheduler \n  - openshift-kube-scheduler-operator\n  - openshift-machine-api\n  - openshift-machine-config-operator\n  - openshift-marketplace\n  - openshift-monitoring\n  - openshift-multus\n  - openshift-network-operator\n  - openshift-node\n  - openshift-openstack-infra\n  - openshift-operator-lifecycle-manager\n  - openshift-operators\n  - openshift-ovirt-infra\n  - openshift-service-ca\n  - openshift-service-ca-operator\n  - openshift-service-catalog-apiserver-operator\n  - openshift-service-catalog-controller-manager-operator \n  - openshift-user-workload-monitoring\n  - velero\n  includedResources:\n  - '*'\n"
  config.json: |-
    [
      {
        "namespace": "management-infrastructure-management",
        "persistantVolumeClaims": [
          "cam-logs-pv",
          "cam-terraform-pv",
          "cam-mongo-pv"
        ]
      },
      {
        "namespace": "kube-system",
        "persistantVolumeClaims": [
          "etcd-data-multicluster-hub-etcd-0"
        ]
      },
      {
        "namespace": "openldap",
        "persistantVolumeClaims": [
          "openldap",
          "openldap-config"
        ]
      }
    ]
  pod-annotation-details.json: |-
    {
      "details": [
        {
          "namespace": "ibm-common-services",
          "pod": "alertmanager-ibm-monitoring-alertmanager-0",
          "volume": "alertmanager-ibm-monitoring-alertmanager-db"
        },
        {
          "namespace": "ibm-common-services",
          "pod": "logging-elk-data-0",
          "volume": "data"
        },
        {
          "namespace": "ibm-common-services",
          "pod": "prometheus-ibm-monitoring-prometheus-0",
          "volume": "prometheus-ibm-monitoring-prometheus-db"
        },
        {
          "namespace": "ibm-common-services",
          "pod": "dummy-db",
          "volume": "mongodump"
        },
        {
          "namespace": "management-monitoring",
          "pod": "monitoring-couchdb-0",
          "volume": "data"
        },
        {
          "namespace": "management-monitoring",
          "pod": "monitoring-cassandra-0",
          "volume": "data"
        },
        {
          "namespace": "management-monitoring",
          "pod": "monitoring-ibm-cem-datalayer-0",
          "volume": "jobs"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-bpd-cds",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-controller-manager-0",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-iaas",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-mongo",
          "volume": "cam-mongo-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-orchestration",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-portal-ui",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-provider-helm",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-provider-terraform-api",
          "volume": "cam-terraform-pv,cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-proxy",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-service-composer-api",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-service-composer-ui",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-tenant-api",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "cam-ui-basic",
          "volume": "cam-logs-pv"
        },
        {
          "namespace": "management-infrastructure-management",
          "pod": "postgresql",
          "volume": "miq-pgdb-volume"
        },
        {
          "namespace": "kube-system",
          "pod": "hybridgrc-postgresql-0",
          "volume": "hybridgrc-db-pvc"
        },
        {
          "namespace": "kube-system",
          "pod": "ibm-license-advisor-instance",
          "volume": "db-persistence"
        },
        {
          "namespace": "kube-system",
          "pod": "multicluster-hub-etcd-0",
          "volume": "etcd-data"
        },
        {
          "namespace": "kube-system",
          "pod": "sre-bastion-postgresql-0",
          "volume": "data"
        },
        {
          "namespace": "kube-system",
          "pod": "sre-bastion-teleport-auth",
          "volume": "sre-bastion-teleport-auth-storage"
        },
        {
          "namespace": "kube-system",
          "pod": "sre-inventory-inventory-redisgraph-0",
          "volume": "data"
        },
        {
          "namespace": "management-security-services",
          "pod": "mutation-advisor-minio-0",
          "volume": "datadir"
        },
        {
          "namespace": "management-security-services",
          "pod": "vulnerability-advisor-kafka-0",
          "volume": "datadir"
        },
        {
          "namespace": "management-security-services",
          "pod": "vulnerability-advisor-zookeeper-0",
          "volume": "datadir"
        },
        {
          "namespace": "openldap",
          "pod": "openldap-server",
          "volume": "ldap-storage,sldap-storage"
        },
        {
          "namespace": "management-monitoring",
          "pod": "monitoring-kafka-0",
          "volume": "data"
        },
        {
          "namespace": "management-monitoring",
          "pod": "monitoring-zookeeper-0",
          "volume": "data"
        }
      ]
    }
  resource-label-details.json: |-
    [
      {
        "resourceType": "CustomResourceDefinition",
        "resourceName": "slobundles.declarativemonitoring.management.ibm.com",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": ""
      },
      {
        "resourceType": "CustomResourceDefinition",
        "resourceName": "syntheticbundles.declarativemonitoring.management.ibm.com",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": ""
      },
      {
        "resourceType": "sts",
        "resourceName": "monitoring-cassandra",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "sts",
        "resourceName": "monitoring-couchdb",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "SloBundle",
        "resourceName": "bookinfo-slos",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "bookinfo-project-think"
      },
      {
        "resourceType": "SyntheticBundle",
        "resourceName": "bookinfo-synthetic",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "bookinfo-project-think"
      },
      {
        "resourceType": "pvc",
        "resourceName": "data-monitoring-cassandra-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pvc",
        "resourceName": "data-monitoring-couchdb-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pvc",
        "resourceName": "jobs-monitoring-ibm-cem-datalayer-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pod",
        "resourceName": "monitoring-cassandra-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pod",
        "resourceName": "monitoring-couchdb-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pod",
        "resourceName": "monitoring-ibm-cem-datalayer-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "cm",
        "resourceName": "monitoring-couchdb-configmap",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pvc",
        "resourceName": "postgresql",
        "labels": [
            "imbackup=t"
        ],
        "namespace": "management-infrastructure-management"
      },
      {
        "resourceType": "secret",
        "resourceName": "imconnectionsecret",
        "labels": [
            "imbackup=t"
        ],
        "namespace": "management-infrastructure-management"
      },
      {
        "resourceType": "IMInstall",
        "resourceName": "im-iminstall",
        "labels": [
            "imbackup=t"
        ],
        "namespace": "management-infrastructure-management"
      },
      {
        "resourceType": "pvc",
        "resourceName": "data-monitoring-kafka-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "secret",
        "resourceName": "kafka-client-secret",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "service",
        "resourceName": "monitoring-kafka",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "sts",
        "resourceName": "monitoring-kafka",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pod",
        "resourceName": "monitoring-kafka-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pod",
        "resourceName": "monitoring-zookeeper-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "sts",
        "resourceName": "monitoring-zookeeper",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "pvc",
        "resourceName": "data-monitoring-zookeeper-0",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "cm",
        "resourceName": "monitoring-zookeeper",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      },
      {
        "resourceType": "cm",
        "resourceName": "monitoring-kafka",
        "labels": [
            "appbackup=monitoring"
        ],
        "namespace": "management-monitoring"
      }
    ]
  mongodb-dump.yaml: "apiVersion: batch/v1\nkind: Job\nmetadata:\n  name: icp-mongodb-backup\n  namespace: ibm-common-services\nspec:\n  template:\n    spec:\n      containers:\n      - name: icp-mongodb-backup\n        image: quay.io/opencloudio/ibm-mongodb@sha256:5004b6073efd2df5eae51431e866123d386495aea1b4baa2dcac9fcbaaf7eb83\n        command: [\"bash\", \"-c\", \"cat /cred/mongo-certs/tls.crt /cred/mongo-certs/tls.key > /dump/mongo.pem; cat /cred/cluster-ca/tls.crt /cred/cluster-ca/tls.key > /dump/ca.pem; mongodump --oplog --out /dump --host mongodb:$MONGODB_SERVICE_PORT --username $ADMIN_USER --password $ADMIN_PASSWORD --authenticationDatabase admin --ssl --sslCAFile /dump/ca.pem --sslPEMKeyFile /dump/mongo.pem\"]\n        volumeMounts:\n          - name: mongodump\n            mountPath: \"/dump\"\n          - name: icp-mongodb-client-cert\n            mountPath: \"/cred/mongo-certs\"\n          - name: cluster-ca-cert\n            mountPath: \"/cred/cluster-ca\"\n        env:\n          - name: MONGODB_SERVICE_PORT\n            value: \"27017\"\n          - name: ADMIN_USER\n            valueFrom:\n              secretKeyRef:\n                name: icp-mongodb-admin\n                key: user\n          - name: ADMIN_PASSWORD\n            valueFrom:\n              secretKeyRef:\n                name: icp-mongodb-admin\n                key: password\n      volumes:\n      - name: mongodump\n        persistentVolumeClaim:\n          claimName: my-mongodump\n      - name: icp-mongodb-client-cert\n        secret:\n          defaultMode: 0400\n          secretName: icp-mongodb-client-cert\n      - name: cluster-ca-cert\n        secret:\n          defaultMode: 400\n          secretName: mongodb-root-ca-cert\n      restartPolicy: Never\n---\n  apiVersion: v1\n  kind: PersistentVolumeClaim\n  metadata:\n    namespace: ibm-common-services\n    name: my-mongodump\n  spec:\n    accessModes:\n      - ReadWriteOnce\n    resources:\n      requests:\n        storage: 20Gi\n    storageClassName: {{ .Values.storageClassName }}\n"    
kind: ConfigMap
metadata:
  name: backup-config
  namespace: velero
