Browse Source

Add kubernetes files

master
Hamcha 1 year ago
parent
commit
e967a474cf
Signed by: Hamcha GPG Key ID: 44AD3571EB09A39E
11 changed files with 151 additions and 1 deletions
  1. +2
    -0
      .gitignore
  2. +21
    -1
      README.md
  3. +26
    -0
      kubernetes/base/deployment.yaml
  4. +15
    -0
      kubernetes/base/ingress.yaml
  5. +12
    -0
      kubernetes/base/kustomization.yaml
  6. +16
    -0
      kubernetes/base/service.yaml
  7. +13
    -0
      kubernetes/overlays/development/deployment.yaml
  8. +14
    -0
      kubernetes/overlays/development/kustomization.yaml
  9. +12
    -0
      kubernetes/overlays/production/deployment.yaml
  10. +10
    -0
      kubernetes/overlays/production/kustomization.yaml
  11. +10
    -0
      skaffold.yaml

+ 2
- 0
.gitignore View File

@ -0,0 +1,2 @@
.env
envfile

+ 21
- 1
README.md View File

@ -1,6 +1,26 @@
# stappabot
## Getting started
## Run on minikube
Running in minikube doesn't really work right now, but you can still try if the docker container builds and deploys successfully.
Make sure the `bots` namespace exists!
### Requirements
- [Skaffold](https://skaffold.dev/docs/install/)
Create a file in `kubernetes/overlays/development` called `envfile` with these values:
```sh
STAPPA_TOKEN=telegram-bot-token
STAPPA_WEBHOOK=https://telegram.webhook/endpoint
STAPPA_PATH=endpoint
```
Run `skaffold dev`
## Run locally
Install stappabot


+ 26
- 0
kubernetes/base/deployment.yaml View File

@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: stappabot
svctype: bot
name: stappabot
spec:
replicas: 1
selector:
matchLabels:
app: stappabot
strategy: {}
template:
metadata:
labels:
app: stappabot
spec:
containers:
- image: registry.zyg.ovh/hamcha/stappabot
name: stappabot
resources: {}
restartPolicy: Always
imagePullSecrets:
- name: regcred
status: {}

+ 15
- 0
kubernetes/base/ingress.yaml View File

@ -0,0 +1,15 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: stappabot
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- host: stappabot.zyg.ovh
http:
paths:
- backend:
serviceName: stappabot
servicePort: http

+ 12
- 0
kubernetes/base/kustomization.yaml View File

@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app: stappabot
namespace: bots
resources:
- deployment.yaml
- service.yaml
- ingress.yaml

+ 16
- 0
kubernetes/base/service.yaml View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: stappabot
svctype: bot
name: stappabot
spec:
ports:
- name: "http"
port: 8080
targetPort: 8080
selector:
app: stappabot
status:
loadBalancer: {}

+ 13
- 0
kubernetes/overlays/development/deployment.yaml View File

@ -0,0 +1,13 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: stappabot
spec:
template:
spec:
containers:
- name: stappabot
imagePullPolicy: "Never"
envFrom:
- secretRef:
name: stappabot-secret

+ 14
- 0
kubernetes/overlays/development/kustomization.yaml View File

@ -0,0 +1,14 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
namespace: bots
secretGenerator:
- name: stappabot-secret
env: envfile
patchesStrategicMerge:
- deployment.yaml

+ 12
- 0
kubernetes/overlays/production/deployment.yaml View File

@ -0,0 +1,12 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: stappabot
spec:
template:
spec:
containers:
- name: stappabot
envFrom:
- secretRef:
name: stappabot-secret

+ 10
- 0
kubernetes/overlays/production/kustomization.yaml View File

@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
namespace: bots
patchesStrategicMerge:
- deployment.yaml

+ 10
- 0
skaffold.yaml View File

@ -0,0 +1,10 @@
apiVersion: skaffold/v2alpha2
kind: Config
build:
artifacts:
- image: registry.zyg.ovh/hamcha/stappabot
local:
push: false
deploy:
kustomize:
path: "kubernetes/overlays/development"

Loading…
Cancel
Save