initial commit

This commit is contained in:
Kofo Okesola 2025-08-14 02:47:39 +01:00
commit bc314a3014
10 changed files with 292 additions and 0 deletions

23
servflow/.helmignore Normal file
View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

6
servflow/Chart.lock Normal file
View File

@ -0,0 +1,6 @@
dependencies:
- name: ingress-nginx
repository: https://kubernetes.github.io/ingress-nginx
version: 4.11.2
digest: sha256:ab93695e04dab546906b6bad42e147fa538237f6a52a5b3cceff14fc287d4268
generated: "2024-10-02T06:05:05.964658+01:00"

24
servflow/Chart.yaml Normal file
View File

@ -0,0 +1,24 @@
apiVersion: v2
name: servflow
description: Helm chart for the helm deployment
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.2.1"

View File

@ -0,0 +1 @@
HAVE FUN!

View File

@ -0,0 +1,54 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "servflow.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "servflow.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "servflow.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "servflow.labels" -}}
helm.sh/chart: {{ include "servflow.chart" . }}
{{ include "helm.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "servflow.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "servflow.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: servflow-engine
labels:
app: servflow-engine
spec:
selector:
matchLabels:
app: servflow-engine
template:
metadata:
labels:
app: servflow-engine
spec:
{{ if .Values.persistence.enabled }}
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: servflow-engine-pvc
{{ end }}
imagePullSecrets:
- name: regcred
containers:
- name: servflow
resources:
limits:
memory: 50Mi
image: "servflow/servflow:v1.2.1"
{{ if .Values.persistence.enabled }}
volumeMounts:
- name: data-volume
mountPath: {{ .Values.persistence.storage.mountPath }}
{{ end }}
ports:
- name: http
containerPort: 80
protocol: TCP
env:
- name: SERVFLOW_PORT
value: "80"
- name: SERVFLOW_APPSERVERURL
value: "{{ .Values.engine.environment }}-grpc-server-service.default.svc.cluster.local:50051"
- name: SERVFLOW_LOGLEVEL
value: {{ .Values.engine.environment }}
- name: SERVFLOW_APIKEY
value: {{ .Values.general.apikey }}
- name: SERVFLOW_REDIS_CONNECTIONSTRING
valueFrom:
secretKeyRef:
key: redis-url
name: redis-secret
- name: KEDA_REDIS_ADDRESS
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-address
- name: SERVFLOW_OTEL_ENABLED
value: "true"
- name: SERVFLOW_OTEL_ADDRESS
value: jaeger-service.default.svc.cluster.local:4317
{{ if .Values.persistence.enabled }}
- name: SERVFLOW_STORAGE_PATH
value: {{ .Values.persistence.storage.mountPath }}
{{ end}}
- name: scalersignal-consumer
resources:
limits:
memory: 10Mi
image: servflow/scalersignal-consumer:v0.1.3
env:
- name: REDIS_ADDR
valueFrom:
secretKeyRef:
key: redis-url
name: redis-secret
- name: SUBDOMAIN
value: {{ .Values.general.subdomain }}
---
{{ if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: servflow-engine-pvc
spec:
accessModes:
{{ range .Values.persistence.storage.accessModes }}
- {{ . }}
{{ end }}
resources:
requests:
storage: {{ .Values.persistence.storage.size }}
{{ if .Values.persistence.storage.storageClassName }}
storageClassName: {{ .Values.persistence.storage.storageClassName }}
{{ end }}
{{ end }}

View File

@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: servflow-engine
spec:
rules:
- host: {{ .Values.general.domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: servflow-engine-service
port:
number: 80

View File

@ -0,0 +1,32 @@
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-redis-stream-triggerauth
spec:
secretTargetRef:
- parameter: username
name: redis-secret
key: redis-username
- parameter: password
name: redis-secret
key: redis-password
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: redis-streams-scaledobject
spec:
scaleTargetRef:
name: servflow-engine
pollingInterval: 5
cooldownPeriod: 300
maxReplicaCount: 1
minReplicaCount: 0
triggers:
- type: redis-streams
metadata:
addressFromEnv: KEDA_REDIS_ADDRESS
stream: "proxy_requests:{{ .Values.general.subdomain }}"
streamLength: "1"
authenticationRef:
name: keda-redis-stream-triggerauth # name of the TriggerAuthentication resource

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: servflow-engine-service
labels:
app: servflow-engine
spec:
type: ClusterIP
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app: servflow-engine

24
servflow/values.yaml Normal file
View File

@ -0,0 +1,24 @@
# Default values for helm.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
replicaCount: 1
general:
apikey: ""
domain: ""
subdomain: ""
engine:
environment: "staging"
redisURL: ""
persistence:
enabled: true
storage:
size: 10Mi
mountPath: "/data/servflow"
accessModes:
- ReadWriteOnce
storageClassName: "do-block-storage"