akuity / kargo

Application lifecycle orchestration
https://kargo.akuity.io/
Apache License 2.0
1.39k stars 114 forks source link

Pipeline Spec to reduce Stage boilerplate #1568

Open jessesuen opened 4 months ago

jessesuen commented 4 months ago

Proposed Feature

When talking with users who may have many Stages in their pipeline, they complain about a lot of repeated portions of the Stage spec that are duplicated across their Stages. Kargo should provide some convenience to avoid this duplication.

Motivation

Suggested Implementation

There are many ways we could go about this, and I think we will want to experiment with some ideas.

  1. Codegen from a "Pipeline" spec

First thought is to define a Pipeline API spec that generates Stages. This Pipeline would not actually be implemented as a CRD in the cluster, but something that produces the Stage CRDs that would live in the cluster.

  1. Pipeline CRD

Second option is to have a formal Pipeline CRD that is deployed, in lieu of or to complement Stages. This would require an actual controller running to handle the Stage lifecycle.

  1. Template CRD

Another option is to allow Stages to reference something like a "template", in order to reduce the boilerplate. Templates would need to live in the cluster since they are referenceable.

hiddeco commented 4 months ago

This Pipeline would not actually be implemented as a CRD in the cluster, but something that produces the Stage CRDs that would live in the cluster.

While this would probably be the simplest approach, I think this would potentially create new problems. As it would require specific tooling (e.g. kargo) to generate and synchronize your Stages on a cluster, or have them generated before you commit them to a Git repository. This could create new usability issues, either because it's less straight forward to do it in a GitOps manner, or because you have to remember to generate updates to Stages when you make changes to the Pipeline.

krancour commented 4 months ago

@jessesuen isn't this exactly what we intended StageSet for? https://github.com/akuity/kargo/issues/339

Edit: I'd be fine with it if we called it Pipeline instead of StageSet.

jessesuen commented 4 months ago

Yes, https://github.com/akuity/kargo/issues/339 might be the outcome if we chose to go with option 2. However, when filing https://github.com/akuity/kargo/issues/339, one use case was that StageSets could be coupled with other Stages or even other StageSets. And so StageSets were not necessarily the only top-level thing that needed to be defined. If we capture that use case with Pipelines we should merge the concepts.

Option 1 might be a precursor to 2.

krancour commented 4 months ago

btw... I agree with @hiddeco's POV that not doing this as a CRD adds complications.

My preference would be something like this:

one use case was that StageSets could be coupled with other Stages or even other StageSets

imho, that complicates things enormously. Given that most pipelines have multiple production environments on the far right, and some can have multiple entrypoints on the far left, coupling StageSets together wouldn't be especially simple.