Skip to content

feat: Konflux configuration as code #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

osmman
Copy link
Contributor

@osmman osmman commented May 28, 2025

Summary by Sourcery

Migrate Konflux configuration to code-first approach using Kustomize and projctl CRDs, centralizing release plan overlays and defining project streams and templates for ansible, fbc, and operator.

New Features:

  • Provide ProjectDevelopmentStream and ProjectDevelopmentStreamTemplate CRDs for ansible, fbc, and operator projects.
  • Introduce versioned stream overlays (main, v1-0, v1-1, v1-2) with kustomize patches for branch, version, and nameSuffix.
  • Add Kustomize base configurations for releasePlans with updated relative paths to centralize overlays.
  • Define project CRDs (Project, Application, Component) and stream manifests to generate configs across multiple OCP versions.
  • Include integration test and enterprise-contract pipeline patches for each project template.

Documentation:

  • Add README with instructions for previewing and applying Kustomize overlays.

Copy link

sourcery-ai bot commented May 28, 2025

Reviewer's Guide

Reorganize Kustomize overlays under a unified base directory, introduce declarative ProjectDevelopmentStream and template CRDs, and add versioned stream and project templates with overlay patches to consolidate Konflux configuration as code.

Class Diagram: New Konflux Custom Resource Definitions (CRDs)

classDiagram
    Project "1" -- "N" ProjectDevelopmentStream : Manages
    Project "1" -- "N" ProjectDevelopmentStreamTemplate : Manages

    ProjectDevelopmentStream "1" ..> "1" ProjectDevelopmentStreamTemplate : Uses
    ProjectDevelopmentStream : +String metadata_name
    ProjectDevelopmentStream : +String spec_project
    ProjectDevelopmentStream : +TemplateReference spec_template
    class TemplateReference{
      +String name
      +Value[] values
    }
    ProjectDevelopmentStream *-- TemplateReference
    class Value{
        +String name
        +String value
    }
    TemplateReference *-- "N" Value

    ProjectDevelopmentStreamTemplate : +String metadata_name
    ProjectDevelopmentStreamTemplate : +String spec_project
    ProjectDevelopmentStreamTemplate : +Variable[] spec_variables
    ProjectDevelopmentStreamTemplate : +Object[] spec_resources
    ProjectDevelopmentStreamTemplate *-- "N" Variable
    ProjectDevelopmentStreamTemplate o-- "N" K8sResource : Defines (via spec_resources)

    Project : +String metadata_name
    Project : +String spec_displayName
    Project : +String spec_description

    class Variable{
      +String name
      +String description
      +String defaultValue
    }

    K8sResource <|-- Application
    K8sResource <|-- Component
    K8sResource <|-- IntegrationTestScenario

    Application : +String metadata_name
    Application : +String spec_displayName
    Application "1" o-- "N" Component : Has
    Application "1" o-- "N" IntegrationTestScenario : Tested by

    Component : +String metadata_name
    Component : +String spec_application
    Component : +String spec_componentName
    Component : +GitSource spec_source_git
    class GitSource{
        +String context
        +String dockerfileUrl
        +String revision
        +String url
    }
    Component *-- GitSource

    IntegrationTestScenario : +String metadata_name
    IntegrationTestScenario : +String spec_application
    IntegrationTestScenario : +ResolverRef spec_resolverRef
    IntegrationTestScenario : +Param[] spec_params
    class Param{
        +String name
        +String value
    }
    IntegrationTestScenario *-- "N" Param
    class ResolverRef{
        +String resolver
        +String resourceKind
        +Param[] params
    }
    IntegrationTestScenario *-- ResolverRef
    ResolverRef *-- "N" Param
Loading

File-Level Changes

Change Details Files
Refactor resource references in existing releasePlan overlays
  • Updated relative paths from nested ‘../../../’ to centralized ‘../../base’
  • Preserved nameSuffix settings across overlays
konflux-configs/releasePlans/promoteToCandidateRPs/components/overlays/**/kustomization.yaml
konflux-configs/releasePlans/promoteToCandidateRPs/fbc*/overlays/**/kustomization.yaml
konflux-configs/releasePlans/promoteToCandidateRPs/operator/overlays/**/kustomization.yaml
Add base stream definitions and overlays
  • Introduced ProjectDevelopmentStream CRs for ansible, fbc, operator with version and branch values
  • Created overlays for main, v1-0, v1-1, v1-2 including patch files and fbc-patch.yaml
konflux-configs/base/stream/base/**/stream.yaml
konflux-configs/base/stream/overlay/**/kustomization.yaml
konflux-configs/base/stream/overlay/**/patch.yaml
Introduce base project templates and overlay patches
  • Defined Project and ProjectDevelopmentStreamTemplate for ansible, fbc, operator
  • Added overlay patches for e2e, enterprise-contract, component, collection, manager, bundle pipelines
konflux-configs/base/project/ansible/**
konflux-configs/base/project/fbc/**
konflux-configs/base/project/operator/**
Add aggregation kustomizations and service account setup
  • Created kustomization.yaml to aggregate serviceAccounts and releasePlans
  • Added top-level project and application kustomizations to reference all overlays
konflux-configs/base/serviceAccounts/kustomization.yaml
konflux-configs/base/releasePlans/kustomization.yaml
konflux-configs/base/project/kustomization.yaml
konflux-configs/base/application/kustomization.yaml
Add README and production overlay
  • Drafted README.md with preview and apply instructions
  • Introduced overlay/prod kustomization.yaml for live cluster deployment
konflux-configs/README.md
konflux-configs/overlay/prod/kustomization.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant