Skip to content

Commit 9c450d2

Browse files
committed
Some fixes/improvements for KIND
Signed-off-by: Alvaro Saurin <[email protected]>
1 parent b8dbcfb commit 9c450d2

File tree

2 files changed

+212
-6
lines changed

2 files changed

+212
-6
lines changed

deploy/third-party/kind/README.md

+97
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,100 @@ Integration with KIND is achieved by
55
- not using any specific version of Ambassador (so it will always install the latest one).
66
- not specifying an update window.
77
- installing the OSS version of Ambassador.
8+
9+
## Testing
10+
11+
First install the CRDs with
12+
13+
```commandline
14+
kubectl apply -f https://github.com/datawire/ambassador-operator/releases/latest/download/ambassador-operator-crds.yaml
15+
```
16+
17+
Now install the kind-specific manifest for installing Ambassador OSS with the
18+
operator in the `ambassador` namespace:
19+
20+
```commandline
21+
kubectl apply -n ambassador -f https://github.com/datawire/ambassador-operator/releases/latest/download/ambassador-operator-kind.yaml
22+
```
23+
24+
You can load the following example application and `Ingress`:
25+
26+
```commandline
27+
$ cat <<EOF | kubectl apply -f -
28+
kind: Pod
29+
apiVersion: v1
30+
metadata:
31+
name: foo-app
32+
labels:
33+
app: foo
34+
spec:
35+
containers:
36+
- name: foo-app
37+
image: hashicorp/http-echo
38+
args:
39+
- "-text=foo"
40+
---
41+
kind: Service
42+
apiVersion: v1
43+
metadata:
44+
name: foo-service
45+
spec:
46+
selector:
47+
app: foo
48+
ports:
49+
# Default port used by the image
50+
- port: 5678
51+
---
52+
kind: Pod
53+
apiVersion: v1
54+
metadata:
55+
name: bar-app
56+
labels:
57+
app: bar
58+
spec:
59+
containers:
60+
- name: bar-app
61+
image: hashicorp/http-echo
62+
args:
63+
- "-text=bar"
64+
---
65+
kind: Service
66+
apiVersion: v1
67+
metadata:
68+
name: bar-service
69+
spec:
70+
selector:
71+
app: bar
72+
ports:
73+
# Default port used by the image
74+
- port: 5678
75+
---
76+
apiVersion: extensions/v1beta1
77+
kind: Ingress
78+
metadata:
79+
name: example-ingress
80+
annotations:
81+
kubernetes.io/ingress.class: ambassador
82+
spec:
83+
rules:
84+
- http:
85+
paths:
86+
- path: /foo
87+
backend:
88+
serviceName: foo-service
89+
servicePort: 5678
90+
- path: /bar
91+
backend:
92+
serviceName: bar-service
93+
servicePort: 5678
94+
```
95+
96+
Now verify that the ingress works
97+
98+
```commandline
99+
$ curl localhost/bar
100+
bar
101+
$ curl localhost/foo
102+
foo
103+
```
104+

deploy/third-party/kind/ambassadorinstallation.yaml

+115-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,121 @@ spec:
88
helmValues:
99
deploymentTool: amb-oper-kind
1010
replicaCount: 1
11+
nodeSelector:
12+
ingress-ready: "true"
1113
service:
1214
type: NodePort
1315
ports:
14-
- name: http
15-
port: 80
16-
targetPort: 8080
17-
- name: https
18-
port: 443
19-
targetPort: 8443
16+
- name: http
17+
port: 80
18+
targetPort: 8080
19+
protocol: TCP
20+
- name: https
21+
port: 443
22+
targetPort: 8443
23+
protocol: TCP
24+
---
25+
apiVersion: v1
26+
kind: ServiceAccount
27+
metadata:
28+
name: klipper-lb
29+
---
30+
apiVersion: rbac.authorization.k8s.io/v1
31+
kind: ClusterRole
32+
metadata:
33+
name: klipper-permissions
34+
rules:
35+
- apiGroups: [""]
36+
resources: ["nodes"]
37+
verbs: ["get", "watch", "list"]
38+
- apiGroups: [""]
39+
resources: ["services"]
40+
verbs: ["get", "watch", "list", "write", "patch"]
41+
---
42+
apiVersion: rbac.authorization.k8s.io/v1
43+
kind: ClusterRoleBinding
44+
metadata:
45+
name: klipper-permissions-binding
46+
subjects:
47+
- kind: ServiceAccount
48+
name: klipper-lb
49+
namespace: kube-system
50+
roleRef:
51+
apiGroup: rbac.authorization.k8s.io
52+
kind: ClusterRole
53+
name: klipper-permissions
54+
---
55+
apiVersion: apps/v1
56+
kind: DaemonSet
57+
metadata:
58+
name: svclb-klipper
59+
spec:
60+
revisionHistoryLimit: 10
61+
selector:
62+
matchLabels:
63+
app: svclb-klipper
64+
template:
65+
metadata:
66+
creationTimestamp: null
67+
labels:
68+
app: svclb-klipper
69+
spec:
70+
serviceAccountName: klipper-lb
71+
containers:
72+
- env:
73+
- name: SRC_PORT
74+
value: "80"
75+
- name: DEST_PROTO
76+
value: TCP
77+
- name: DEST_PORT
78+
value: "80"
79+
- name: DEST_ADDR
80+
value: "ambassador.ambassador"
81+
image: inercia/klipper-lb:latest
82+
imagePullPolicy: Always
83+
name: lb-port-80
84+
ports:
85+
- containerPort: 80
86+
hostPort: 80
87+
name: lb-port-80
88+
protocol: TCP
89+
resources: {}
90+
securityContext:
91+
capabilities:
92+
add:
93+
- NET_ADMIN
94+
terminationMessagePath: /dev/termination-log
95+
terminationMessagePolicy: File
96+
- env:
97+
- name: SRC_PORT
98+
value: "443"
99+
- name: DEST_PROTO
100+
value: TCP
101+
- name: DEST_PORT
102+
value: "443"
103+
- name: DEST_ADDR
104+
value: "ambassador.ambassador"
105+
image: inercia/klipper-lb:latest
106+
imagePullPolicy: Always
107+
name: lb-port-443
108+
ports:
109+
- containerPort: 443
110+
hostPort: 443
111+
name: lb-port-443
112+
protocol: TCP
113+
resources: {}
114+
securityContext:
115+
capabilities:
116+
add:
117+
- NET_ADMIN
118+
terminationMessagePath: /dev/termination-log
119+
terminationMessagePolicy: File
120+
dnsPolicy: ClusterFirst
121+
restartPolicy: Always
122+
schedulerName: default-scheduler
123+
securityContext: {}
124+
terminationGracePeriodSeconds: 30
125+
updateStrategy:
126+
rollingUpdate:
127+
maxUnavailable: 1
128+
type: RollingUpdate

0 commit comments

Comments
 (0)