Initial commit
This commit is contained in:
commit
5f3ccc3df4
|
@ -0,0 +1,6 @@
|
||||||
|
apiVersion: v2
|
||||||
|
name: logmower-operator
|
||||||
|
description: Helm chart for oidc-operator
|
||||||
|
type: application
|
||||||
|
version: 0.1.0
|
||||||
|
appVersion: 0.0.1
|
|
@ -0,0 +1,8 @@
|
||||||
|
FROM python:alpine
|
||||||
|
RUN pip3 install flask
|
||||||
|
LABEL name="codemowers/hello-helm" \
|
||||||
|
version="rc" \
|
||||||
|
maintainer="Lauri Võsandi <lauri@codemowers.io>"
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ADD app /app
|
||||||
|
ENTRYPOINT /app/app.py
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Lauri Võsandi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Hello cloud native Flask
|
||||||
|
|
||||||
|
In this example skeleton Flask application is provided with Prometheus
|
||||||
|
metrics endpoint.
|
||||||
|
|
||||||
|
Steps to take with this repository:
|
||||||
|
|
||||||
|
* Fork this repository to your personal GitHub
|
||||||
|
* Clone the forked repository to your machine
|
||||||
|
* Obtain sandbox environment from https://dashboard.codemowers.eu/
|
||||||
|
* Follow the instructions on the page regarding `~/.kube/config` reconfiguration
|
||||||
|
* Execute the `skaffold dev ...` command provided on the sandbox detailed view
|
||||||
|
page to build and deploy the application in the remote cluster sandbox
|
||||||
|
* Proceed to build your awesome Flask application
|
||||||
|
|
||||||
|
# Building and running locally
|
||||||
|
|
||||||
|
With vanilla Docker
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build . -t hello-flask:latest
|
||||||
|
docker run --network host -it hello-flask:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
With `docker-compose`:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose up --build
|
||||||
|
```
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
|
_, greeting = sys.argv
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
return "%s" % greeting
|
||||||
|
|
||||||
|
|
||||||
|
app.run(host="0.0.0.0", port=8000)
|
|
@ -0,0 +1,6 @@
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
network_mode: host
|
||||||
|
build:
|
||||||
|
context: .
|
|
@ -0,0 +1,21 @@
|
||||||
|
apiVersion: skaffold/v3
|
||||||
|
kind: Config
|
||||||
|
metadata:
|
||||||
|
name: hello-flask
|
||||||
|
|
||||||
|
build:
|
||||||
|
cluster:
|
||||||
|
dockerConfig:
|
||||||
|
secretName: kaniko-secret
|
||||||
|
artifacts:
|
||||||
|
- image: hello-flask
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
helm:
|
||||||
|
releases:
|
||||||
|
- name: myapp
|
||||||
|
chartPath: ./
|
||||||
|
setValues:
|
||||||
|
image: logmower-operator
|
||||||
|
greeting: Heya Lauri!
|
||||||
|
hostname: heya-lauri
|
|
@ -0,0 +1,70 @@
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: hello-flask
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: hello-flask
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: hello-flask
|
||||||
|
spec:
|
||||||
|
enableServiceLinks: false
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: hello-flask
|
||||||
|
image: {{ .Values.image }}
|
||||||
|
command:
|
||||||
|
- /app/app.py
|
||||||
|
- {{ .Values.greeting }}
|
||||||
|
env:
|
||||||
|
- name: MY_POD_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
ports:
|
||||||
|
- containerPort: 8000
|
||||||
|
name: metrics
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: hello-flask
|
||||||
|
labels:
|
||||||
|
app: hello-flask
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: hello-flask
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 8000
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: hello-flask
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: shared
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||||
|
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||||
|
external-dns.alpha.kubernetes.io/target: traefik.codemowers.ee
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: {{ .Values.hostname }}.codemowers.ee
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- pathType: Prefix
|
||||||
|
path: "/"
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: hello-flask
|
||||||
|
port:
|
||||||
|
number: 8000
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- "*.codemowers.ee"
|
Loading…
Reference in New Issue