GitHub Action to deploy Knative Service using Knative Client.
Kubernetes Cluster with Knative, if you dont have an OpenShift cluster see try.openshift.com or try our new Developer Sandbox.
Input | Required | Description |
---|---|---|
service_name | Yes | The Knative Service Name. |
service_namespace | No | The Kubernetes Namespace to deploy to. Defaults to current context's namespace. |
service_operation | No | The `kn` service operation create , update , delete , etc.
Defaults to create |
container_image | Yes | The container image to use for service. |
service_params | No | The extra service parameters to pass to the service. |
registry_user | No | The registry user to use to create image pull secret. Required if image registry is private. |
registry_password | No | The registry user password or token. Required if image registry is private. |
Output | Description |
---|---|
service_url | Knative Service URL of the service created. |
NOTE:
When username and password or token is provided to pull the image, then the action will create a Kubernetes Secret of type docker-registry
with the docker-username
to be registry_user
and docker-password
to be registry_password
. The docker-server
value will be the first part of the container_image
value.
This action provides basic options such as namespace, service name, image and operation to be configured. There might be cases where you might want to pass extra arguments to the kn service <command>
, in those cases you can use service_params
as shown:
Consider an example that you want to add --max-scale=5
and --min-scale=1
, then your action snippet will be:
- name: Knative Service Deploy
id: kn_service_deploy
uses: redhat-actions/kn-service-deploy@v1
with:
service_name: fruits-app
container_image: "${{ steps.push-tag-to-quay.outputs.registry-path }}"
service_params: >
--max-scale=5
--min-scale=1
The example below shows how the kn-service-deploy
action can be used to deploy knative service using openshift cluster.
Here OpenShift is used as the Kubernetes platform, you can use the oc-login action, to login into the OpenShift cluster to perform kn
actions.
# Login into the Openshift cluster
# with your username and password/token
- name: Authenticate and set context
id: oc_login
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.NAMESPACE }}
# Deploy knative service using container image
- name: Knative Service Deploy
id: kn_service_deploy
uses: redhat-actions/kn-service-deploy@v1
with:
service_name: fruits-app
container_image: "${{ env.IMAGE_NAME }}"
For a complete example see the example workflow.
This is an open source project open to anyone. This project welcomes contributions and suggestions!
If you discover an issue please file a bug in GitHub Issues and we will fix it as soon as possible.
MIT, See LICENSE for more information.