tests - add kubernetes-configs and fix missing s in urls

This commit is contained in:
bunkerity 2022-07-21 13:59:19 +02:00
parent 06f7fb096e
commit b38f7c54e6
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
7 changed files with 251 additions and 212 deletions

View File

@ -7,7 +7,7 @@
"tests": [
{
"type": "string",
"url": "http://www.example.com",
"url": "https://www.example.com",
"string": "hello"
}
]

View File

@ -7,22 +7,22 @@
"tests": [
{
"type": "string",
"url": "http://app1.example.com/hello",
"url": "https://app1.example.com/hello",
"string": "world"
},
{
"type": "string",
"url": "http://app2.example.com/hello",
"url": "https://app2.example.com/hello",
"string": "world"
},
{
"type": "string",
"url": "http://app1.example.com/app1",
"url": "https://app1.example.com/app1",
"string": "app1"
},
{
"type": "string",
"url": "http://app2.example.com/app2",
"url": "https://app2.example.com/app2",
"string": "app2"
}
]

View File

@ -1,101 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: app1
labels:
app: app1
spec:
replicas: 1
selector:
matchLabels:
app: app1
template:
metadata:
labels:
app: app1
spec:
containers:
- name: app1
image: tutum/hello-world
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app2
labels:
app: app2
spec:
replicas: 1
selector:
matchLabels:
app: app2
template:
metadata:
labels:
app: app2
spec:
containers:
- name: app2
image: tutum/hello-world
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app3
labels:
app: app3
spec:
replicas: 1
selector:
matchLabels:
app: app3
template:
metadata:
labels:
app: app3
spec:
containers:
- name: app3
image: tutum/hello-world
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: svc-app1
spec:
selector:
app: app1
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: svc-app2
spec:
selector:
app: app2
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: svc-app3
spec:
selector:
app: app3
ports:
- protocol: TCP
port: 80
targetPort: 80

View File

@ -1,66 +0,0 @@
# you don't even need to mount the config as volumes : a declaration is enough, the controller will take care of the rest
# bunkerweb.io/CONFIG_TYPE accepted values are http, stream, server-http, server-stream, default-server-http, modsec and modsec-crs
# bunkerweb.io/CONFIG_SITE lets you choose on which web service the config should be applied (MULTISITE mode) and if it's not set, the config will be applied for all services
# more info at https://docs.bunkerweb.io
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-all-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
data:
myconf: |
location /hello {
default_type "text/plain";
content_by_lua_block {
ngx.say("hello")
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-app1-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
bunkerweb.io/CONFIG_SITE: "app1.example.com"
data:
myconf: |
location /app1 {
default_type "text/plain";
content_by_lua_block {
ngx.say("app1")
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-app2-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
bunkerweb.io/SERVER_NAME: "app2.example.com"
data:
myconf: |
location /app2 {
default_type "text/plain";
content_by_lua_block {
ngx.say("app2")
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-app3-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
bunkerweb.io/SERVER_NAME: "app3.example.com"
data:
myconf: |
location /app3 {
default_type "text/plain";
content_by_lua_block {
ngx.say("app3")
}
}

View File

@ -1,40 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
bunkerweb.io/AUTOCONF: "yes"
bunkerweb.io/AUTO_LETS_ENCRYPT: "yes"
bunkerweb.io/USE_LETS_ENCRYPT_STAGING: "yes"
spec:
rules:
- host: app1.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-app1
port:
number: 80
- host: app2.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-app2
port:
number: 80
- host: app3.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-app3
port:
number: 80

View File

@ -0,0 +1,207 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
bunkerweb.io/AUTO_LETS_ENCRYPT: "yes"
spec:
rules:
- host: app1.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-app1
port:
number: 80
- host: app2.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-app2
port:
number: 80
- host: app3.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-app3
port:
number: 80
---
# you don't even need to mount the config as volumes : a declaration is enough, the controller will take care of the rest
# bunkerweb.io/CONFIG_TYPE accepted values are http, stream, server-http, server-stream, default-server-http, modsec and modsec-crs
# bunkerweb.io/CONFIG_SITE lets you choose on which web service the config should be applied (MULTISITE mode) and if it's not set, the config will be applied for all services
# more info at https://docs.bunkerweb.io
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-all-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
data:
myconf: |
location /hello {
default_type "text/plain";
content_by_lua_block {
ngx.say("hello")
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-app1-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
bunkerweb.io/CONFIG_SITE: "app1.example.com"
data:
myconf: |
location /app1 {
default_type "text/plain";
content_by_lua_block {
ngx.say("app1")
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-app2-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
bunkerweb.io/SERVER_NAME: "app2.example.com"
data:
myconf: |
location /app2 {
default_type "text/plain";
content_by_lua_block {
ngx.say("app2")
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg-bunkerweb-app3-server-http
annotations:
bunkerweb.io/CONFIG_TYPE: "server-http"
bunkerweb.io/SERVER_NAME: "app3.example.com"
data:
myconf: |
location /app3 {
default_type "text/plain";
content_by_lua_block {
ngx.say("app3")
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app1
labels:
app: app1
spec:
replicas: 1
selector:
matchLabels:
app: app1
template:
metadata:
labels:
app: app1
spec:
containers:
- name: app1
image: tutum/hello-world
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app2
labels:
app: app2
spec:
replicas: 1
selector:
matchLabels:
app: app2
template:
metadata:
labels:
app: app2
spec:
containers:
- name: app2
image: tutum/hello-world
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app3
labels:
app: app3
spec:
replicas: 1
selector:
matchLabels:
app: app3
template:
metadata:
labels:
app: app3
spec:
containers:
- name: app3
image: tutum/hello-world
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: svc-app1
spec:
selector:
app: app1
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: svc-app2
spec:
selector:
app: app2
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: svc-app3
spec:
selector:
app: app3
ports:
- protocol: TCP
port: 80
targetPort: 80

View File

@ -0,0 +1,39 @@
{
"name": "kubernetes-configs",
"kinds": [
"kubernetes"
],
"timeout": 60,
"tests": [
{
"type": "string",
"url": "https://app1.example.com/hello",
"string": "hello"
},
{
"type": "string",
"url": "https://app2.example.com/hello",
"string": "hello"
},
{
"type": "string",
"url": "https://app3.example.com/hello",
"string": "hello"
},
{
"type": "string",
"url": "https://app1.example.com/app1",
"string": "app1"
},
{
"type": "string",
"url": "https://app2.example.com/app2",
"string": "app2"
},
{
"type": "string",
"url": "https://app3.example.com/app3",
"string": "app3"
}
]
}