Skip to content

Commit

Permalink
Add app behind hangar.concourse-ci.org
Browse files Browse the repository at this point in the history
This is an nginx server that does a redirect to a zoom room used by the
team for meetings like: standup, retro, everyone is wfh because covid-19

You may wonder: why do the redirect with an html page? You can do HTTP
301 redirect with just nginx redirect rules.

and you would be correct! But then other people's opinions get pushed
onto you and you have to do hacky things to get around it.

tldr: the ingress comes with a health checker that is not smart. See
kubernetes/ingress-gce#42 for more details.

Longer answer: The ingress used by GKE setups a health check that ONLY
hits '/' against your pod. Because my initial nginx.conf just did 301
redirects this healthcheck was forever failing because it would never
get HTTP 200. I tried to get around this by having nginx listen on
another port for health checking and always return HTTP 200 on that
port. I then had to expose both ports to the ingress controller. The
ingress controller decided to healthcheck BOTH ports that were exposed
on the container and send all traffic to port 9000 where it was getting
the HTTP 200's. At this point I threw my hands up and wrote some HTML to
do the redirect for me.

Signed-off-by: Taylor Silva <tsilva@pivotal.io>
  • Loading branch information
taylorsilva committed Mar 14, 2020
1 parent 16424b7 commit 5de1009
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
22 changes: 22 additions & 0 deletions deployments/without-creds/hangar/configmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
data:
nginx.conf: |
events {
}
http {
server {
listen 8000;
root /data/www;
location / {
try_files '' /redirect.html =404;
}
}
}
redirect.html: |
<head>
<meta http-equiv="Refresh" content="0; URL=https://pivotal.zoom.us/j/109775612">
</head>
metadata:
name: nginx-conf
30 changes: 30 additions & 0 deletions deployments/without-creds/hangar/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: hangar-deployment
labels:
app: hangar
spec:
replicas: 1
selector:
matchLabels:
app: hangar
template:
metadata:
labels:
app: hangar
spec:
containers:
- name: hangar
image: nginx
ports:
- containerPort: 8000
volumeMounts:
- mountPath: /etc/nginx/
name: nginx-config
- mountPath: /data/www/
name: nginx-config
volumes:
- name: nginx-config
configMap:
name: nginx-conf
10 changes: 10 additions & 0 deletions deployments/without-creds/hangar/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: hangar-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: "hangar-static-ip"
spec:
backend:
serviceName: hangar
servicePort: 80
12 changes: 12 additions & 0 deletions deployments/without-creds/hangar/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: hangar
spec:
type: NodePort
selector:
app: hangar
ports:
- protocol: TCP
port: 80
targetPort: 8000

0 comments on commit 5de1009

Please sign in to comment.