f8b0e19da8
Annotation about linux/amd64,linux/s390x,linux/ppc64le and linux/arm64 platforms was added to the latest versions of curl, kn, kn-apply, sendmail, and generate-build-id tasks. Annotation about linux/amd64,linux/s390x,linux/ppc64le platforms was added to the latest version of jib-gradle task. For several tasks shas of the images were changed from amd64 specific ones to multi-arch ones. Signed-off-by: Yulia Gaponenko <yulia.gaponenko1@de.ibm.com> |
||
---|---|---|
.. | ||
knative-dockerfile-deploy | ||
support | ||
kn.yaml | ||
README.md |
Knative with kn
This Task performs operations on Knative resources (services, revisions, routes) using
kn
CLI.
Install the Task
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/kn/0.1/kn.yaml
Parameters
-
kn-image:
kn
CLI container image to run this task.default:
gcr.io/knative-releases/knative.dev/client/cmd/kn:latest
You can use nightly build of the
kn
CLI usinggcr.io/knative-nightly/knative.dev/client/cmd/kn
. -
ARGS: The arguments to pass to
kn
CLI. default:["help"]
Resources
Inputs
-
image: An
image
-typePipelineResource
specifying the location of the container image to deploy for Knative Service.User provides the
image
-type resource to kn CLI in parameterARGS
as an element of the array, for e.g."--image=$(inputs.resources.image.url)"
.
Platforms
The Task can be run on linux/amd64
, linux/s390x
, linux/arm64
and linux/ppc64le
platforms.
Usage
Authorizing the Deployment
In order to create Knative services, you must first define a ServiceAccount
with permission to manage Knative resources.
To create a ServiceAccount
with these permissions, you can run:
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/kn/0.1/support/kn-deployer.yaml
Running the Task
Let's take examples of creating and updating a Knative Service using kn
task.
- Following TaskRun runs the Task to create a Knative Service using given image.
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: kn-create-
spec:
serviceAccountName: kn-deployer-account # <-- run as the authorized SA
taskRef:
name: kn
resources:
inputs:
- name: image
resourceSpec:
type: image
params:
- name: url
value: gcr.io/knative-samples/helloworld-go
params:
- name: ARGS
value:
- "service"
- "create"
- "hello"
- "--force"
- "--image=$(inputs.resources.image.url)"
Run this with:
kubectl create -f kn-create-taskrun.yaml
- Following TaskRun runs the Task to update a Knative Service using given image or parameters.
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: kn-update-
spec:
serviceAccountName: kn-deployer-account # <-- run as the authorized SA
taskRef:
name: kn
resources:
inputs:
- name: image
resourceSpec:
type: image
params:
- name: url
value: gcr.io/knative-samples/helloworld-go
params:
- name: ARGS
value:
- "service"
- "update"
- "hello"
- "--image=$(inputs.resources.image.url)"
- "--env=TARGET=Tekton"
Run this with:
kubectl create -f kn-update-taskrun.yaml
In these examples, the image
resource can be built before hand, most
likely using a previous task.
Pipeline
Checkout the sample Pipelines for building your git source and deploying as Knative Service here.