Compare commits
10 commits
d6cac42438
...
4f2d1c322e
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f2d1c322e | |||
| bae554d2d5 | |||
| def05dc7df | |||
| 50a9bc1c51 | |||
| f66e72444d | |||
| 4c8b0e1d63 | |||
| 6d5aa8d441 | |||
| 87ad20d355 | |||
| 4a2a168081 | |||
| 0137bb1953 |
16 changed files with 222 additions and 19 deletions
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
template
|
||||||
|
build
|
||||||
|
.secrets
|
||||||
|
mysecret.json
|
||||||
|
mysecret.yaml
|
||||||
|
mysealedsecret.json
|
||||||
|
.env
|
||||||
|
.mysealedsecret.json2235032335
|
||||||
|
|
@ -1,22 +1,25 @@
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: CronJob
|
||||||
metadata:
|
metadata:
|
||||||
name: timestamp-job
|
name: timestamp-cronjob
|
||||||
|
spec:
|
||||||
|
schedule: "*/1 * * * *"
|
||||||
|
jobTemplate:
|
||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: timestamp-job
|
labels:
|
||||||
|
app: timestamp-job
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: timestamp-container
|
- name: timestamp-container
|
||||||
image: busybox
|
image: busybox
|
||||||
command: ["sh", "-c", "while true; do date >> /logs/runs.log; sleep 60; done"]
|
command: ["sh", "-c", "date >> /logs/runs.log"]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: logs-volume
|
||||||
mountPath: /logs
|
mountPath: /logs
|
||||||
subPath: logs
|
restartPolicy: OnFailure
|
||||||
restartPolicy: Never
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: data
|
- name: logs-volume
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: data
|
claimName: data
|
||||||
|
|
|
||||||
4
active/weather/Chart.yaml
Normal file
4
active/weather/Chart.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
apiVersion: v2
|
||||||
|
name: weather-cronjob-chart
|
||||||
|
description: A Helm chart for deploying a cron job to fetch weather information
|
||||||
|
version: 0.1.0
|
||||||
0
active/weather/charts/.gitkeep
Normal file
0
active/weather/charts/.gitkeep
Normal file
27
active/weather/templates/cronjob.yaml
Normal file
27
active/weather/templates/cronjob.yaml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-weather-cronjob
|
||||||
|
spec:
|
||||||
|
schedule: "{{ .Values.schedule }}"
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: weather-job
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: weather-container
|
||||||
|
image: {{ .Values.container.image }}
|
||||||
|
command: ["sh", "-c", "{{ .Values.container.command }}"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: logs-volume
|
||||||
|
mountPath: /logs
|
||||||
|
subPath: logs
|
||||||
|
restartPolicy: {{ .Values.restartPolicy }}
|
||||||
|
volumes:
|
||||||
|
- name: logs-volume
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ .Values.volume.claimName }}
|
||||||
|
subPath: logs
|
||||||
10
active/weather/values.yaml
Normal file
10
active/weather/values.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
schedule: "*/1 * * * *"
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: busybox
|
||||||
|
command: "curl 'wttr.in/peoria,il?format=3' >> /logs/weather.log"
|
||||||
|
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
|
||||||
|
volume:
|
||||||
|
claimName: data
|
||||||
25
active/weather_report.yaml
Normal file
25
active/weather_report.yaml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: weather-cronjob
|
||||||
|
spec:
|
||||||
|
schedule: "*/1 * * * *"
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: weather-job
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: weather-container
|
||||||
|
image: curlimages/curl
|
||||||
|
command: ["sh", "-c", "date >> /logs/wttr.log && curl 'wttr.in/peoria,il?format=3' >> /logs/wttr.log && echo ''"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: logs-volume
|
||||||
|
mountPath: /logs
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
volumes:
|
||||||
|
- name: logs-volume
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: data
|
||||||
15
mysealedsecret.yaml
Normal file
15
mysealedsecret.yaml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
apiVersion: bitnami.com/v1alpha1
|
||||||
|
kind: SealedSecret
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: mysecret
|
||||||
|
namespace: minecraft
|
||||||
|
spec:
|
||||||
|
encryptedData:
|
||||||
|
foo: AgCBsDB9HP0nqFPgLIEMug9Zgp7kQ4O5lfKZy0MaB1chPCzV0vSdg13ZRjv5NbsjFbb2G8tUt0O81JL/5l7sRnaJIZQJS4Ro7/4ij3K5Av8hq754gQJDGQQP0DLq/bRwdhimayw6ZNnsCxUnrTqJRRch7rGo0zWQjIcUy1fs53p9fIUZxEPdoBTIgP6sLfcKuROVQt1+IPO351WNx3CIrB4BuSkWGlPs/wx1yddC5bWl7X85AsrqwFQvU6qamOrqCvKCrJVVCAk323Z9+ziY8BkYZXhWjayMyl35weTKZjLs4p6lnpreTpjriWdSblkRmcA1G9aNCOp2axtuUG//HdEg4N1vioENcig5r+lp6ySXxODEdHX/ROfg8GqPSmMqyzX/GjI3b1Cz2nsyMfWcWC1w2D3aLL7B5gI939qN6oUm3Ip2OSOUJBLeVaZVhw+ozM7qmtIj/HGTtepjebdvHgvWHP8zAQB+crftWLu53qT7CWrM7QLdMIvsMI7mTAfTOfF536yYi6/i945ixhaLWShsWyNfvedq6DZ8azZyKTbmva34oADoxrpaR/tpvA9SSUz2yM0R+7WqWaDFWxUqqqijuocyeKjpj+AFr5rxLZVtx2gJ01vg2axGv3hieT/xM9h9LqdCxxq1nhv9ue66FRsuAD9gT1QYpH2I8GAAaKNBYTxHFW6eDke1z03/2BHkPoSsTug=
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: mysecret
|
||||||
|
namespace: default
|
||||||
|
type: Opaque
|
||||||
10
people.yml
Normal file
10
people.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
version: 1.0
|
||||||
|
provider:
|
||||||
|
name: openfaas
|
||||||
|
gateway: http://127.0.0.1:8080
|
||||||
|
functions:
|
||||||
|
people:
|
||||||
|
lang: python
|
||||||
|
handler: ./people
|
||||||
|
image: people:latest
|
||||||
|
|
||||||
18
people/handler.py
Normal file
18
people/handler.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
def detect_person(url):
|
||||||
|
return "Hello, World!"
|
||||||
|
|
||||||
|
|
||||||
|
def handle(req):
|
||||||
|
"""handle a request to the function
|
||||||
|
Args:
|
||||||
|
req (str): request body
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not req:
|
||||||
|
raise Exception("Empty request")
|
||||||
|
|
||||||
|
if isinstance(req, str):
|
||||||
|
req = req.encode("utf-8")
|
||||||
|
url = req
|
||||||
|
|
||||||
|
return detect_person(url)
|
||||||
30
people/requirements.txt
Normal file
30
people/requirements.txt
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# pip install -r requirements.txt
|
||||||
|
|
||||||
|
# base ----------------------------------------
|
||||||
|
Cython
|
||||||
|
matplotlib>=3.2.2
|
||||||
|
numpy>=1.18.5
|
||||||
|
opencv-python>=4.1.2
|
||||||
|
Pillow
|
||||||
|
PyYAML>=5.3.1
|
||||||
|
scipy>=1.4.1
|
||||||
|
tensorboard>=2.2
|
||||||
|
torch>=1.7.0
|
||||||
|
torchvision>=0.8.1
|
||||||
|
tqdm>=4.41.0
|
||||||
|
|
||||||
|
# logging -------------------------------------
|
||||||
|
# wandb
|
||||||
|
|
||||||
|
# plotting ------------------------------------
|
||||||
|
seaborn>=0.11.0
|
||||||
|
pandas
|
||||||
|
|
||||||
|
# export --------------------------------------
|
||||||
|
# coremltools>=4.1
|
||||||
|
# onnx>=1.8.1
|
||||||
|
# scikit-learn==0.19.2 # for coreml quantization
|
||||||
|
|
||||||
|
# extras --------------------------------------
|
||||||
|
thop # FLOPS computation
|
||||||
|
pycocotools>=2.0 # COCO mAP
|
||||||
|
|
@ -5,14 +5,28 @@ metadata:
|
||||||
namespace: minecraft
|
namespace: minecraft
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: busybox
|
- image: docker.io/curlimages/curl
|
||||||
name: pvc-inspector
|
name: pvc-inspector
|
||||||
command: ["sleep", "3600"]
|
command: ["sleep", "3600"]
|
||||||
|
env:
|
||||||
|
- name: FOO
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mysecret
|
||||||
|
key: foo
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /data
|
- mountPath: /data
|
||||||
name: data
|
name: data
|
||||||
# subPath: minecraft
|
# subPath: minecraft
|
||||||
|
#
|
||||||
|
#
|
||||||
|
- name: sealed-secret
|
||||||
|
mountPath: /secret
|
||||||
|
readOnly: true
|
||||||
volumes:
|
volumes:
|
||||||
- name: data
|
- name: data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: data
|
claimName: data
|
||||||
|
- name: sealed-secret
|
||||||
|
secret:
|
||||||
|
secretName: mysecret
|
||||||
|
|
|
||||||
9
python-function.yml
Normal file
9
python-function.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
version: 1.0
|
||||||
|
provider:
|
||||||
|
name: openfaas
|
||||||
|
gateway: http://127.0.0.1:8080
|
||||||
|
functions:
|
||||||
|
python-function:
|
||||||
|
lang: python
|
||||||
|
handler: ./python-function
|
||||||
|
image: waylonwalker/python-function:latest
|
||||||
8
python-function/handler.py
Normal file
8
python-function/handler.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
def handle(req):
|
||||||
|
"""handle a request to the function
|
||||||
|
Args:
|
||||||
|
req (str): request body
|
||||||
|
"""
|
||||||
|
# print("Hello! You said: " + req)
|
||||||
|
|
||||||
|
return {"message": req}
|
||||||
0
python-function/requirements.txt
Normal file
0
python-function/requirements.txt
Normal file
22
startup.sh
Normal file
22
startup.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
kind create cluster --name minecraft
|
||||||
|
helm repo add argo https://argoproj.github.io/argo-helm
|
||||||
|
helm repo update
|
||||||
|
helm install argo argo/argo-cd --namespace argocd --create-namespace
|
||||||
|
kubectl port-forward service/argo-argocd-server -n argocd 8080:443
|
||||||
|
argocd admin initial-password -n argocd
|
||||||
|
argocd login localhost:8080
|
||||||
|
argocd app list
|
||||||
|
argocd app create minecraft --repo https://github.com/waylonwalker/minecraft-servers --path active --dest-server https://kubernetes.default.svc --dest-namespace minecraft
|
||||||
|
argocd app list
|
||||||
|
argocd app sync minecraft
|
||||||
|
argocd app list
|
||||||
|
argocd app set minecraft --sync-policy automated --auto-prune
|
||||||
|
argocd app list
|
||||||
|
argocd app get minecraft
|
||||||
|
|
||||||
|
# ---
|
||||||
|
helm repo update \
|
||||||
|
&& helm upgrade openfaas \
|
||||||
|
--install openfaas/openfaas \
|
||||||
|
--namespace openfaas \
|
||||||
|
--create-namespace
|
||||||
Loading…
Add table
Add a link
Reference in a new issue