Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 3. Customizing configurations in the TektonConfig custom resource
In Red Hat OpenShift Pipelines, you can customize the following configurations by using the TektonConfig custom resource (CR):
- Configuring the Red Hat OpenShift Pipelines control plane
- Changing the default service account
- Disabling the service monitor
- Disabling cluster tasks and pipeline templates
- Disabling the integration of Tekton Hub
- Disabling the automatic creation of RBAC resources
- Pruning of task runs and pipeline runs
3.1. Prerequisites Copier lienLien copié sur presse-papiers!
- You have installed the Red Hat OpenShift Pipelines Operator.
3.2. Configuring the Red Hat OpenShift Pipelines control plane Copier lienLien copié sur presse-papiers!
You can customize the OpenShift Pipelines control plane by editing the configuration fields in the TektonConfig custom resource (CR). The Red Hat OpenShift Pipelines Operator automatically adds the configuration fields with their default values so that you can use the OpenShift Pipelines control plane.
Procedure
-
In the Administrator perspective of the web console, navigate to Administration
CustomResourceDefinitions. -
Use the Search by name box to search for the
tektonconfigs.operator.tekton.devcustom resource definition (CRD). Click TektonConfig to see the CRD details page. - Click the Instances tab.
-
Click the config instance to see the
TektonConfigCR details. - Click the YAML tab.
Edit the
TektonConfigYAML file based on your requirements.Example of
TektonConfigCR with default valuesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2.1. Modifiable fields with default values Copier lienLien copié sur presse-papiers!
The following list includes all modifiable fields with their default values in the TektonConfig CR:
running-in-environment-with-injected-sidecars(default:true): Set this field tofalseif pipelines run in a cluster that does not use injected sidecars, such as Istio. Setting it tofalsedecreases the time a pipeline takes for a task run to start.NoteFor clusters that use injected sidecars, setting this field to
falsecan lead to an unexpected behavior.-
await-sidecar-readiness(default:true): Set this field tofalseto stop OpenShift Pipelines from waiting forTaskRunsidecar containers to run before it begins to operate. This allows tasks to be run in environments that do not support thedownwardAPIvolume type. -
default-service-account(default:pipeline): This field contains the default service account name to use for theTaskRunandPipelineRunresources, if none is specified. require-git-ssh-secret-known-hosts(default:false): Setting this field totruerequires that any Git SSH secret must include theknown_hostsfield.- For more information about configuring Git SSH secrets, see Configuring SSH authentication for Git in the Additional resources section.
-
enable-tekton-oci-bundles(default:false): Set this field totrueto enable the use of an experimental alpha feature named Tekton OCI bundle. embedded-status(default:both): This field has three acceptable values:-
full: Enables full embedding ofRunandTaskRunstatuses in thePipelineRunstatus -
minimal: Populates theChildReferencesfield with information, such as name, kind, and API version for each run and task run in the`PipelineRun` status both: Applies both,fullandminimalvaluesNoteThe
embedded-statusfield is deprecated and will be removed in a future release. In addition, the pipeline default embedded status will be changed tominimal.
-
enable-api-fields(default:stable): Setting this field determines which features are enabled. Acceptable value isstable,beta, oralpha.NoteRed Hat OpenShift Pipelines does not support the
alphavalue.-
enable-provenance-in-status(default:false): Set this field totrueto enable populating theprovenancefield inTaskRunandPipelineRunstatuses. Theprovenancefield contains metadata about resources used in the task run and pipeline run, such as the source from where a remote task or pipeline definition was fetched. -
enable-custom-tasks(default:true): Set this field tofalseto disable the use of custom tasks in pipelines. -
disable-creds-init(default:false): Set this field totrueto prevent OpenShift Pipelines from scanning attached service accounts and injecting any credentials into your steps. -
disable-affinity-assistant(default:true): Set this field tofalseto enable affinity assistant for eachTaskRunresource sharing a persistent volume claim workspace.
Metrics options
You can modify the default values of the following metrics fields in the TektonConfig CR:
-
metrics.taskrun.duration-typeandmetrics.pipelinerun.duration-type(default:histogram): Setting these fields determines the duration type for a task or pipeline run. Acceptable value isgaugeorhistogram. -
metrics.taskrun.level(default:task): This field determines the level of the task run metrics. Acceptable value istaskrun,task, ornamespace. -
metrics.pipelinerun.level(default:pipeline): This field determines the level of the pipeline run metrics. Acceptable value ispipelinerun,pipeline, ornamespace.
3.2.2. Optional configuration fields Copier lienLien copié sur presse-papiers!
The following fields do not have a default value, and are considered only if you configure them. By default, the Operator does not add and configure these fields in the TektonConfig custom resource (CR).
-
default-timeout-minutes: This field sets the default timeout for theTaskRunandPipelineRunresources, if none is specified when creating them. If a task run or pipeline run takes more time than the set number of minutes for its execution, then the task run or pipeline run is timed out and cancelled. For example,default-timeout-minutes: 60sets 60 minutes as default. -
default-managed-by-label-value: This field contains the default value given to theapp.kubernetes.io/managed-bylabel that is applied to allTaskRunpods, if none is specified. For example,default-managed-by-label-value: tekton-pipelines. -
default-pod-template: This field sets the defaultTaskRunandPipelineRunpod templates, if none is specified. -
default-cloud-events-sink: This field sets the defaultCloudEventssink that is used for theTaskRunandPipelineRunresources, if none is specified. -
default-task-run-workspace-binding: This field contains the default workspace configuration for the workspaces that aTaskresource declares, but aTaskRunresource does not explicitly declare. -
default-affinity-assistant-pod-template: This field sets the defaultPipelineRunpod template that is used for affinity assistant pods, if none is specified. -
default-max-matrix-combinations-count: This field contains the default maximum number of combinations generated from a matrix, if none is specified.
3.3. Changing the default service account for OpenShift Pipelines Copier lienLien copié sur presse-papiers!
You can change the default service account for OpenShift Pipelines by editing the default-service-account field in the .spec.pipeline and .spec.trigger specifications. The default service account name is pipeline.
Example
3.4. Disabling the service monitor Copier lienLien copié sur presse-papiers!
You can disable the service monitor, which is part of OpenShift Pipelines, to expose the telemetry data. To disable the service monitor, set the enableMetrics parameter to false in the .spec.pipeline specification of the TektonConfig custom resource (CR):
Example
3.5. Disabling cluster tasks and pipeline templates Copier lienLien copié sur presse-papiers!
By default, the TektonAddon custom resource (CR) installs clusterTasks and pipelineTemplates resources along with OpenShift Pipelines on the cluster.
You can disable installation of the clusterTasks and pipelineTemplates resources by setting the parameter value to false in the .spec.addon specification. In addition, you can disable the communityClusterTasks parameter.
Example
3.6. Disabling the integration of Tekton Hub Copier lienLien copié sur presse-papiers!
You can disable the integration of Tekton Hub in the web console Developer perspective by setting the enable-devconsole-integration parameter to false in the TektonConfig custom resource (CR).
Example of disabling Tekton Hub
3.7. Disabling the automatic creation of RBAC resources Copier lienLien copié sur presse-papiers!
The default installation of the Red Hat OpenShift Pipelines Operator creates multiple role-based access control (RBAC) resources for all namespaces in the cluster, except the namespaces matching the ^(openshift|kube)-* regular expression pattern. Among these RBAC resources, the pipelines-scc-rolebinding security context constraint (SCC) role binding resource is a potential security issue, because the associated pipelines-scc SCC has the RunAsAny privilege.
To disable the automatic creation of cluster-wide RBAC resources after the Red Hat OpenShift Pipelines Operator is installed, cluster administrators can set the createRbacResource parameter to false in the cluster-level TektonConfig custom resource (CR).
Example TektonConfig CR
As a cluster administrator or an user with appropriate privileges, when you disable the automatic creation of RBAC resources for all namespaces, the default ClusterTask resource does not work. For the ClusterTask resource to function, you must create the RBAC resources manually for each intended namespace.
3.8. Automatic pruning of task runs and pipeline runs Copier lienLien copié sur presse-papiers!
Stale TaskRun and PipelineRun objects and their executed instances occupy physical resources that can be used for active runs. For optimal utilization of these resources, Red Hat OpenShift Pipelines provides annotations that cluster administrators can use to automatically prune the unused objects and their instances in various namespaces.
Configuring automatic pruning by specifying annotations affects the entire namespace. You cannot selectively auto-prune an individual task run or pipeline run in a namespace.
3.8.1. Annotations for automatically pruning task runs and pipeline runs Copier lienLien copié sur presse-papiers!
To automatically prune task runs and pipeline runs in a namespace, you can set the following annotations in the namespace:
-
operator.tekton.dev/prune.schedule: If the value of this annotation is different from the value specified in theTektonConfigcustom resource definition, a new cron job in that namespace is created. -
operator.tekton.dev/prune.skip: When set totrue, the namespace for which it is configured is not pruned. -
operator.tekton.dev/prune.resources: This annotation accepts a comma-separated list of resources. To prune a single resource such as a pipeline run, set this annotation to"pipelinerun". To prune multiple resources, such as task run and pipeline run, set this annotation to"taskrun, pipelinerun". -
operator.tekton.dev/prune.keep: Use this annotation to retain a resource without pruning. operator.tekton.dev/prune.keep-since: Use this annotation to retain resources based on their age. The value for this annotation must be equal to the age of the resource in minutes. For example, to retain resources which were created not more than five days ago, setkeep-sinceto7200.NoteThe
keepandkeep-sinceannotations are mutually exclusive. For any resource, you must configure only one of them.-
operator.tekton.dev/prune.strategy: Set the value of this annotation to eitherkeeporkeep-since.
For example, consider the following annotations that retain all task runs and pipeline runs created in the last five days, and deletes the older resources:
Example of auto-pruning annotations
...
annotations:
operator.tekton.dev/prune.resources: "taskrun, pipelinerun"
operator.tekton.dev/prune.keep-since: 7200
...
...
annotations:
operator.tekton.dev/prune.resources: "taskrun, pipelinerun"
operator.tekton.dev/prune.keep-since: 7200
...