mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-21 05:55:35 +00:00
copy task helm-upgrade-from-repo from 0.2 to 0.3 and helm-upgrade-from-source from 0.3 to 0.4
This commit is contained in:
parent
7d958276ff
commit
c9727dc825
60
task/helm-upgrade-from-repo/0.3/README.md
Normal file
60
task/helm-upgrade-from-repo/0.3/README.md
Normal file
@ -0,0 +1,60 @@
|
||||
# Helm
|
||||
|
||||
These tasks will install / upgrade a helm chart into your Kubernetes / OpenShift Cluster using [Helm](https://github.com/helm/helm).
|
||||
|
||||
## Install the Task
|
||||
|
||||
#### Workspaces
|
||||
|
||||
* **source**: A [Workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) volume containing the helm chart.
|
||||
|
||||
### helm install / upgrade from repo
|
||||
|
||||
```
|
||||
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/helm-upgrade-from-repo/0.2/raw
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **chart_name**: 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_image**: The helm image which should be used (default: lachlanevenson/k8s-helm:v3.5.0)
|
||||
|
||||
#### Platforms
|
||||
|
||||
The Task can be run on `linux/amd64`, `linux/s390x`, `linux/arm64` and `linux/ppc64le` platforms.
|
||||
|
||||
## 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 repo
|
||||
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
|
||||
```
|
51
task/helm-upgrade-from-repo/0.3/helm-upgrade-from-repo.yaml
Normal file
51
task/helm-upgrade-from-repo/0.3/helm-upgrade-from-repo.yaml
Normal file
@ -0,0 +1,51 @@
|
||||
# This Task will do a helm upgrade based on the given helm repo and chart
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: helm-upgrade-from-repo
|
||||
labels:
|
||||
app.kubernetes.io/version: "0.2"
|
||||
annotations:
|
||||
tekton.dev/categories: Deployment
|
||||
tekton.dev/pipelines.minVersion: "0.12.1"
|
||||
tekton.dev/tags: helm
|
||||
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
|
||||
spec:
|
||||
description: >-
|
||||
These tasks will install / upgrade a helm chart into your Kubernetes /
|
||||
OpenShift Cluster using Helm
|
||||
|
||||
params:
|
||||
- name: helm_repo
|
||||
description: "Specify a specific helm repo"
|
||||
- name: chart_name
|
||||
description: "Specify chart name that will be deployed"
|
||||
- name: release_version
|
||||
description: The helm release version in semantic versioning format
|
||||
default: "v1.0.0"
|
||||
- name: release_name
|
||||
description: The helm release name
|
||||
default: "helm-release"
|
||||
- name: release_namespace
|
||||
description: The helm release namespace
|
||||
default: ""
|
||||
- name: overwrite_values
|
||||
description: "Specify the values you want to overwrite, comma separated: autoscaling.enabled=true,replicas=1"
|
||||
default: ""
|
||||
- name: helm_image
|
||||
description: "Specify a specific helm image"
|
||||
default: "docker.io/lachlanevenson/k8s-helm@sha256:5c792f29950b388de24e7448d378881f68b3df73a7b30769a6aa861061fd08ae" #tag: v3.6.0
|
||||
steps:
|
||||
- name: upgrade-from-repo
|
||||
image: $(params.helm_image)
|
||||
script: |
|
||||
echo current installed helm releases
|
||||
helm list --namespace "$(params.release_namespace)"
|
||||
echo parsing helms repo name...
|
||||
REPO=`echo "$(params.chart_name)" | cut -d "/" -f 1`
|
||||
echo adding helm repo...
|
||||
helm repo add $REPO "$(params.helm_repo)"
|
||||
echo adding updating repo...
|
||||
helm repo update
|
||||
echo installing helm chart...
|
||||
helm upgrade --wait --install --namespace "$(params.release_namespace)" $(params.release_name) $(params.chart_name) --debug --set "$(params.overwrite_values)"
|
@ -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://charts.helm.sh/stable
|
||||
- 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
|
7
task/helm-upgrade-from-repo/0.3/tests/pre-apply-task-hook.sh
Executable file
7
task/helm-upgrade-from-repo/0.3/tests/pre-apply-task-hook.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Add service account
|
||||
kubectl -n ${tns} create serviceaccount helm-pipeline-run-sa
|
||||
|
||||
# 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 -
|
30
task/helm-upgrade-from-repo/0.3/tests/run.yaml
Normal file
30
task/helm-upgrade-from-repo/0.3/tests/run.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: helm-upgrade-test-pipeline
|
||||
spec:
|
||||
tasks:
|
||||
- name: helm-upgrade-from-repo
|
||||
taskRef:
|
||||
name: helm-upgrade-from-repo
|
||||
params:
|
||||
- name: helm_repo
|
||||
value: https://dunefro.github.io/sample-charts/
|
||||
- name: chart_name
|
||||
value: sample-charts/sample-nginx
|
||||
- name: release_version
|
||||
value: v1.0.0
|
||||
- name: release_name
|
||||
value: helm-repo-sample
|
||||
- name: overwrite_values
|
||||
value: autoscaling.enabled=false,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
|
65
task/helm-upgrade-from-source/0.4/README.md
Normal file
65
task/helm-upgrade-from-source/0.4/README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# 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://api.hub.tekton.dev/v1/resource/tekton/task/helm-upgrade-from-source/0.3/raw
|
||||
```
|
||||
|
||||
#### 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: ""*)
|
||||
- **values_file**: The values file to be used,
|
||||
assumes the values file is in the same dir as your charts_dir (*default: "values.yaml"*)
|
||||
- **helm_image**: The helm image which should be used (*default: lachlanevenson/k8s-helm:v3.3.4*)
|
||||
- **upgrade_extra_params**: Extra parameters passed for the helm upgrade command (*default: ""*)
|
||||
|
||||
#### Workspaces
|
||||
|
||||
* **source**: A [Workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) containing the helm chart.
|
||||
|
||||
#### Platforms
|
||||
|
||||
The Task can be run on `linux/amd64`, `linux/s390x`, `linux/arm64` and `linux/ppc64le` platforms.
|
||||
|
||||
## 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
|
||||
```
|
@ -0,0 +1,52 @@
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: helm-upgrade-from-source
|
||||
labels:
|
||||
app.kubernetes.io/version: "0.3"
|
||||
annotations:
|
||||
tekton.dev/pipelines.minVersion: "0.12.1"
|
||||
tekton.dev/categories: Deployment
|
||||
tekton.dev/tags: helm
|
||||
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
|
||||
spec:
|
||||
description: >-
|
||||
These tasks will install / upgrade a helm chart into your Kubernetes /
|
||||
OpenShift Cluster using Helm
|
||||
|
||||
params:
|
||||
- name: charts_dir
|
||||
description: The directory in source that contains the helm chart
|
||||
- name: release_version
|
||||
description: The helm release version in semantic versioning format
|
||||
default: "v1.0.0"
|
||||
- name: release_name
|
||||
description: The helm release name
|
||||
default: "helm-release"
|
||||
- name: release_namespace
|
||||
description: The helm release namespace
|
||||
default: ""
|
||||
- name: overwrite_values
|
||||
description: "Specify the values you want to overwrite, comma separated: autoscaling.enabled=true,replicas=1"
|
||||
default: ""
|
||||
- name: values_file
|
||||
description: "The values file to be used"
|
||||
default: "values.yaml"
|
||||
- name: helm_image
|
||||
description: "helm image to be used"
|
||||
default: "docker.io/lachlanevenson/k8s-helm@sha256:5c792f29950b388de24e7448d378881f68b3df73a7b30769a6aa861061fd08ae" #tag: v3.6.0
|
||||
- name: upgrade_extra_params
|
||||
description: "Extra parameters passed for the helm upgrade command"
|
||||
default: ""
|
||||
workspaces:
|
||||
- name: source
|
||||
steps:
|
||||
- name: upgrade
|
||||
image: $(params.helm_image)
|
||||
workingDir: /workspace/source
|
||||
script: |
|
||||
echo current installed helm releases
|
||||
helm list --namespace "$(params.release_namespace)"
|
||||
|
||||
echo installing helm chart...
|
||||
helm upgrade --install --wait --values "$(params.charts_dir)/$(params.values_file)" --namespace "$(params.release_namespace)" --version "$(params.release_version)" "$(params.release_name)" "$(params.charts_dir)" --debug --set "$(params.overwrite_values)" $(params.upgrade_extra_params)
|
@ -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
|
10
task/helm-upgrade-from-source/0.4/tests/pre-apply-task-hook.sh
Executable file
10
task/helm-upgrade-from-source/0.4/tests/pre-apply-task-hook.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Add git-clone
|
||||
add_task git-clone latest
|
||||
|
||||
# Add service account
|
||||
kubectl -n ${tns} create serviceaccount helm-pipeline-run-sa
|
||||
|
||||
# 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
task/helm-upgrade-from-source/0.4/tests/resources.yaml
Normal file
11
task/helm-upgrade-from-source/0.4/tests/resources.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: helm-source-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 200Mi
|
54
task/helm-upgrade-from-source/0.4/tests/run.yaml
Normal file
54
task/helm-upgrade-from-source/0.4/tests/run.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: helm-upgrade-test-pipeline
|
||||
spec:
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
tasks:
|
||||
- name: fetch-repository
|
||||
taskRef:
|
||||
name: git-clone
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: shared-workspace
|
||||
params:
|
||||
- name: url
|
||||
value: https://github.com/helm/examples
|
||||
- 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: charts/hello-world
|
||||
- name: release_version
|
||||
value: v1.0.0
|
||||
- name: release_name
|
||||
value: helm-source-sample
|
||||
- name: overwrite_values
|
||||
value: "autoscaling.enabled=true,autoscaling.maxReplicas=3"
|
||||
- name: upgrade_extra_params
|
||||
value: "--force"
|
||||
---
|
||||
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
|
Loading…
Reference in New Issue
Block a user