Tekton feature flags are how you opt into experimental capabilities before they become generally available.

Let’s see some Tekton feature flags in action. Imagine you have a Pipeline that uses a new feature, say, PipelineTasks which allows you to define tasks directly within a pipeline definition.

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: my-pipeline-with-experimental-feature
spec:
  tasks:
    - name: build-and-push
      pipelineTask:
        apiVersion: tekton.dev/v1beta1
        kind: Task
        spec:
          steps:
            - name: echo
              image: ubuntu
              script: |
                echo "Building and pushing..."

Without the correct feature flag enabled, this Pipeline will likely fail to validate or run, as the Tekton controller won’t recognize pipelineTask.

To enable this alpha feature, you need to configure the Tekton controller. This is typically done by modifying the config-features ConfigMap in the tekton-pipelines-controller namespace.

Here’s how you’d enable the PipelineTasks feature flag:

kubectl patch configmap config-features \
  -n tekton-pipelines-controller \
  --type merge \
  -p '{"data":{"enable-pipelinetasks":"true"}}'

After applying this change, the Tekton controller will start recognizing and processing pipelineTask definitions within your Pipeline resources. The Pipeline above would then be able to execute.

The core problem Tekton feature flags solve is managing the lifecycle of new, potentially unstable features. They allow early adopters to test new functionality, provide feedback, and integrate it into their workflows without impacting users who are not opting into the experimental features. This separation is crucial for maintaining stability in the core product while fostering rapid innovation.

Internally, the Tekton controller has a feature gate mechanism. When the controller starts, it reads the config-features ConfigMap. For each entry in the data section of this ConfigMap (e.g., enable-pipelinetasks), it sets an internal flag. When the controller processes a Pipeline (or Task, TaskRun, PipelineRun, etc.), it checks these internal flags before attempting to interpret or execute any parts of the resource that rely on a specific feature. If a feature flag is not enabled, the controller will typically reject the resource with a validation error or simply ignore the unrecognized fields.

The config-features ConfigMap is the single source of truth for all enabled alpha and beta features. You can list its contents to see what’s currently active:

kubectl get configmap config-features -n tekton-pipelines-controller -o yaml

This will show you a map like:

apiVersion: v1
data:
  enable-pipelinetasks: "true"
  enable-recursive-templates: "false"
  enable-target-pipeline-run: "true"
kind: ConfigMap
metadata:
  creationTimestamp: "2023-10-27T10:00:00Z"
  name: config-features
  namespace: tekton-pipelines-controller
  resourceVersion: "12345"
  uid: abcdef12-3456-7890-abcd-ef1234567890

Here, enable-pipelinetasks is set to "true", meaning the PipelineTasks feature is active. enable-recursive-templates is "false", so any pipelines using recursive template references would not work. enable-target-pipeline-run is "true", allowing you to specify a PipelineRun that a PipelineRun should target.

When you enable a feature flag, you’re not just unlocking a new API field; you’re signaling to the controller that it should now actively validate and process resources according to the newer, experimental logic. This means that if you enable a feature and then use it in your resources, you are agreeing to the terms of using alpha/beta software: it might change, it might have bugs, and it might be removed or altered significantly before reaching general availability. The controller’s internal parsing and execution logic branches based on these flags, ensuring that features not explicitly enabled do not interfere with the stable API surface.

The most surprising thing about Tekton feature flags is that they are often the only mechanism by which certain advanced, foundational capabilities are introduced. Many features that seem core to modern CI/CD, like sophisticated task dependencies or advanced templating, begin life as alpha features controlled by these flags, and their eventual promotion to stable APIs is a gradual process directly managed by the community’s adoption and feedback via these flags.

The next thing you’ll likely encounter is managing the lifecycle of these enabled features as they move from alpha to beta and eventually to stable.

Want structured learning?

Take the full Tekton course →