diff --git a/packs/tekton-chains-0.28.0/README.md b/packs/tekton-chains-0.28.0/README.md new file mode 100644 index 00000000..45c7777e --- /dev/null +++ b/packs/tekton-chains-0.28.0/README.md @@ -0,0 +1,78 @@ +# Tekton Chains Helm Chart + +Tekton Chains is a Kubernetes controller designed for supply chain security and management in Tekton. This project observes the execution of `TaskRuns` and `PipelineRuns`, extracts their provenance, signs it, and stores it securely (e.g., as in-toto attestations or OCI signatures). + +This file describes the usage of the Helm chart to deploy Tekton Chains. + +## Prerequisites + +Before installing this chart, ensure your cluster meets the following requirements: + +* **Kubernetes:** Version 1.29 or higher. +* **Helm:** Version 3.0+. +* **Tekton Pipelines:** Tekton Pipelines must be previously installed on the cluster. +* **Signing Tool:** Optionally, have `cosign` installed on your local machine to generate the cryptographic key pair. + +## Parameters + +The following table lists the most common configuration parameters that you can adjust in the `values.yaml` file or via `--set` during installation: + +| Parameter | Description | Default Value | +| :--- | :--- | :--- | +| `replicaCount` | Number of replicas for the Chains controller. | `1` | +| `image.repository` | Repository for the Chains controller image. | `gcr.io/tekton-releases/github.com/tektoncd/chains/cmd/controller` | +| `image.tag` | Image tag (version) to use. | `latest` | +| `serviceAccount.create` | Whether to create the ServiceAccount for the controller. | `true` | +| `config.artifacts.taskrun.format`| Generated attestation format (e.g., `in-toto`, `slsa/v1`). | `in-toto` | +| `config.artifacts.taskrun.storage`| Storage backend (e.g., `tekton`, `oci`, `gcs`). | `tekton` | +| `config.transparency.enabled` | Enables signature registration in a transparency log (e.g., Rekor).| `false` | + +## Upgrade + +To upgrade an existing Tekton Chains installation to a new version, run the following command with Helm, ensuring you use your custom values: + +```bash +helm upgrade tekton-chains ./tekton-chains \ + --namespace tekton-chains \ + --values your-values.yaml +``` + +*Note:* Always check the release notes in the official repository to identify if there are any incompatible changes in the configuration `ConfigMaps` before applying the upgrade. + +## Usage + +**1. Install the Chart:** + +To deploy Tekton Chains in your cluster within the `tekton-chains` namespace, run: + +```bash +helm install tekton-chains ./tekton-chains \ + --namespace tekton-chains \ + --create-namespace +``` + +**2. Configure signing keys:** + +Once the controller is running, you need to provide it with a cryptographic key pair so it can sign the artifacts. Using `cosign`: + +```bash +# Generate the keys and store them directly as a secret in Kubernetes +cosign generate-key-pair k8s://tekton-chains/signing-secrets +``` + +**3. Verify the status:** + +Ensure the pods have initialized correctly: + +```bash +kubectl get pods -n tekton-chains --watch +``` + +From this point forward, Tekton Chains will automatically intercept successful `TaskRuns` and `PipelineRuns` to generate the attestation and sign them according to the configuration defined in your cluster. + +## References + +* [Tekton Chains GitHub Repository](https://github.com/tektoncd/chains) +* [Tekton Pipelines Documentation](https://tekton.dev/docs/pipelines/) +* [Cosign and Sigstore Guide](https://docs.sigstore.dev/cosign/overview/) +* [SLSA Specification (Supply-chain Levels for Software Artifacts)](https://slsa.dev/) diff --git a/packs/tekton-chains-0.28.0/logo.png b/packs/tekton-chains-0.28.0/logo.png new file mode 100644 index 00000000..6f6ca5db Binary files /dev/null and b/packs/tekton-chains-0.28.0/logo.png differ diff --git a/packs/tekton-chains-0.28.0/manifests/release.yaml b/packs/tekton-chains-0.28.0/manifests/release.yaml new file mode 100644 index 00000000..0e8a763a --- /dev/null +++ b/packs/tekton-chains-0.28.0/manifests/release.yaml @@ -0,0 +1,572 @@ +# Copyright 2021 The Tekton Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +kind: Namespace +apiVersion: v1 +metadata: + name: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +--- +apiVersion: v1 +kind: Secret +metadata: + name: signing-secrets + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + +# The data is populated at install time. +# data: +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: chains-config + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + +# The data can be tweaked at install time, it is commented out +# because these are the default settings. +# data: +# artifacts.taskrun.format: tekton +# artifacts.taskrun.storage: tekton +# artifacts.taskrun.signer: x509 +# artifacts.oci.storage: oci +# artifacts.oci.format: simplesigning +# artifacts.oci.signer: x509 +# transparency.enabled: false +# transparency.url: https://rekor.sigstore.dev +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tekton-chains-controller + namespace: tekton-chains + labels: + app.kubernetes.io/name: controller + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + pipeline.tekton.dev/release: "v0.28.0" + version: "v0.28.0" +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: controller + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + template: + metadata: + annotations: + cluster-autoscaler.kubernetes.io/safe-to-evict: "false" + labels: + app: tekton-chains-controller + app.kubernetes.io/name: controller + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + # # tekton.dev/release value replaced with inputs.params.versionTag in pipeline/tekton/publish.yaml + pipeline.tekton.dev/release: "v0.28.0" + version: "v0.28.0" + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/os + operator: NotIn + values: + - windows + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/name: controller + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + topologyKey: kubernetes.io/hostname + weight: 100 + serviceAccountName: tekton-chains-controller + containers: + - name: tekton-chains-controller + image: ghcr.io/tektoncd/chains/github.com/tektoncd/chains/cmd/controller:v0.28.0@sha256:acc471b39659b119d4099c251108845b0272bb77784f30aa77245995370fe5ce + volumeMounts: + - name: signing-secrets + mountPath: /etc/signing-secrets + - name: oidc-info + mountPath: /var/run/sigstore/cosign + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: METRICS_DOMAIN + value: tekton.dev/chains + - name: CONFIG_OBSERVABILITY_NAME + value: tekton-chains-config-observability + - name: CONFIG_LEADERELECTION_NAME + value: tekton-chains-config-leader-election + - name: KUBERNETES_MIN_VERSION + value: "v1.28.0" + ports: + - name: metrics + containerPort: 9090 + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + # User 65532 is the distroless nonroot user ID + runAsUser: 65532 + runAsGroup: 65532 + volumes: + - name: signing-secrets + secret: + secretName: signing-secrets + - name: oidc-info + projected: + sources: + # The "public good" instance supports tokens from EKS and GKE by default. + # The fulcio URL can also be redirected to an instance that has been + # configured to accept other issuers as well. Removing this volume + # completely will direct chains to use alternate ambient credentials + # (e.g. GKE workload identity, SPIFFE) + - serviceAccountToken: + path: oidc-token + expirationSeconds: 600 # Use as short-lived as possible. + audience: sigstore + +--- +# Copyright 2021 The Tekton Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: tekton-chains-controller-cluster-access + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +subjects: + - kind: ServiceAccount + name: tekton-chains-controller + namespace: tekton-chains +roleRef: + kind: ClusterRole + name: tekton-chains-controller-cluster-access + apiGroup: rbac.authorization.k8s.io +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: tekton-chains-controller-cluster-access + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +rules: + - apiGroups: [""] + # Controller needs to watch Pods created by TaskRuns to see them progress. + resources: ["pods"] + verbs: ["list", "watch"] + # Controller needs cluster access to all of the CRDs that it is responsible for + # managing. + - apiGroups: ["tekton.dev"] + resources: ["tasks", "clustertasks", "taskruns", "pipelines", "pipelineruns", + "pipelineresources", "conditions", "runs"] + verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] + - apiGroups: ["tekton.dev"] + resources: ["taskruns/finalizers", "pipelineruns/finalizers", "runs/finalizers"] + verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] + - apiGroups: ["tekton.dev"] + resources: ["tasks/status", "clustertasks/status", "taskruns/status", "pipelines/status", + "pipelineruns/status", "pipelineresources/status", "runs/status"] + verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + # This is the access that the controller needs on a per-namespace basis. + name: tekton-chains-controller-tenant-access + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +rules: + # Read-write access to create Pods, K8s Events and PVCs (for Workspaces) + - apiGroups: [""] + resources: ["pods", "pods/log", "events", "persistentvolumeclaims"] + verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] + # Read-only access to these. + - apiGroups: [""] + resources: ["configmaps", "limitranges", "secrets", "serviceaccounts"] + verbs: ["get", "list", "watch"] + # Read-write access to StatefulSets for Affinity Assistant. + - apiGroups: ["apps"] + resources: ["statefulsets"] + verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] +--- +# If this ClusterRoleBinding is replaced with a RoleBinding +# then the ClusterRole would be namespaced. The access described by +# the tekton-pipelines-controller-tenant-access ClusterRole would +# be scoped to individual tenant namespaces. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: tekton-chains-controller-tenant-access + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +subjects: + - kind: ServiceAccount + name: tekton-chains-controller + namespace: tekton-chains +roleRef: + kind: ClusterRole + name: tekton-chains-controller-tenant-access + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: tekton-chains-controller + namespace: tekton-chains + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: tekton-chains-leader-election + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +rules: + # We uses leases for leaderelection + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: tekton-chains-controller-leaderelection + namespace: tekton-chains + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +subjects: + - kind: ServiceAccount + name: tekton-chains-controller + namespace: tekton-chains +roleRef: + kind: Role + name: tekton-chains-leader-election + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: tekton-chains-info + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +rules: + # All system:authenticated users need to have access + # to the chains-info ConfigMap even if they don't + # have access to other resources present in the + # installed namespace + - apiGroups: [""] + resources: ["configmaps"] + resourceNames: ["chains-info"] + verbs: ["get"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: tekton-chains-info + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +subjects: + # Giving all system:authenticated users the access to the + # ConfigMap which contains version information + - kind: Group + name: system:authenticated + apiGroup: rbac.authorization.k8s.io +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: tekton-chains-info + +--- +# Copyright 2022 The Tekton Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: chains-info + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +data: + # Contains chains version which can be queried by external + # tools such as CLI. Elevated permissions are given to + # this ConfigMap such that even if we don't have access to + # other resources in the namespace, we can still access + # this ConfigMap. + version: "v0.28.0" + +--- +# Copyright 2023 Tekton Authors LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: tekton-chains-config-leader-election + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +data: + _example: | + ################################ + # # + # EXAMPLE CONFIGURATION # + # # + ################################ + # This block is not actually functional configuration, + # but serves to illustrate the available configuration + # options and document them in a way that is accessible + # to users that `kubectl edit` this config map. + # + # These sample configuration options may be copied out of + # this example block and unindented to be in the data block + # to actually change the configuration. + # lease-duration is how long non-leaders will wait to try to acquire the + # lock; 15 seconds is the value used by core kubernetes controllers. + lease-duration: "60s" + # renew-deadline is how long a leader will try to renew the lease before + # giving up; 10 seconds is the value used by core kubernetes controllers. + renew-deadline: "40s" + # retry-period is how long the leader election client waits between tries of + # actions; 2 seconds is the value used by core kubernetes controllers. + retry-period: "10s" + # buckets is the number of buckets used to partition key space of each + # Reconciler. If this number is M and the replica number of the controller + # is N, the N replicas will compete for the M buckets. The owner of a + # bucket will take care of the reconciling for the keys partitioned into + # that bucket. + buckets: "1" + +--- +# Copyright 2019 Tekton Authors LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-logging + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +data: + # Common configuration for all knative codebase + zap-logger-config: | + { + "level": "info", + "development": false, + "sampling": { + "initial": 100, + "thereafter": 100 + }, + "outputPaths": ["stdout"], + "errorOutputPaths": ["stderr"], + "encoding": "json", + "encoderConfig": { + "timeKey": "ts", + "levelKey": "level", + "nameKey": "logger", + "callerKey": "caller", + "messageKey": "msg", + "stacktraceKey": "stacktrace", + "lineEnding": "", + "levelEncoder": "", + "timeEncoder": "iso8601", + "durationEncoder": "", + "callerEncoder": "" + } + } + # Log level overrides + loglevel.controller: "info" + loglevel.webhook: "info" + +--- +# Copyright 2023 Tekton Authors LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: tekton-chains-config-observability + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains +data: + # metrics-protocol specifies the OpenTelemetry export protocol for metrics. + # Supported values: prometheus (default), grpc, http/protobuf, none. + metrics-protocol: prometheus + _example: | + ################################ + # # + # EXAMPLE CONFIGURATION # + # # + ################################ + # This block is not actually functional configuration, + # but serves to illustrate the available configuration + # options and document them in a way that is accessible + # to users that `kubectl edit` this config map. + # + # These sample configuration options may be copied out of + # this example block and unindented to be in the data block + # to actually change the configuration. + # + # metrics-protocol specifies the OpenTelemetry export protocol. + # Supported values: prometheus (default), grpc, http/protobuf, none. + # + metrics-protocol: prometheus + # + # metrics-endpoint is the OTLP collector endpoint to send metrics to. + # Required when metrics-protocol is grpc or http/protobuf. + # + metrics-endpoint: "otel-collector.observability.svc.cluster.local:4317" + # + # metrics-export-interval is the interval at which metrics are exported. + # Uses Go duration format (e.g. 30s, 1m). Defaults to 30s. + # + metrics-export-interval: 30s + +--- +# Copyright 2023 Tekton Authors LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Service +metadata: + name: tekton-chains-metrics + namespace: tekton-chains + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + app: tekton-chains-controller +spec: + ports: + - name: http-metrics + port: 9090 + protocol: TCP + targetPort: 9090 + selector: + app.kubernetes.io/name: controller + app.kubernetes.io/component: controller + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-chains + +--- diff --git a/packs/tekton-chains-0.28.0/pack.json b/packs/tekton-chains-0.28.0/pack.json new file mode 100644 index 00000000..15c13a21 --- /dev/null +++ b/packs/tekton-chains-0.28.0/pack.json @@ -0,0 +1,30 @@ +{ + "name": "tekton-chains", + "displayName": "Tekton Chains", + "annotations": { + "docsURL": "https://github.com/tektoncd/chains", + "description": "Tekton Chains", + "source": "community", + "contributor" : "spectrocloud" + }, + "version": "0.28.0", + "kubeManifests": [ + "manifests/release.yaml" + ], + "layer": "addon", + "addonType": "system app", + "cloudTypes": [ + "all" + ], + "constraints": { + "dependencies": [ + { + "packName": "tekton-pipelines", + "minVersion": "1.14.0", + "maxVersion": "", + "layer": "addon", + "type": "required" + } + ] + } +} \ No newline at end of file diff --git a/packs/tekton-chains-0.28.0/schema.yaml b/packs/tekton-chains-0.28.0/schema.yaml new file mode 100644 index 00000000..9d2e7a76 --- /dev/null +++ b/packs/tekton-chains-0.28.0/schema.yaml @@ -0,0 +1,2 @@ +pack.namespace: + schema: '{{ readonly }}' diff --git a/packs/tekton-chains-0.28.0/values.yaml b/packs/tekton-chains-0.28.0/values.yaml new file mode 100644 index 00000000..7a0431a0 --- /dev/null +++ b/packs/tekton-chains-0.28.0/values.yaml @@ -0,0 +1,2 @@ +pack: + namespace: "tekton-chains"