Skip to content

Commit

Permalink
Enable registry by default
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Nov 4, 2020
1 parent 3869d70 commit fb79ea6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,36 @@ jobs:
kubectl cluster-info
kubectl get storageclass standard
test-without-registry:
strategy:
matrix:
version:
- v0.9.0
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster with custom name
uses: ./
with:
version: "${{ matrix.version }}"
cluster_name: "custom-name"
registry: false

- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
registry_id=$(docker ps --filter "name=kind-registry" --format "{{.ID}}")
if [[ -n "$registry_id" ]]; then
echo "Registry present"
exit 1
fi
test-with-registry:
strategy:
matrix:
Expand All @@ -60,7 +90,6 @@ jobs:
uses: ./
with:
version: "${{ matrix.version }}"
registry: true

- name: Test
run: |
Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Kubernetes KinD Action
# Kubernetes KinD Cluster Action

[![](https://github.com/container-tools/kind-action/workflows/Test/badge.svg?branch=main)](https://github.com/container-tools/kind-action/actions)

A GitHub Action for starting a Kubernetes cluster using [KinD](https://kind.sigs.k8s.io/).
A GitHub Action for starting a Kubernetes cluster with a local registry using [KinD](https://kind.sigs.k8s.io/).

This action provides an optional insecure registry on `kind-registry:5000` that can be used to publish and deploy container images into KinD.
This action provides an insecure registry on `kind-registry:5000` by default: it can be used to publish and deploy container images into KinD.

## Usage

Expand All @@ -23,7 +23,7 @@ For more information on inputs, see the [API Documentation](https://developer.gi
- `cluster_name`: The name of the cluster to create (default: `kind`)
- `wait`: The duration to wait for the control plane to become ready (default: `60s`)
- `log_level`: The log level for KinD
- `registry`: Configures an insecure registry on `kind-registry:5000` to be used with KinD (default: `false`)
- `registry`: Configures an insecure registry on `kind-registry:5000` to be used with KinD (default: `true`)

### Example Workflow

Expand All @@ -38,18 +38,15 @@ jobs:
create-cluster:
runs-on: ubuntu-latest
steps:
- name: Create k8s KinD Cluster
uses: container-tools/[email protected]
with:
registry: true
- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1
```
This uses [@container-tools/kind-action](https://www.github.com/container-tools/kind-action) GitHub Action to spin up a [KinD](https://kind.sigs.k8s.io/) Kubernetes cluster on every Pull Request.
The `registry: true` option also enables a container registry on `kind-registry:5000` on both the host and the cluster.
A container registry will be created with address `kind-registry:5000` on both the host and the cluster.
The registry address is stored in the `KIND_REGISTRY` environment variable, also for the subsequent steps.


## Credits

This action leverages the good work done by the Helm community on [@helm/kind-action](https://www.github.com/helm/kind-action).
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inputs:
log_level:
description: "The log level for KinD"
registry:
description: "Configures an insecure registry on kind-registry:5000 to be used with KinD (default: false)"
description: "Configures an insecure registry on kind-registry:5000 to be used with KinD (default: true)"
runs:
using: "node12"
main: "main.js"
Expand Down
4 changes: 2 additions & 2 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ main() {
fi


if [[ -n "${INPUT_REGISTRY:-}" ]] && [[ "${INPUT_REGISTRY,,}" = "true" ]]; then
if [[ -z "${INPUT_REGISTRY:-}" ]] || [[ "${INPUT_REGISTRY,,}" = "true" ]]; then
"$SCRIPT_DIR/registry.sh" "${args[@]}"

if [[ -n "${INPUT_CONFIG:-}" ]]; then
Expand All @@ -58,7 +58,7 @@ main() {

"$SCRIPT_DIR/kind.sh" "${args[@]}"

if [[ -n "${INPUT_REGISTRY:-}" ]] && [[ "${INPUT_REGISTRY,,}" = "true" ]]; then
if [[ -z "${INPUT_REGISTRY:-}" ]] || [[ "${INPUT_REGISTRY,,}" = "true" ]]; then
"$SCRIPT_DIR/registry.sh" "--document" "true" "${args[@]}"
fi
}
Expand Down

0 comments on commit fb79ea6

Please sign in to comment.