init
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
__pycache__
|
||||
venv
|
||||
12
certificate.yaml
Normal file
12
certificate.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: cert-manager.io/v1alpha3
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: test-redis
|
||||
spec:
|
||||
dnsNames:
|
||||
- test-redis.endofeternity.ca
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
kind: ClusterIssuer
|
||||
name: letsencrypt-prod
|
||||
secretName: test-redis-tls-certificate
|
||||
46
deployment.yaml
Normal file
46
deployment.yaml
Normal file
@@ -0,0 +1,46 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-redis
|
||||
labels:
|
||||
app: test-redis
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-redis
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-redis
|
||||
spec:
|
||||
containers:
|
||||
- name: test-redis
|
||||
image: aarch64/redis
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-redis-http
|
||||
labels:
|
||||
app: test-redis-http
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-redis-http
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-redis-http
|
||||
spec:
|
||||
containers:
|
||||
- name: test-redis-http
|
||||
image: docker.endofeternity.ca/test-redis-http:v2
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: test-redis-http
|
||||
protocol: TCP
|
||||
|
||||
20
ingress.yaml
Normal file
20
ingress.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: test-redis
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
certmanager.io/cluster-issuer: letsencrypt-prod
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- test-redis.endofeternity.ca
|
||||
secretName: test-redis-tls-certificate
|
||||
rules:
|
||||
- host: test-redis.endofeternity.ca
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: test-redis-http
|
||||
servicePort: 80
|
||||
path: /
|
||||
25
service.yaml
Normal file
25
service.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-redis
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: redis
|
||||
port: 6379
|
||||
targetPort: 6379
|
||||
selector:
|
||||
app: test-redis
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-redis-http
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8000
|
||||
selector:
|
||||
app: test-redis-http
|
||||
12
src/Dockerfile
Normal file
12
src/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM python:3.7-alpine
|
||||
|
||||
COPY requirements.txt /
|
||||
|
||||
RUN pip install -r /requirements.txt
|
||||
|
||||
COPY app.py app/app.py
|
||||
WORKDIR /app
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["gunicorn", "-b 0.0.0.0:8000", "-w 4", "app:app"]
|
||||
20
src/app.py
Normal file
20
src/app.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from flask import Flask
|
||||
import os
|
||||
import redis
|
||||
app = Flask(__name__)
|
||||
redis_host = 'test-redis'
|
||||
print("Redis host %s", redis_host)
|
||||
r = redis.Redis(host=redis_host, port=6379, db=0)
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
return "Hello There, World!"
|
||||
|
||||
@app.route('/<name>')
|
||||
def hello_stranger(name=None):
|
||||
times = r.incr(name)
|
||||
return "Hello, %s! You have visited %s times.\n\n%s" % (name, times, os.environ['HOSTNAME'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
||||
8
src/requirements.txt
Normal file
8
src/requirements.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
click==7.1.2
|
||||
Flask==1.1.2
|
||||
gunicorn==20.0.4
|
||||
itsdangerous==1.1.0
|
||||
Jinja2==2.11.2
|
||||
MarkupSafe==1.1.1
|
||||
redis==3.5.3
|
||||
Werkzeug==1.0.1
|
||||
16
voyager-ingress.yaml
Normal file
16
voyager-ingress.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: voyager.appscode.com/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: test-ingress
|
||||
namespace: default
|
||||
annotations:
|
||||
ingress.appscode.com/type: LoadBalancer
|
||||
spec:
|
||||
rules:
|
||||
- host: test-redis.endofeternity.ca
|
||||
http:
|
||||
paths:
|
||||
- path: '/'
|
||||
backend:
|
||||
serviceName: test-redis-http
|
||||
servicePort: '80'
|
||||
Reference in New Issue
Block a user