Architecture Of Konflux

KubeArchive

# Overview

KubeArchive is a tool that archives Kubernetes resources outside of the cluster and is able to delete these resources from the cluster. And it exposes a REST API protected by the Kubernetes RBAC (it uses SubjectAccessReview and TokenReview to delegate auth).

KubeArchive is essential for operating Konflux at scale. Without it, completed Snapshots, Releases other resources accumulate in Etcd, impacting cluster performance. See ADR 65 for the decision to adopt KubeArchive.

# Architecture

KubeArchive consists of four components:

# Configuration

KubeArchive is configured through two custom resources:

# KubeArchiveConfig

Defines archival and deletion rules for resources within a single namespace. Just one KubeArchiveConfig named kubearchive is allowed per namespace. See an example of KubeArchiveConfig below:

apiVersion: kubearchive.org/v1
kind: KubeArchiveConfig
metadata:
  name: kubearchive
  namespace: <tenant-ns>
spec:
  resources:
    - selector:
        apiVersion: tekton.dev/v1
        kind: PipelineRun
      archiveWhen: "has(status.completionTime)"
      deleteWhen: "timestamp(status.completionTime) < now() - duration('72h')"
    - selector:
        apiVersion: appstudio.redhat.com/v1alpha1
        kind: Snapshot
      archiveWhen: "true"
      keepLastWhen:
        - name: daily-backups
          when: "metadata.name.startsWith('daily-backup-')"
          count: 7

# ClusterKubeArchiveConfig (cluster-scoped)

Follows a very similar syntax like the KubeArchiveConfig custom resource but applies to all the namespaces that contain KubeArchiveConfig.

# Rule Types

All rules use CEL (Common Expression Language) expressions:

# Dependencies

KubeArchive depends on:

# Repositories