Compare commits
2 Commits
38f3c2e233
...
10a66188e3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10a66188e3 | ||
|
|
f590e102c7 |
8
Makefile
8
Makefile
@@ -9,7 +9,7 @@ OPERATOR_SDK_VERSION ?= v1.41.1
|
|||||||
CONTAINER_TOOL ?= docker
|
CONTAINER_TOOL ?= docker
|
||||||
|
|
||||||
# Image URL to use all building/pushing image targets
|
# Image URL to use all building/pushing image targets
|
||||||
IMG ?= controller:latest
|
IMG ?= ${IMAGE_TAG_BASE}:dev
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: docker-build
|
all: docker-build
|
||||||
@@ -127,4 +127,8 @@ ifeq (, $(shell which operator-sdk 2>/dev/null))
|
|||||||
else
|
else
|
||||||
OPERATOR_SDK = $(shell which operator-sdk)
|
OPERATOR_SDK = $(shell which operator-sdk)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
.PHONY: dev
|
||||||
|
dev: operator-sdk ## Run the controller locally against the configured Kubernetes cluster in ~/.kube/config.
|
||||||
|
$(OPERATOR_SDK) run --local
|
||||||
22
README.md
Normal file
22
README.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Local Testing
|
||||||
|
|
||||||
|
## Kind
|
||||||
|
To create a local Kubernetes cluster using [Kind](https://kind.sigs.k8s.io/) you will need the following installed:
|
||||||
|
- [Docker](https://docs.docker.com/get-docker/) or any container runtime probably
|
||||||
|
- [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
|
||||||
|
- [cloud-provider-kind](https://github.com/kubernetes-sigs/cloud-provider-kind)
|
||||||
|
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
|
||||||
|
|
||||||
|
Scripts:
|
||||||
|
- `kind/create.sh`
|
||||||
|
- creates a Kind cluster and sets up the gateway
|
||||||
|
- build and deploy ontime-operator into cluster
|
||||||
|
- deploy the sample stage
|
||||||
|
- start `cloud-provider-kind`
|
||||||
|
- `kind/delete.sh` - deletes the Kind cluster
|
||||||
|
|
||||||
|
To get the gateway IP address run `kubectl get gateway -n kube-system` the output will look something like this:
|
||||||
|
```
|
||||||
|
NAMESPACE NAME CLASS ADDRESS PROGRAMMED AGE
|
||||||
|
kube-system gateway cloud-provider-kind 172.18.0.5 True 23s
|
||||||
|
```
|
||||||
@@ -3,6 +3,10 @@ kind: Stage
|
|||||||
metadata:
|
metadata:
|
||||||
name: stage-sample
|
name: stage-sample
|
||||||
spec:
|
spec:
|
||||||
|
gateway:
|
||||||
|
name: gateway
|
||||||
|
namespace: kube-system
|
||||||
|
sectionName: default
|
||||||
ontime:
|
ontime:
|
||||||
timezone: "America/Chicago"
|
timezone: "America/Chicago"
|
||||||
prefix: "test"
|
prefix: "test"
|
||||||
|
|||||||
7
kind/config.yaml
Normal file
7
kind/config.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Cluster
|
||||||
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
|
name: ontime-operator
|
||||||
|
nodes:
|
||||||
|
- role: control-plane
|
||||||
|
- role: worker
|
||||||
|
- role: worker
|
||||||
12
kind/create.sh
Executable file
12
kind/create.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
|
||||||
|
ROOT=$(realpath "$SCRIPT_DIR/..")
|
||||||
|
set -e
|
||||||
|
kind create cluster --config "$SCRIPT_DIR/config.yaml"
|
||||||
|
kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.0/standard-install.yaml
|
||||||
|
kubectl apply -f "$SCRIPT_DIR/manifests"
|
||||||
|
export IMG=ontime-operator:dev
|
||||||
|
make -C "$ROOT" docker-build
|
||||||
|
kind load docker-image --name ontime-operator "${IMG}"
|
||||||
|
make -C "$ROOT" deploy
|
||||||
|
kubectl apply -k "$ROOT/config/samples"
|
||||||
|
sudo cloud-provider-kind
|
||||||
1
kind/delete.sh
Executable file
1
kind/delete.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
kind delete cluster --name ontime-operator
|
||||||
14
kind/manifests/gateway.yaml
Normal file
14
kind/manifests/gateway.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: Gateway
|
||||||
|
metadata:
|
||||||
|
name: gateway
|
||||||
|
namespace: kube-system
|
||||||
|
spec:
|
||||||
|
gatewayClassName: cloud-provider-kind
|
||||||
|
listeners:
|
||||||
|
- name: default
|
||||||
|
port: 80
|
||||||
|
protocol: HTTP
|
||||||
|
allowedRoutes:
|
||||||
|
namespaces:
|
||||||
|
from: All
|
||||||
Reference in New Issue
Block a user