3.14. Setting additional options for webhooks


Optionally, you can set the failurePolicy, timeoutSeconds, or sideEffects options for the webhooks created by several controllers in OpenShift Pipelines. For more information about these options, see the Kubernetes documentation.

Prerequisites

  • You installed the oc command-line utility.
  • You are logged into your OpenShift Container Platform cluster with administrator rights for the namespace in which OpenShift Pipelines is installed, typically the openshift-pipelines namespace.

Procedure

  1. View the list of webhooks that the OpenShift Pipelines controllers created. There are two types of webhooks: mutating webhooks and validating webhooks.

    1. To view the list of mutating webhooks, enter the following command:

      $ oc get MutatingWebhookConfiguration

      Example output

      NAME                             WEBHOOKS   AGE
      annotation.operator.tekton.dev   1          4m20s
      proxy.operator.tekton.dev        1          4m20s
      webhook.operator.tekton.dev      1          4m22s
      webhook.pipeline.tekton.dev      1          4m20s
      webhook.triggers.tekton.dev      1          3m50s

    2. To view the list of validating webhooks, enter the following command:

      $ oc get ValidatingWebhookConfiguration

      Example output

      NAME                                                 WEBHOOKS   AGE
      config.webhook.operator.tekton.dev                   1          4m24s
      config.webhook.pipeline.tekton.dev                   1          4m22s
      config.webhook.triggers.tekton.dev                   1          3m52s
      namespace.operator.tekton.dev                        1          4m22s
      validation.pipelinesascode.tekton.dev                1          2m49s
      validation.webhook.operator.tekton.dev               1          4m24s
      validation.webhook.pipeline.tekton.dev               1          4m22s
      validation.webhook.triggers.tekton.dev               1          3m52s

  2. In the TektonConfig custom resource (CR), add configuration for mutating and validating webhooks under the section for each of the controllers as necessary, as shown in the following examples. Use the validation.webhook.pipeline.tekton.dev spec for the validating webhooks and the webhook.pipeline.tekton.dev spec for the mutating webhooks.

    重要
    • You cannot set configuration for operator webhooks.
    • All settings are optional. For example, you can set the timeoutSeconds parameter and omit the failurePolicy and sideEffects parameters.

    Example settings for the Pipelines controller

    apiVersion: operator.tekton.dev/v1
    kind: TektonConfig
    metadata:
      name: config
    spec:
      pipeline:
        options:
          webhookConfigurationOptions:
            validation.webhook.pipeline.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None
            webhook.pipeline.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None

    Example settings for the Triggers controller

    apiVersion: operator.tekton.dev/v1
    kind: TektonConfig
    metadata:
      name: config
    spec:
      triggers:
        options:
          webhookConfigurationOptions:
            validation.webhook.triggers.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None
            webhook.triggers.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None

    Example settings for the Pipelines as Code controller

    apiVersion: operator.tekton.dev/v1
    kind: TektonConfig
    metadata:
      name: config
    spec:
      pipelinesAsCode:
        options:
          webhookConfigurationOptions:
            validation.pipelinesascode.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None
            pipelines.triggers.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None

    Example settings for the Tekton Hub controller

    apiVersion: operator.tekton.dev/v1
    kind: TektonConfig
    metadata:
      name: config
    spec:
      hub:
        options:
          webhookConfigurationOptions:
            validation.webhook.hub.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None
            webhook.hub.tekton.dev:
              failurePolicy: Fail
              timeoutSeconds: 20
              sideEffects: None

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部