Architecture Of Konflux

Konflux

# Overview

Konflux is a platform for building integrated software that streamlines, consolidates, and secures the development lifecycle.

# Goals

# Architecture Goals

# Architecture Constraints

:bulb: Adding new functionality usually looks like either adding a new controller or adding a new tekton task.

# Application Context

graph TD
    subgraph tenant[Tenant Namespace]
        App[Application] --> Comp["Component(s)"]
        App --> ITS["IntegrationTestScenario(s)"]
        App --> RP["ReleasePlan(s)"]

        Comp -- defines --> BPR["Build PipelineRun(s)"]
        BPR -- produces --> Snap["Snapshot"]
        ITS -- defines --> TPR["Test PipelineRun(s)"]
        Snap -- triggers --> TPR
        TPR -- triggers --> Release["Release(s)"]
        RP -- defines release for --> Release

        Release -- initiates --> PR["Release PipelineRun(s) (Tenant)"]
    end

    subgraph managed[Managed Namespace]
        RPA["ReleasePlanAdmission(s)"]
        ECP["EnterpriseContractPolicy(s)"]

        RP -- matched to --> RPA
        RPA -- parameterizes --> PRM
        Release -- initiates --> PRM["Release PipelineRun(s) (Managed)"]
        PRM -- enforces policy via --> ECP
    end

    style App fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000
    style Comp fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000
    style Snap fill:#f3e5f5,stroke:#4a148c,stroke-width:2px,color:#000000
    style ITS fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000
    style RP fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000
    style Release fill:#f3e5f5,stroke:#4a148c,stroke-width:2px,color:#000000
    style PR fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000
    style PRM fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000
    style BPR fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000
    style TPR fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000
    style RPA fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000
    style ECP fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000

    classDef controlPlane fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#000000;
    class App,Comp,ITS,RP,RPA,ECP controlPlane;

    classDef dataPlane fill:#f3e5f5,stroke:#4a148c,stroke-width:2px,color:#000000;
    class Snap,Release dataPlane;

    classDef tekton fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000;
    class PR,PRM,BPR,TPR tekton;

    click App "Application API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/application-api/#k8s-api-github-com-konflux-ci-application-api-api-v1alpha1-application"
    click Comp "Component API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/application-api/#k8s-api-github-com-konflux-ci-application-api-api-v1alpha1-component"
    click Snap "Snapshot API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/application-api/#k8s-api-github-com-konflux-ci-application-api-api-v1alpha1-snapshot"
    click ITS "IntegrationTestScenario API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/integration-service/#k8s-api-github-com-konflux-ci-integration-service-api-v1alpha1-integrationtestscenario"
    click Release "Release API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/release-service/#k8s-api-github-com-konflux-ci-release-service-api-v1alpha1-release"
    click RP "ReleasePlan API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/release-service/#k8s-api-github-com-konflux-ci-release-service-api-v1alpha1-releaseplan"
    click RPA "ReleasePlanAdmission API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/release-service/#k8s-api-github-com-konflux-ci-release-service-api-v1alpha1-releaseplanadmission"

The system’s API resources can be categorized in two primary ways: as either control-plane or data-plane resources and as either tenant resources or managed resources.

Regarding control-plane and data-plane:

Regarding tenant resources and managed resources.

# Service (Component) Context

graph TD
    subgraph aws[AWS]
        PG[Postgres Database]
    end

    subgraph registry[OCI Registry]
        OCI[Container Images & Attestations]
    end

    subgraph scm[SCM System]
        SCM[Git Repositories]
    end

    subgraph Konflux Services
        HAS[Hybrid Application Service]
        BS[Build Service]
        IS[Integration Service]
        RS[Release Service]
        subgraph PS[Pipeline Service]
            TP[Tekton Pipelines]
            PAC["Pipelines as Code (PaC)"]
            TC[Tekton Chains]
            TR[Tekton Results]
        end
    end

    subgraph kubeapi[Kubernetes API Server]
        App[Application]
        Comp[Component]
        Snap[Snapshot]
        ITS[IntegrationTestScenario]
        RPA[ReleasePlanAdmission]
        RP[ReleasePlan]
        Release[Release]
        PR[PipelineRun]
    end

    HAS -- Manages --> App
    HAS -- Manages --> Comp
    BS -.-> Comp
    BS -.-> PR
    IS -.-> App
    IS -- Manages --> ITS
    IS -- Manages --> Snap
    IS -.-> PR
    RS -.-> PR
    RS -- Manages --> RPA
    RS -- Manages --> RP
    RS -- Manages --> Release
    TP -- Provides --> PR
    SCM -- Sends Webhooks --> PAC
    TC -- Signs & Attests --> OCI
    TC -- Watches --> TP
    TR -- Stores Results --> PG
    TR -- Watches --> TP

    style HAS fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style BS fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style IS fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style RS fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style PS fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style TP fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style PAC fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style TC fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style TR fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style EC fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000;
    style kubeapi fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px,color:#000000;
    style App fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style Comp fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style Snap fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style ITS fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style RPA fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style RP fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style Release fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style PR fill:#ffffff,stroke:#1565c0,stroke-width:3px,color:#000000;
    style PG fill:#e8f5e8,stroke:#2e7d32,stroke-width:1px,color:#000000;
    style OCI fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000;
    style SCM fill:#f5f5f5,stroke:#424242,stroke-width:1px,color:#000000;

    click HAS "Hybrid Application Service" "https://github.com/redhat-appstudio/application-service"
    click BS "Build Service" "https://github.com/redhat-appstudio/core/build-service.md"
    click IS "Integration Service" "https://github.com/redhat-appstudio/core/integration-service.md"
    click RS "Release Service" "https://github.com/redhat-appstudio/core/release-service.md"
    click PS "Pipeline Service" "https://github.com/redhat-appstudio/core/pipeline-service.md"
    click KubeAPI "Kubernetes API Server (Controllers)" "https://kubernetes.io/docs/concepts/architecture/controller/"

    click App "Application API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/application-api/#k8s-api-github-com-konflux-ci-application-api-api-v1alpha1-application"
    click Comp "Component API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/application-api/#k8s-api-github-com-konflux-ci-application-api-api-v1alpha1-component"
    click Snap "Snapshot API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/application-api/#k8s-api-github-com-konflux-ci-application-api-api-v1alpha1-snapshot"
    click ITS "IntegrationTestScenario API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/integration-service/#k8s-api-github-com-konflux-ci-integration-service-api-v1alpha1-integrationtestscenario"
    click Release "Release API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/release-service/#k8s-api-github-com-konflux-ci-release-service-api-v1alpha1-release"
    click RP "ReleasePlan API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/release-service/#k8s-api-github-com-konflux-ci-release-service-api-v1alpha1-releaseplan"
    click RPA "ReleasePlanAdmission API Reference" "https://konflux-ci.dev/docs/reference/kube-apis/release-service/#k8s-api-github-com-konflux-ci-release-service-api-v1alpha1-releaseplanadmission"

Each service that makes up Konflux is further explained in its own document.

# Konflux Core Services

These services make up the core of Konflux and are all required for a working system.

# Konflux Add-Ons

The konflux add-ons are optional services that, when installed, provide some additional capability.

# Data Flow

graph LR
    subgraph tn[Tenant Namespace]
        direction TB
        bpr["Build PipelineRun"]
        r["Release"]
    end

    subgraph mn[Managed Namespace]
        direction TB
        rpr["Release PipelineRun"]
        ir["InternalRequest"]
        ecp["EnterpriseContractPolicy"]
    end

    subgraph int_net[Internal Network]
        ins[Internal Network Services]
    end

    subgraph ext[External Network]
        git[Git Repository]
        upstream_repos["Upstream Repositories"]
        clouds[Public Clouds]
        coverity[Coverity License Server]
        snyk[Snyk]
        quay[Quay.io]
        jira[Jira]
        vms[Vulnerability Management System]
        awskms[AWS KMS]
        prod_repos["Production Repositories"]
        trustify[Trustify]
        pyxis[Pyxis]
        advisory_feed[Advisory Feed]
    end

    bpr -- "(1) Fetch source" --> git
    bpr -- "(2) Prefetch dependencies" --> upstream_repos
    bpr -- "(3) Provision VMs" --> clouds
    bpr -- "(4) Push image" --> quay
    bpr -- "(5) Check license" --> coverity
    bpr -- "(6) Request SAST scan" --> snyk
    r -- "(7) Initiates" --> rpr
    rpr -- "(8) Pull content from Quay" --> quay
    rpr -- "(9) Conforma check" --> ecp
    rpr -- "(10) Check CVEs" --> vms
    rpr -- "(11) Push content" --> prod_repos
    rpr -- "(12) Update" --> jira
    rpr -- "(13) Sign with cosign" --> awskms
    rpr -- "creates" --> ir
    ir -- "(14) Triggers action" --> ins
    rpr -- "(15) Push SBOM" --> trustify
    rpr -- "(16) Populate metadata" --> pyxis
    rpr -- "(17) Populate advisory feed" --> advisory_feed

When a commit lands on a tracked branch in a user’s git repository, a series of network requests are made to external services. The following diagram illustrates the sequence of these requests.

  1. The build pipeline in the tenant namespace fetches source code from a Git Repository.
  2. The build pipeline prefetches dependencies from Upstream Repositories like pypi, rubygems, and npmjs.org.
  3. If multi-platform builds are configured, the build pipeline may make requests to Public Clouds (like AWS or IBM Cloud) to provision virtual machines.
  4. The build pipeline pushes the built container image and its associated artifacts (like SBOMs) to Quay.io or another OCI registry.
  5. The build pipeline may check with a Coverity License Server to validate dependencies.
  6. The build pipeline requests a SAST scan from Snyk.
  7. A Release resource in the tenant namespace initiates a Release PipelineRun in the managed namespace.
  8. The release pipeline pulls the content, attestations, and SBOMs from Quay.io.
  9. A conforma check compares the attestations against an EnterpriseContractPolicy.
  10. The release pipeline checks the CVE status in a Vulnerability Management System.
  11. The release pipeline pushes content to Production Repositories.
  12. The release pipeline in the managed namespace may update a Jira ticket to reflect the status of the release.
  13. The release pipeline makes a request to AWS KMS to sign the release with cosign.
  14. The release pipeline in the managed namespace may create an InternalRequest which is observed by a controller that interacts with other Internal Network Services (like a signing server, message bus, or other internal systems) to complete the release process.
  15. The release pipeline pushes the SBOM to Trustify for vulnerability management.
  16. The release pipeline populates metadata in Pyxis.
  17. The release pipeline populates the Advisory Feed.