Skip to content

Commit

Permalink
Make use of ingress in local dev cluster opt-in
Browse files Browse the repository at this point in the history
Update the behaviour of the `prepare-kind-cluster create` command
so it no longer installs and configures an ingress. This reduces
the resources required for the default dev environment as we no
longer need to install and configure the nginx ingress controller.

It also avoids issues where ports 80 or 443 are already bound to
other services on the host machine.

Add a new command `prepare-kind-cluster create-with-ingress` which
will behave in the same way as the previous `create` command,
allowing devs to opt-in to this behaviour if they wish.
  • Loading branch information
AlanGreene authored and tekton-robot committed Aug 23, 2021
1 parent 21df24a commit eed725c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 7 additions & 1 deletion docs/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,20 @@ e.g. to connect your local dev frontend to the Dashboard deployed on the robocat

The Dashboard repository contains a script that will provision a [`kind` cluster](https://kind.sigs.k8s.io/) named 'tekton-dashboard' with the latest releases of Tekton Pipelines and Tekton Triggers installed, as well as a version of the Tekton Dashboard which can be customised by providing additional parameters matching those expected by the installer script described earlier.

For example, the following will create a cluster with a local build of the Tekton Dashboard with log streaming enabled, exposed via ingress at `tekton-dashboard.127.0.0.1.nip.io`:
For example, the following will create a cluster with a local build of the Tekton Dashboard with log streaming enabled:

`./scripts/prepare-kind-cluster create`

To delete the cluster:

`./script/prepare-kind-cluster delete`

To create a cluster with the Tekton Dashboard exposed via ingress at `tekton-dashboard.127.0.0.1.nip.io`:

`./scripts/prepare-kind-cluster create-with-ingress`

This ensures the cluster is created with the required node labels and port mappings (ports 80 and 443).

## Run backend tests

### Backend unit tests
Expand Down
19 changes: 16 additions & 3 deletions scripts/prepare-kind-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
set -e

CLUSTERNAME=tekton-dashboard
DEFAULT_OPTIONS="--log-format console --ingress-url tekton-dashboard.127.0.0.1.nip.io"
DEFAULT_OPTIONS="--log-format console"
ENABLE_INGRESS="false"

create_cluster() {
kind create cluster --name $CLUSTERNAME --config - <<EOF
if [ "$ENABLE_INGRESS" == "false" ]; then
kind create cluster --name $CLUSTERNAME
else
kind create cluster --name $CLUSTERNAME --config - <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
Expand All @@ -36,6 +40,7 @@ nodes:
hostPort: 443
protocol: TCP
EOF
fi
}

# Display a box banner.
Expand Down Expand Up @@ -86,11 +91,19 @@ case $1 in
'create'|c)
shift
create_cluster
install_ingress_nginx
install_pipelines
install_triggers
install_dashboard $@
;;
'create-with-ingress'|i)
shift
ENABLE_INGRESS="true"
create_cluster
install_ingress_nginx
install_pipelines
install_triggers
install_dashboard --ingress-url tekton-dashboard.127.0.0.1.nip.io $@
;;
'update'|u)
shift
install_dashboard $@
Expand Down

0 comments on commit eed725c

Please sign in to comment.