Skip to content

Commit

Permalink
Merge pull request #74 from ori-edge/tilt-changes
Browse files Browse the repository at this point in the history
Moving tilt to use helm instead of static yaml
  • Loading branch information
networkop authored Jan 23, 2022
2 parents d68ea4a + dcab275 commit a5184d1
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 14,423 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.2
# nginxinc's VirtualServer
$ dig @$ip -p 32553 virtualservera.foo.org +short
198.51.100.2
```

To cleanup local environment do:
Expand Down
46 changes: 40 additions & 6 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load('ext://restart_process', 'docker_build_with_restart')
load('ext://helm_remote', 'helm_remote')

IMG = 'localhost:5000/coredns'

Expand All @@ -20,21 +21,54 @@ docker_build_with_restart(IMG, '.',
k8s_kind("kind")

# CoreDNS with updated RBAC
k8s_yaml('./test/kubernetes.yaml')
k8s_yaml(helm(
'./charts/k8s-gateway',
namespace="kube-system",
name='excoredns',
values=['./test/k8s-gateway-values.yaml'],
)
)

# Baremetal ingress controller (nodeport-based)
k8s_yaml('./test/ingress.yaml')
helm_remote('ingress-nginx',
version="4.0.15",
repo_name='ingress-nginx',
set=['controller.admissionWebhooks.enabled=false'],
repo_url='https://kubernetes.github.io/ingress-nginx')

# Backend deployment for testing
k8s_yaml('./test/backend.yml')

# Metallb
k8s_yaml('./test/metallb.yaml')
helm_remote('metallb',
version="0.11.0",
repo_name='metallb',
values=['./test/metallb-values.yaml'],
repo_url='https://metallb.github.io/metallb')

# Nginxinc kubernetes-ingress
k8s_kind('VirtualServer', api_version='k8s.nginx.org/v1')
k8s_yaml('./test/nginx-kubernetes-ingress/resources.yaml')
k8s_yaml('./test/nginx-kubernetes-ingress/ingress.yaml')
helm_remote('nginx-ingress',
version="0.12.0",
release_name="nginxinc",
repo_name='nginx-stable',
values=['./test/nginxinc-kubernetes-ingress/values.yaml'],
repo_url='https://helm.nginx.com/stable')


# Gateway API
k8s_kind('HTTPRoute', api_version='gateway.networking.k8s.io/v1alpha2')
k8s_kind('Gateway', api_version='gateway.networking.k8s.io/v1alpha2')
k8s_yaml('./test/gateway-api/crds.yml')
k8s_yaml('./test/gateway-api/istio.yml')


helm_remote('istiod',
version="1.12.1",
repo_name='istio',
set=['global.istioNamespace=default', 'base.enableIstioConfigCRDs=false', 'telemetry.enabled=false'],
repo_url='https://istio-release.storage.googleapis.com/charts')
helm_remote('gateway',
version="1.12.1",
repo_name='istio',
namespace='default',
repo_url='https://istio-release.storage.googleapis.com/charts')
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: [email protected]
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
38 changes: 38 additions & 0 deletions test/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: backend
name: backend
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx

---
apiVersion: v1
kind: Service
metadata:
name: backend
namespace: default
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: backend
sessionAffinity: None
type: ClusterIP
Loading

0 comments on commit a5184d1

Please sign in to comment.