Installing Result

Installing Result

To install the results using Operator, please follow these instructions:
  1. Create a database user and password in the openshift-pipelines namespace:

    export NAMESPACE="openshift-pipelines"
    oc create secret generic tekton-results-postgres --namespace=${NAMESPACE} --from-literal=POSTGRES_USER=result --from-literal=POSTGRES_PASSWORD=$(openssl rand -base64 20)
  2. Generate a new self-signed certificate. Alternatively, you can use a certificate provided by the certificate authority (CA).

    openssl req -x509 \
    -newkey rsa:4096 \
    -keyout key.pem \
    -out cert.pem \
    -days 365 \
    -nodes \
    -subj "/CN=tekton-results-api-service.${NAMESPACE}.svc.cluster.local" \
    -addext "subjectAltName = DNS:tekton-results-api-service.${NAMESPACE}.svc.cluster.local"
  3. Create a new Transport Layer Security (TLS) secret from the certificate.

    oc create secret tls -n ${NAMESPACE} tekton-results-tls --cert=cert.pem --key=key.pem
  4. Optional: Create a Persistent Volume Claim (PVC) if you need to store your logging data.

    cat <<EOF > pvc.yaml
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: tekton-logs
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
    EOF
    # Apply the above PVC
    oc apply -n ${NAMESPACE}  -f pvc.yaml
  5. Edit the TektonResult CR based on your needs

    apiVersion: operator.tekton.dev/v1alpha1
    kind: TektonResult
    metadata:
      name: result
    spec:
      targetNamespace: openshift-pipelines
      logs_api: true
      log_level: debug
      db_port: 5432
      db_user: result
      db_host: tekton-results-postgres-service.openshift-pipelines.svc.cluster.local
      logging_pvc_name: tekton-logs
      logs_path: /logs
      logs_type: File
      logs_buffer_size: 32768
      auth_disable: true
      tls_hostname_override: tekton-results-api-service.openshift-pipelines.svc.cluster.local
      db_enable_auto_migration: true
      server_port: 8080
      prometheus_port: 9090
  6. Expose Route Tekton Results API Service

    oc create route -n ${NAMESPACE} passthrough tekton-results-api-service --service=tekton-results-api-service --port=8080