Skip to content

Commit

Permalink
Add priobike news service (#27)
Browse files Browse the repository at this point in the history
* Add priobike news service manager and worker

* Fix linting and debug value
  • Loading branch information
PaulPickhardt authored Oct 15, 2024
1 parent 570a4b9 commit 33e4d8e
Show file tree
Hide file tree
Showing 14 changed files with 270 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/priobike-news/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
30 changes: 30 additions & 0 deletions charts/priobike-news/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v2
name: priobike-news
description: A Helm chart for Kubernetes

# 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: 0.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: "v2.1"

maintainers:
- name: Paul
email: paul_maximilian.pickhardt@tu-dresden.de
- name: Daniel
email: daniel.jeschor@tu-dresden.de
10 changes: 10 additions & 0 deletions charts/priobike-news/ci/example-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace: exampleNamespace
priobikeImageRegistry: bikenow.vkw.tu-dresden.de/priobike

djangoKey: test-key
djangoSuperuserPassword: test-password

syncKey: test-key

fcmPushNotificationEnvironment: development
csrfTrustedOrigin: http://localhost
15 changes: 15 additions & 0 deletions charts/priobike-news/templates/manager-config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.manager.configMapName }}
data:
DEBUG: {{ .Values.manager.debug | quote }}
WORKER_HOST: |-
{{ .Values.worker.serviceName | required "A valid .Values.worker.serviceName entry is required!" }}
.
{{- (.Values.global).namespace | default .Values.namespace | required "A valid .Values.namespace or .Values.global.namespace entry is required!" -}}
.
svc.cluster.local
APP_URL: {{ .Values.manager.appUrl }}
FCM_PUSH_NOTIFICATION_ENVIRONMENT: {{ required "A valid .Values.fcmPushNotificationEnvironment entry is required!" .Values.fcmPushNotificationEnvironment }}
CSRF_TRUSTED_ORIGIN: {{ required "A valid .Values.csrfTrustedOrigin entry is required!" .Values.csrfTrustedOrigin }}
38 changes: 38 additions & 0 deletions charts/priobike-news/templates/manager-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.manager.deploymentName }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Values.manager.labels.app }}
template:
metadata:
labels:
app: {{ .Values.manager.labels.app }}
spec:
imagePullSecrets:
- name: regcred

containers:
- name: {{ .Values.manager.containerName }}
image: |-
{{ (.Values.global).priobikeImageRegistry | default .Values.priobikeImageRegistry | required "A valid .Values.priobikeImageRegistry or .Values.global.priobikeImageRegistry entry is required!" -}}
/{{ .Values.imageName }}:v2.1
envFrom:
- configMapRef:
name: {{ .Values.manager.configMapName }}
- secretRef:
name: {{ .Values.manager.secretName }}
volumeMounts:
- mountPath: /etc/postgresql
name: {{ .Values.manager.volumeName }}
- mountPath: /var/log/postgresql
name: {{ .Values.manager.volumeName }}
- mountPath: /var/lib/postgresql/data
name: {{ .Values.manager.volumeName }}
volumes:
- name: {{ .Values.manager.volumeName }}
persistentVolumeClaim:
claimName: {{ .Values.manager.volumeClaimName }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.manager.volumeClaimName }}
spec:
storageClassName: {{ .Values.manager.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.manager.storageSize }}
8 changes: 8 additions & 0 deletions charts/priobike-news/templates/manager-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.manager.secretName }}
data:
DJANGO_SUPERUSER_PASSWORD: {{ required "A valid .Values.djangoSuperuserPassword entry is required!" .Values.djangoSuperuserPassword | b64enc }}
DJANGO_KEY: {{ required "A valid .Values.djangoKey entry is required!" .Values.djangoKey | b64enc }}
SYNC_KEY: {{ required "A valid .Values.syncKey entry is required!" .Values.syncKey | b64enc }}
17 changes: 17 additions & 0 deletions charts/priobike-news/templates/manager-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.manager.serviceName }}
spec:
selector:
app: {{ .Values.manager.labels.app }}
ports:
- protocol: TCP
port: 8000
targetPort: 8000
name: admin-port
- protocol: TCP
port: 8001
targetPort: 8001
name: sync-port
type: ClusterIP
14 changes: 14 additions & 0 deletions charts/priobike-news/templates/worker-config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.worker.configMapName }}
data:
DEBUG: {{ .Values.worker.debug | quote }}
WORKER_MODE: "True"
MANAGER_HOST: |-
{{ .Values.manager.serviceName | required "A valid .Values.manager.serviceName entry is required!" }}
.
{{- (.Values.global).namespace | default .Values.namespace | required "A valid .Values.namespace or .Values.global.namespace entry is required!" -}}
.
svc.cluster.local
APP_URL: {{ .Values.worker.appUrl }}
27 changes: 27 additions & 0 deletions charts/priobike-news/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.worker.deploymentName }}
spec:
replicas: {{ .Values.worker.replicas }}
selector:
matchLabels:
app: {{ .Values.worker.labels.app }}
template:
metadata:
labels:
app: {{ .Values.worker.labels.app }}
spec:
imagePullSecrets:
- name: regcred

containers:
- name: {{ .Values.worker.containerName }}
image: |-
{{ (.Values.global).priobikeImageRegistry | default .Values.priobikeImageRegistry | required "A valid .Values.priobikeImageRegistry or .Values.global.priobikeImageRegistry entry is required!" -}}
/{{ .Values.imageName }}:v2.1
envFrom:
- configMapRef:
name: {{ .Values.worker.configMapName }}
- secretRef:
name: {{ .Values.worker.secretName }}
7 changes: 7 additions & 0 deletions charts/priobike-news/templates/worker-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.worker.secretName }}
data:
DJANGO_KEY: {{ required "A valid .Values.djangoKey entry is required!" .Values.djangoKey | b64enc }}
SYNC_KEY: {{ required "A valid .Values.syncKey entry is required!" .Values.syncKey | b64enc }}
13 changes: 13 additions & 0 deletions charts/priobike-news/templates/worker-service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.worker.headlessServiceName }}
spec:
selector:
app: {{ .Values.worker.labels.app }}
ports:
- protocol: TCP
port: 8001
targetPort: 8001
clusterIP: None
type: ClusterIP
27 changes: 27 additions & 0 deletions charts/priobike-news/templates/worker-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.worker.serviceName }}
spec:
selector:
app: {{ .Values.worker.labels.app }}
ports:
- protocol: TCP
port: 8000
targetPort: 8000
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: priobike-news-worker-service-headless
spec:
selector:
app: priobike-news-worker-app
ports:
- protocol: TCP
port: 8001
targetPort: 8001
clusterIP: None
type: ClusterIP
---
30 changes: 30 additions & 0 deletions charts/priobike-news/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
imageName: priobike-news-service


manager:
labels:
app: priobike-news-manager-app
configmapName: priobike-news-manager-config
deploymentName: priobike-news-manager-deployment
containerName: priobike-news-manager-container
volumeClaimName: priobike-news-manager-volume-claim
storageClassName: standard
storageSize: 1Gi
volumeName: priobike-news-manager-volume
serviceName: priobike-news-manager-service
secretName: priobike-news-manager-secret
appUrl: /news-service-manager/
debug: 'False'

worker:
replicas: 1
labels:
app: priobike-news-worker-app
configmapName: priobike-news-worker-config
deploymentName: priobike-news-worker-deployment
containerName: priobike-news-worker-container
serviceName: priobike-news-worker-service
headlessServiceName: priobike-news-worker-service-headless
secretName: priobike-news-worker-secret
appUrl: /news-service-worker/
debug: 'False'

0 comments on commit 33e4d8e

Please sign in to comment.