Architecture Of Konflux

56. Revised Component Model

# Status

Implementable

# References

# Context

The existing application and component model in Konflux presents several limitations that hinder our ability to scale and support flexible workflows. Specifically, the current model requires a new component to be registered for each use case, even when the same underlying code is being used in multiple release scenarios. This creates unnecessary overhead and complexity, while also limiting the reusability of our components.

Furthermore, ownership of the current APIs is unclear. They were originally owned by HAS (which is now deprecated) and exhibit excessive coupling across multiple services.

# Decision

We have decided to adopt a revised component model that replaces the concept of an “application” with a “component group.” The key elements of this new model are:

The implementation will be phased, starting with the core build team and gradually migrating services and users over time, with the final goal of decommissioning the old model once the migration is complete.

# Example of new Component CR spec

apiVersion: appstudio.redhat.com/v1alpha1
kind: Component
metadata:
  name: example
  namespace: example

spec:
  actions:
    trigger-push-build: Test
    trigger-push-builds:
      - Test
      - Different pipeline

    create-pipeline-configuration-pr:
      all-versions: true
      version: some-verision
      versions:
        - version-name1
        - version-name2

  skip-offboarding-pr: true

  containerImage: quay.io/org/tenant/component

  default-build-pipeline:
    pull-and-push:
      pipelinespec-from-bundle:
        name: docker-build-oci-ta
        bundle: latest

      pipelineref-by-name: custom-pipeline

      pipelineref-by-git-resolver:
        url: https://github.com/custom-pipelines/pipelines.git
        revision: main
        pathInRepo: pipeline/push.yaml

    push:
      pipelinespec-from-bundle:
        name: docker-build-oci-ta
        bundle: latest
      pipelineref-by-name: custom-pipeline
      pipelineref-by-git-resolver:
        url: https://github.com/custom-pipelines/pipelines.git
        revision: main
        pathInRepo: pipeline/push.yaml

    pull:
      pipelinespec-from-bundle:
        name: docker-build-oci-ta
        bundle: latest
      pipelineref-by-name: custom-pipeline
      pipelineref-by-git-resolver:
        url: https://github.com/custom-pipelines/pipelines.git
        revision: main
        pathInRepo: pipeline/pull.yaml

  source:
    url: https://github.com/user/repo

    dockerfileUri: Dockerfile

    versions:
      - name: Version 1.0
        revision: ver-1.0

      - name: Test
        revision: test
        context: ./test
        dockerfileUri: test.Dockerfile
        skip-builds: true

      - name: Different pipeline
        revision: different_branch
        build-pipeline:
          pull-and-push:
            pipelinespec-from-bundle:
              name: pipeline_name_in_bundle_image
              bundle: specific_bundle_image

status:
  message: Spec.ContainerImage is not set / GitHub App is not installed
  pac-repository: repository-cr-name
  containerImage: quay.io/org/tenant/component

  versions:
    - name: Version 1.0
      onboarding-status: succeeded
      configuration-merge-url: https://github.com/user/repo/pull/1
      onboarding-time: 29 May 2024 15:11:16 UTC
      revision: ver-1.0
      skip-builds: false

    - name: Test
      onboarding-status: succeeded
      configuration-merge-url: https://github.com/user/repo/pull/1
      onboarding-time: 29 May 2024 15:11:16 UTC
      revision: test
      skip-builds: true

    - name: Different pipeline
      onboarding-status: failed
      revision: different_branch
      message: pipeline for Different pipeline branch doesn't exist
      skip-builds: false

# Component CR Spec Field Reference

# Consequences

# Roadmap

The following is an ordered roadmap of activities to move that forwards.