Architecture Of Konflux

Project Controller

# Overview

The Project Controller is a Kubernetes controller that enables users to manage projects and development streams in Konflux. It provides a templating system for creating multiple similar development streams with consistent resource structures, streamlining the process of setting up complex multi-component applications.

# Description

The Project Controller introduces three main custom resources that work together to provide project and development stream management:

The controller uses Go text/template syntax to enable variable substitution and customization of generated resources.

# Dependencies

The Project Controller depends on:

# Controllers

The Project Controller contains:

# Interface

# Project CR

The Project resource provides metadata and organization for related development streams.

apiVersion: projctl.konflux.dev/v1beta1
kind: Project
metadata:
  name: my-project
spec:
  displayName: "My Cool Project"
  description: |
    Description of my project that can span multiple lines.

# ProjectDevelopmentStreamTemplate CR

The ProjectDevelopmentStreamTemplate defines reusable resource templates with variable substitution.

apiVersion: projctl.konflux.dev/v1beta1
kind: ProjectDevelopmentStreamTemplate
metadata:
  name: my-project-template
spec:
  project: my-project
  variables:
  - name: version
    description: A version number for a new development stream
  - name: versionName
    description: A K8s-compliant name for the version
    defaultValue: "{{hyphenize .version}}"

  resources:
  - apiVersion: appstudio.redhat.com/v1alpha1
    kind: Application
    metadata:
      name: "cool-app-{{.versionName}}"
    spec:
      displayName: "Cool App {{.version}}"

  - apiVersion: appstudio.redhat.com/v1alpha1
    kind: Component
    metadata:
      name: "cool-comp1-{{.versionName}}"
    spec:
      application: "cool-app-{{.versionName}}"
      componentName: "cool-comp1-{{.versionName}}"
      source:
        git:
          context: "."
          dockerfileUrl: "Dockerfile"
          revision: "{{.version}}"
          uri: git@github.com:example/comp1.git

# ProjectDevelopmentStream CR

The ProjectDevelopmentStream instantiates templates with specific variable values.

apiVersion: projctl.konflux.dev/v1beta1
kind: ProjectDevelopmentStream
metadata:
  name: my-project-1-0-0
spec:
  project: my-project
  template:
    name: my-project-template
    values:
    - name: version
      value: "1.0.0"

# Supported Resource Types

The Project Controller supports templating for the following Konflux resource types:

# Template Features

# Variable System

# Custom Template Functions

# Resource Management

# Workflow

  1. A Project resource is created to define the project scope
  2. A ProjectDevelopmentStreamTemplate is created with resource definitions and variables
  3. One or more ProjectDevelopmentStream resources are created referencing the template
  4. The controller processes each development stream:
    • Resolves template variables using provided values or defaults
    • Generates Konflux resources using the template
    • Creates resources with proper ownership relationships
    • Sets up cross-references between generated resources

# Known Limitations

# Integration with Konflux

The Project Controller integrates with Konflux by:

The service operates as an add-on, providing project management capabilities that complement the core Konflux development workflow.