triggers

by eddycharly

Helm chartv0.4.0App 0.4.0

This chart bootstraps installation of [tekton triggers](https://github.com/tektoncd/triggers).

About this chart

Tekton Triggers Helm Chart

Triggers is a Kubernetes Custom Resource Defintion (CRD) controller that allows you to extract information from events payloads (a "trigger") to create Kubernetes resources.

Requirements

  • Helm v2 or v3
  • Kubernetes >= 1.15 (it's driven by the version of Tekton Pipelines installed)
  • Depending on the configuration you will need admin access to be able to install the CRDs
  • Tekton Pipelines deployed in the target cluster (see Tekton Pipelines Helm Chart)

Description

This chart deploys the Tekton Triggers controller and the associated webhook. It should run on k8s as well as OpenShift.

It includes various options to expose metrics and/or profiling endpoints, create rbac resources, run in high availabilty mode, control pods placement and resources, etc...

All options are documented in the Chart Values section.

Various configuration examples are document in the Try it out section.

An additional guide is available in the Production grade configuration section to help deploying Tekton Triggers in a highlly available and secure mode.

Installing

  • Add the Tekton helm charts repo
helm repo add eddycharly https://eddycharly.github.io/tekton-helm
  • Install (or upgrade)
# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers
  • Install (or upgrade) without CRDs (assuming CRDs have already been deployed by an admin)
# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --no-crd-hook
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --skip-crds
  • Install (or upgrade) without creating RBAC resources (assuming RBAC resources have been created by an admin)
# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --set rbac.create=false --set rbac.serviceAccountName=svcAccountName
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --set rbac.create=false --set rbac.serviceAccountName=svcAccountName

Look below for the list of all available options and their corresponding description.

Uninstalling

To uninstall the chart, simply delete the release.

# This will uninstall Tekton Triggers in the tekton namespace (assuming a my-triggers release name)

# Helm v2
helm delete --purge my-triggers
# Helm v3
helm uninstall my-triggers --namespace tekton

Version

Current chart version is 0.4.0

Chart Values

KeyTypeDescriptionDefault
config.loggingobjectConfiguration for logging (see https://github.com/tektoncd/pipeline/blob/master/docs/install.md)See values.yaml
config.observabilityobjectConfiguration for observability (see https://github.com/tektoncd/pipeline/blob/master/docs/install.md)See values.yaml
controller.affinityobjectController affinity rules{}
controller.annotationsobjectController pod annotationsSee values.yaml
controller.argslistController argumentsSee values.yaml
controller.image.pullPolicystringController docker image pull policy"IfNotPresent"
controller.image.repositorystringController docker image repository"gcr.io/tekton-releases/github.com/tektoncd/triggers/cmd/controller"
controller.image.tagstringController docker image tag"v0.4.0"
controller.metrics.enabledboolEnable controller metrics servicetrue
controller.metrics.portintController metrics service port9090
controller.metrics.portNamestring"metrics"
controller.nodeSelectorobjectController node selector{}
controller.resourcesobjectController resource limits and requests{}
controller.securityContextobjectController pods security context{}
controller.service.annotationsobjectController service annotations{}
controller.service.typestringController service type"ClusterIP"
controller.tolerationslistController tolerations[]
fullnameOverridestringFully override resource generated names""
nameOverridestringPartially override resource generated names""
podSecurityPolicy.enabledboolEnable pod security policyfalse
rbac.createboolCreate RBAC resourcestrue
rbac.serviceAccountNamestringName of the service account to use when rbac.create is falsenil
versionstringTekton triggers version used to add labels on deployments, pods and services"v0.4.0"
webhook.affinityobjectWebhook affinity rules{}
webhook.annotationsobjectWebhook pod annotationsSee values.yaml
webhook.image.pullPolicystringWebhook docker image pull policy"IfNotPresent"
webhook.image.repositorystringWebhook docker image repository"gcr.io/tekton-releases/github.com/tektoncd/triggers/cmd/webhook"
webhook.image.tagstringWebhook docker image tag"v0.4.0"
webhook.metrics.enabledboolEnable webhook metrics servicetrue
webhook.metrics.portintWebhook metrics service port9090
webhook.metrics.portNamestringWebhook metrics service port name"http-metrics"
webhook.nodeSelectorobjectWebhook node selector{}
webhook.podDisruptionBudget.ennabledboolfalse
webhook.podDisruptionBudget.maxUnavailableintMaximum unavailable webhook pods1
webhook.podDisruptionBudget.minAvailableintMinimum available webhook pods1
webhook.profiling.enabledboolEnable pebhook profiling servicetrue
webhook.profiling.portintWebhook profiling service port8008
webhook.profiling.portNamestringWebhook profiling service port name"http-profiling"
webhook.replicasintWebhook replicas1
webhook.resourcesobjectWebhook resource limits and requests{}
webhook.securityContextobjectWebhook pods security context{}
webhook.service.annotationsobjectWebhook service annotations{}
webhook.service.typestringWebhook service type"ClusterIP"
webhook.tolerationslistWebhook tolerations[]
webhook.updateStrategyobjectWebhook pods update strategy{}

You can look directly at the values.yaml file to look at the options and their default values.

Try it out

This chart should deploy correctly with default values.

You will find examples below of how to customize the deployment of a release with various options. The list of examples is by no means exhaustive, it tries to cover the most used cases.

If you feel something is incomplete, missing or incorrect please open an issue and we'll do our best to improve this documentation.

Configure pod resources

Controller and Webhook pod resources are configured independently.

Create a yaml file called pod-resources.yaml looking like this (the name doesn't really matters):

controller:
  resources:
    requests:
      cpu: 0.5
      memory: 128m
    limits:
      cpu: 1
      memory: 256m
webhook:
  resources:
    requests:
      cpu: 0.2
      memory: 100m
    limits:
      cpu: 0.5
      memory: 200m

Use the previously created file to pass the values to helm:

# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --values pod-resources.yaml
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --values pod-resources.yaml

Configure number of webhook replicas

Only Webhook pod replicas can be configured, the controller doesn't support more than 1 replica.

# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --set webhook.replicas=3
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --set webhook.replicas=3

Enable prometheus scraping

To let prometheus scrape the metrics endpoints, we need to set annotations on the controller and/or webhook services.

This can be done using the controller.service.annotations and webhook.service.annotations options.

Create a yaml file called service-annotations.yaml looking like this (the name doesn't really matters):

controller:
  service:
    annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port: '9090'
webhook:
  service:
    annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port: '9090'

Use the previously created file to pass the values to helm:

# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --values service-annotations.yaml
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --values service-annotations.yaml

Production grade configuration

An example configuration is available in values-production.yaml.

Deploy with:

# This will install Tekton Triggers in the tekton namespace (with a my-triggers release name)

# Helm v2
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --values values-production.yaml
# Helm v3
helm upgrade --install my-triggers --namespace tekton eddycharly/triggers --values values-production.yaml
  • Enable pod security policy
podSecurityPolicy:
  enabled: true
  • Configure controller/webhook pod resources

Depending on the size and load of your cluster, requests and/or limits values will need to be adjusted.

controller:
  resources:
    requests:
      cpu: 0.5
      memory: 128m
    limits:
      cpu: 0.5
      memory: 128m
webhook:
  resources:
    requests:
      cpu: 0.5
      memory: 128m
    limits:
      cpu: 0.5
      memory: 128m
  • Prevent cluster autoscaler to evict controller
controller:
  annotations:
    cluster-autoscaler.kubernetes.io/safe-to-evict: 'false'
  • Enable metrics scraping
controller:
  service:
    annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port: '9090'
  metrics:
    enabled: true
    port: 9090
    portName: metrics
webhook:
  service:
    annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port: '9090'
  metrics:
    enabled: true
    port: 9090
    portName: metrics
  • Configure webhook replicas and affinity

Depending on your k8s platform and cluster topology, you should ensure that more than one webhook pod is running.

Webhook pods should be distributed across data centers/availability zones.

webhook:
  replicas: 3
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchLabels:
              app.kubernetes.io/component: webhook
              app.kubernetes.io/instance: my-triggers
          topologyKey: failure-domain.beta.kubernetes.io/zone
  • Configure webhook pod disruption budget and update strategy

To ensure there is always a minimum number of webhook pods running, you should configure a pod disruption budget.

webhook:
  podDisruptionBudget:
    ennabled: true
    minAvailable: 1
    maxUnavailable: 1
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1

Deploy triggers with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has triggers on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttriggers is pinned at v0.4.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply