Repositories

StorageRepository

A StorageRepository API resource is used to represent how K10 backup data is stored at a particular location (represented by a Profile<api_profile>). K10 will distribute backup data generated by a Policy<api_policy> run into one or more repositories, based on data type and deduplication domain.

The API gives the user an insight into the status of these repositories, and provides a means of performing maintenance and management actions on them.

List StorageRepositories Example

The following example illustrates listing all StorageRepositories created by a policy backing up two applications, each with PVCs.

# list storage repositories
$ kubectl get storagerepositories.repositories.kio.kasten.io --namespace kasten-io
NAME                                     LOCATIONTYPE
kopia-volumedata-repository-zcfk68hdht   ObjectStore
kopia-volumedata-repository-hkpjmr2w6d   ObjectStore
kopia-metadata-repository-2bgqbcf724     ObjectStore

Get StorageRepositories Details Example

In addition to getting a StorageRepository, you can also query the details associated with the restore point. You would use the details sub-resource for that purpose.

# get the details for storagerepository 'kopia-metadata-repository-2bgqbcf724' in the 'kasten-io' namespace.
# yq only used for readability
$ kubectl get --raw /apis/repositories.kio.kasten.io/v1alpha1/namespaces/kasten-io/storagerepositories/kopia-metadata-repository-2bgqbcf724/details | yq -y .status.details
kopiaMeta:
  ...

Modify StorageRepository Background Maintenance Behavior

K10 will periodically run maintenance on the StorageRepositories it creates. Among other tasks, the maintenance process tidies up unused data, detects inconsistent states, and measures the overall storage usage over time. This behavior can be disabled on a per-repository basis by modifying the spec.disableMaintenance field. Additionally, the background operations performed on the repository will, by default, have a 10-hour timeout. The timeout can be customized as needed by setting the spec.backgroundProcessTimeout field.

# disable maintenance for storagerepository
# 'kopia-metadata-repository-2bgqbcf724' in the 'kasten-io' namespace.
$ kubectl patch storagerepository kopia-metadata-repository-2bgqbcf724 -n kasten-io \
 --type merge \
 --patch $'spec:\n  disableMaintenance: true'

# set the timeout for any background processes working on storagerepository
# 'kopia-metadata-repository-2bgqbcf724' in the 'kasten-io' namespace.
$ kubectl patch storagerepository kopia-metadata-repository-2bgqbcf724 -n kasten-io \
 --type merge \
 --patch $'spec:\n  backgroundProcessTimeout: 1h'

# restore the 10h default timeout for background processes working on storagerepository
# 'kopia-metadata-repository-2bgqbcf724' in the 'kasten-io' namespace.
$ kubectl patch storagerepository kopia-metadata-repository-2bgqbcf724 -n kasten-io \
 --type merge \
 --patch $'spec:\n  backgroundProcessTimeout: null'

Delete StorageRepository Example

StorageRepository API resources can be deleted. Functionally this only serves to clean up the API representation; no backup data will be deleted, and K10 still tracks the associated repository data internally. After deletion, if the repository is used again (e.g. by creating a new backup), the StorageRepository API representation will be recreated.

# delete storage repository 'kopia-metadata-repository-cq6qrfd4vm' in namespace 'kasten-io'
$ kubectl delete storagerepository kopia-metadata-repository-cq6qrfd4vm --namespace kasten-io
storagerepository.repositories.kio.kasten.io "kopia-metadata-repository-cq6qrfd4vm" deleted

StorageRepository API Type

The following is a complete specification of the StorageRepository resource.

# Standard Kubernetes API Version declaration. Required.
apiVersion: repositories.kio.kasten.io/v1alpha1
# Standard Kubernetes Kind declaration. Required.
kind: StorageRepository
# Standard Kubernetes metadata. Required.
metadata:
  # Name of the StorageRepository. Required.
  name: kopia-metadata-repository-2bgqbcf724
  # Namespace of the StorageRepository. Required.
  namespace: kasten-io
# Spec of the StorageRepository.
spec:
  # Disable background maintenance for this repository.
  disableMaintenance: false
  # Timeout (duration) for background tasks involving this repository.
  # If set to null, default value of 10h is used.
  backgroundProcessTimeout: 10h
# Status of the StorageRepository.
status:
  # Content type of the data stored in this repository.
  contentType: metadata
  # Backend type of this repository.
  backendType: kopia
  # Details
  details:
    nextProcessTime:
    modifiedTime:
    kopiaMeta:
      formatVersion: 2
      repoStatus:
        completedTime:
        # Capacity and available may not apply when repository is in cloud object store.
        capacity:
        available:
        hash:
        encryption:
        splitter:
        formatVersion:
        indexFormat:
      maintenanceInfo:
        completedTime:
        quick:
          enabled: true
          interval: 4h
        full:
          enabled: true
          interval: 24h
        nextFullMaintenanceTime:
        nextQuickMaintenanceTime:
        runs:
        - start:
          end:
          success: true
          error: null
      maintenanceRun:
        runsTotal: 100
        deletedUnrefBlobsTotal: 100
        cleanedLogsTotal: 100
        recentResults:
        - completedTime:
          scheduledTime:
          stats:
            unusedContents: 0
            unusedContentsRecent: 0
            inUseContents: 0
            inUseSysContents: 0
            deletedUnrefBlobs: 0
            keptLogs: 0
            cleanedLogs: 0
      storageUsage:
        blobStats:
          completedTime:
          sizeStat:
            count: 100
            sizeB: 65536
        snapshotStats:
          completedTime:
          sizeStat:
            count: 100
            sizeB: 65536
  # Location specifying where the data associated with this repository
  # can be found. This will match the format of the location spec
  # in a policy.
  location:
  # If this repository was used only to import restore points, it is marked as read-only.
  readOnly: false
  # The name of the application associated with the data in this repository.j
  appName: kasten-io
  # Process results of recent background tasks run against this storage repository.
  processResults:
    # Total number of times this storage repository was processed for any background task.
    processCount: 0
    # The result of the last 10 background processing runs scheduled for this storage repository.
    recentResults:
    - start:
      end:
      # The name of the procedure that was performed.
      procedure: maintenanceRun
      succeeded: true
      error: null
      commandResults:
      # Description of an individual command that was executed against the repository.
      - desc: MaintenanceRun
        startTime:
        endTime:
        error: null
        succeeded: true