1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-26 06:23:37 +00:00

This patch splits openshift-client task from the openshift-client directory

Changes include:
  - moves the openshift-client task to the task directory
  - copies and modifies readme file for openshift-client task from openshift-client directory
  - copies OWNERS file from openshift-client directory
  - changes the yaml filename to match the resource name

Issue: #386

Signed-off-by: Shiv Verma <shverma@redhat.com>
This commit is contained in:
pratap0007 2020-07-03 18:31:24 +05:30 committed by tekton-robot
parent 57ebef41f9
commit f7be0d4872
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,7 @@
approvers:
- vdemeester
- piyush-garg
reviewers:
- vdemeester
- piyush-garg
- chmouel

View File

@ -0,0 +1,53 @@
## OpenShift Client Task
[OpenShift](http://www.openshift.com) is a Kubernetes distribution from Red Hat which provides `oc`, the [OpenShift CLI](https://docs.openshift.com/container-platform/4.1/cli_reference/getting-started-cli.html) that complements `kubectl` for simplifying deployment and configuration applications on OpenShift.
Openshift-client runs commands against the cluster where the task run is being executed
## Install the Task
```
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/openshift-client/0.1/openshift-client.yaml
```
## Parameters
* **ARGS:** args to execute which are appended to `oc` e.g. `start-build myapp` (_default_: `help`)
* **SCRIPT:** script of oc commands to execute e.g. `oc get pod $1 -0 yaml` This will take the first value of ARGS as pod name (_default_: `oc $@`)
## Resources
### Inputs
* **cluster**: a `cluster`-type `PipelineResource` specifying the target OpenShift cluster to execute the commands against it
## ServiceAccount
If you don't specify a service account to be used for running the `TaskRun` or `PipelineRun`, the `default` [service account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server). OpenShift by default does not allow the default service account to modify objects in the namespace. Therefore you should either explicitly grant permission to the default service account (by creating rolebindings) or [create a new service account with sufficient privileges](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#service-account-permissions) and specify it on the [`TaskRun`](https://github.com/tektoncd/pipeline/blob/master/docs/taskruns.md#service-account) or [`PipelineRun`](https://github.com/tektoncd/pipeline/blob/master/docs/pipelineruns.md#service-account).
You can do the former via `oc` and running the following command, replacing `<namespace>` with your target namespace:
```
oc policy add-role-to-user edit -z default -n <namespace>
```
## Usage
This `TaskRun` runs an `oc rollout` command to deploy the latest image version for `myapp` on OpenShift.
```
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: deploy-myapp
spec:
taskRef:
name: openshift-client
params:
- name: ARGS
value:
- "rollout"
- "latest"
- "myapp"
```