Skip to content

Commit

Permalink
This patch splits helm-upgrade-from-source task from the helm directory
Browse files Browse the repository at this point in the history
Changes include:
  - moves helm-upgrade-from-source task to the task directory
  - copies and modifies readme file for helm-upgrade-from-source from helm directory
  - copies OWNERS,examples and tests directory from helm directory

Issue: tektoncd#386

Signed-off-by: Puneet Punamiya <[email protected]>
  • Loading branch information
PuneetPunamiya authored and popcor255 committed Jul 14, 2020
1 parent d3f1d4b commit 3ad8a2c
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 0 deletions.
5 changes: 5 additions & 0 deletions task/helm-upgrade-from-source/0.1/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
approvers:
- fhopfensperger

reviewers:
- fhopfensperger
58 changes: 58 additions & 0 deletions task/helm-upgrade-from-source/0.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Helm

These tasks will install / upgrade a helm chart into your Kubernetes / OpenShift Cluster using [Helm](https://github.com/helm/helm).

## Install the Task

### helm install / upgrade from source code

```
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/helm-upgrade-from-source/0.1/helm-upgrade-from-source.yaml
```

#### Parameters

- **charts_dir**: The directory in the source repository where the installable chart should be found.
- **release_version**: The version of the release (*default: v1.0.0*)
- **release_name**: The name of the release (*default: helm-release*)
- **release_namespace**: The namespace in which the release is to be installed (*default: ""*)
- **overwrite_values**: The values to be overwritten (*default: ""*)
- **helm_version**: The helm version which should be used (*default: latest*)

#### Workspaces

* **source**: A [Workspace](https://github.com/tektoncd/pipeline/blob/master/docs/workspaces.md) volume containing the helm chart.

## Usage

### PipelineRun

An example `Pipeline` with a `PipelineRun` can be found in the subdirectory `tests`.

### TaskRun

This `TaskRun` runs the task to retrieve a Git repo and then installs/updates the helm chart that is in the Git repo.

```yaml
# example upgrade from source
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: example-helm-upgrade-from-source
spec:
taskRef:
name: helm-upgrade-from-source
params:
- name: charts_dir
value: helm-sample-chart
- name: releases_version
value: v1.0.0
- name: release_name
value: helm-source-sample
- name: overwrite_values
value: "autoscaling.enabled=true,autoscaling.maxReplicas=3"
workspaces:
- name: source
persistentVolumeClaim:
claimName: my-source
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: example-helm-upgrade-from-repo
spec:
taskRef:
name: helm-upgrade-from-repo
params:
- name: helm_repo
value: https://kubernetes-charts.storage.googleapis.com
- name: chart_name
value: stable/envoy
- name: release_version
value: v1.0.0
- name: release_name
value: helm-repo-sample
- name: overwrite_values
value: autoscaling.enabled=true,autoscaling.maxReplicas=3
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: example-helm-upgrade-from-source
spec:
taskRef:
name: helm-upgrade-from-source
params:
- name: charts_dir
value: helm-sample-chart
- name: releases_version
value: v1.0.0
- name: release_name
value: helm-source-sample
- name: overwrite_values
value: "autoscaling.enabled=true,autoscaling.maxReplicas=3"
workspaces:
- name: source
persistentVolumeClaim:
claimName: my-source
File renamed without changes.
10 changes: 10 additions & 0 deletions task/helm-upgrade-from-source/0.1/tests/pre-apply-task-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Add git-clone
kubectl -n ${tns} apply -f ./git/git-clone.yaml

# Add service account
kubectl -n ${tns} create serviceaccount helm-pipeline-run-sa -o yaml --dry-run=client | kubectl apply -f -

# Add edit role to service account
kubectl -n ${tns} create rolebinding helm-pipeline-run-sa-edit --clusterrole edit --serviceaccount ${tns}:helm-pipeline-run-sa -o yaml --dry-run=client | kubectl apply -f -
11 changes: 11 additions & 0 deletions task/helm-upgrade-from-source/0.1/tests/resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: helm-source-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 200Mi
66 changes: 66 additions & 0 deletions task/helm-upgrade-from-source/0.1/tests/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: helm-upgrade-test-pipeline
spec:
workspaces:
- name: shared-workspace
tasks:
- name: helm-upgrade-from-repo
taskRef:
name: helm-upgrade-from-repo
params:
- name: helm_repo
value: https://kubernetes-charts.storage.googleapis.com
- name: chart_name
value: stable/envoy
- name: release_version
value: v1.0.0
- name: release_name
value: helm-repo-sample
- name: overwrite_values
value: autoscaling.enabled=true,autoscaling.maxReplicas=3
- name: fetch-repository
taskRef:
name: git-clone
workspaces:
- name: output
workspace: shared-workspace
params:
- name: url
value: https://github.com/fhopfensperger/tekton-helm-sample.git
- name: subdirectory
value: ""
- name: deleteExisting
value: "true"
- name: helm-upgrade-from-source
taskRef:
name: helm-upgrade-from-source
runAfter:
- fetch-repository
workspaces:
- name: source
workspace: shared-workspace
params:
- name: charts_dir
value: helm-sample-chart
- name: release_version
value: v1.0.0
- name: release_name
value: helm-source-sample
- name: overwrite_values
value: "autoscaling.enabled=true,autoscaling.maxReplicas=3"
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: helm-upgrade-test-pipeline-run
spec:
serviceAccountName: helm-pipeline-run-sa
pipelineRef:
name: helm-upgrade-test-pipeline
workspaces:
- name: shared-workspace
persistentvolumeclaim:
claimName: helm-source-pvc

0 comments on commit 3ad8a2c

Please sign in to comment.