Skip to content

Commit

Permalink
tested & updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
networkop committed Jan 16, 2022
1 parent fe805b5 commit 31f8842
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 144 deletions.
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ This repository contains a [Tiltfile](https://tilt.dev/) that can be used for lo
make setup
```

To bind up a tilt development enviornment do:
To bring up a tilt development enviornment run `tilt up` or:

```
make up
Expand All @@ -162,25 +162,46 @@ Some test resources can be added to the k8s cluster with:

```
# ingress and service resources
kubectl apply -f ./test/test.yml
kubectl apply -f ./test/ingress-services.yml
# gateway API resources
kubectl apply -f ./test/gateway-api/resources.yml
# nginxinc's VirtualService resources
kubectl apply -f test/nginxinc-kubernetes-ingress/resources.yaml
```

Test queries can be sent to the exposed CoreDNS service like this:

```
$ ip=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}')
# ingress resource
$ dig @$ip -p 32553 myservicea.foo.org +short
192.168.224.2
198.51.100.0
# loadBalancer
$ dig @$ip -p 32553 test.default.foo.org +short
192.168.223.129
198.51.100.3
# HTTPRoute/gateway-API
$ dig @$ip -p 32553 myservicea.gw.foo.org +short
192.168.223.130
198.51.100.4
$ dig @$ip -p 32553 myserviceb.gw.foo.org +short
198.51.100.4
# multi-gateway HTTPRoute
$ dig @$ip -p 32553 myserviced.gw.foo.org +short
192.168.223.130
192.168.223.131
198.51.100.5
198.51.100.4
# nginxinc's Ingress
$ dig @$ip -p 32553 myserviceb.foo.org +short
198.51.100.1
# nginxinc's VirtualServer
$ dig @$ip -p 32553 virtualservera.foo.org +short
198.51.100.1
```

To cleanup local environment do:
Expand Down
3 changes: 2 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ helm_remote('metallb',
k8s_kind('VirtualServer', api_version='k8s.nginx.org/v1')
helm_remote('nginx-ingress',
version="0.12.0",
release_name="nginxinc",
repo_name='nginx-stable',
values=['./test/nginx-kubernetes-ingress/values.yaml'],
values=['./test/nginxinc-kubernetes-ingress/values.yaml'],
repo_url='https://helm.nginx.com/stable')


Expand Down
4 changes: 2 additions & 2 deletions charts/k8s-gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: k8s-gateway
description: A Helm chart for the k8s_gateway CoreDNS plugin
type: application
version: 1.1.1
appVersion: 0.2.1
version: 1.1.2
appVersion: 0.2.2
maintainers:
- email: mmkashin@gmail.com
name: Michael
3 changes: 3 additions & 0 deletions charts/k8s-gateway/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ rules:
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["*"]
verbs: ["watch", "list"]
- apiGroups: ["k8s.nginx.org"]
resources: ["*"]
verbs: ["watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
40 changes: 20 additions & 20 deletions test/gateway-api/resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: gateway
name: gateway-one
namespace: default
spec:
gatewayClassName: "istio"
listeners:
- name: default
hostname: "*.gw.foo.org"
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: gateway-two
namespace: default
spec:
gatewayClassName: "istio"
Expand All @@ -22,7 +38,7 @@ metadata:
namespace: default
spec:
parentRefs:
- name: gateway
- name: gateway-one
hostnames: ["myservicea.gw.foo.org"]
rules:
- matches:
Expand All @@ -41,7 +57,7 @@ metadata:
namespace: kube-system
spec:
parentRefs:
- name: gateway
- name: gateway-one
namespace: default
hostnames: ["myserviceb.gw.foo.org"]
rules:
Expand Down Expand Up @@ -74,29 +90,13 @@ spec:
port: 80
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: gateway-two
namespace: default
spec:
gatewayClassName: "istio"
listeners:
- name: default
hostname: "*.gw.foo.org"
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: myserviced
namespace: default
spec:
parentRefs:
- name: gateway
- name: gateway-one
- name: gateway-two
hostnames: ["myserviced.gw.foo.org"]
rules:
Expand Down
19 changes: 0 additions & 19 deletions test/ingress-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,6 @@ spec:
port:
number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-myserviceb
namespace: default
spec:
ingressClassName: nginx
rules:
- host: myserviceb.foo.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ingress
port:
number: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
95 changes: 0 additions & 95 deletions test/nginxinc-kubernetes-ingress/resources.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-nginx-test-a
namespace: default
spec:
ingressClassName: nginxinc
rules:
- host: myservicea.foo.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-test-a
port:
number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-nginx-test-b
namespace: default
Expand Down Expand Up @@ -47,79 +28,3 @@ spec:
- name: nginx-test-a
service: nginx-test-a
port: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx-test-a
name: nginx-test-a
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx-test-a
template:
metadata:
labels:
app: nginx-test-a
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx-test-a
namespace: default
spec:
ports:
- name: http-80
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx-test-a
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: nginx-test-b
namespace: default
spec:
ports:
- name: http-80
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx-test-b
sessionAffinity: None
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx-test-b
name: nginx-test-b
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx-test-b
template:
metadata:
labels:
app: nginx-test-b
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx

0 comments on commit 31f8842

Please sign in to comment.