Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: perfsonar
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: "1.16.0"
76 changes: 76 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "perfsonar.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 "perfsonar.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 "perfsonar.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "perfsonar.labels" -}}
helm.sh/chart: {{ include "perfsonar.chart" . }}
{{ include "perfsonar.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}


{{- define "perfsonar.postgresPVC" }}
- name: postgresql-data
persistentVolumeClaim:
claimName: {{ .Release.Name }}-postgres-pvc
{{- end }}

{{- define "perfsonar.postgresMount" }}
- name: postgresql-data
mountPath: /var/lib/postgresql
{{- end }}



{{/*
Selector labels
*/}}
{{- define "perfsonar.selectorLabels" -}}
app.kubernetes.io/name: {{ include "perfsonar.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "perfsonar.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "perfsonar.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
68 changes: 68 additions & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: v1
data:
pscheduler-agent-logger.conf: |
[loggers]
keys=root,TaskLogger,TransactionLogger,psconfig

[formatters]
keys=patternLayout,rootPatternLayout

[handlers]
keys=fileRotateTask,fileRotateTransaction,nullRoot,fileRotatePSConfig

[formatter_patternLayout]
format=%(asctime)s %(levelname)s %(message)s
datefmt=%Y-%m-%d %H:%M:%S

[formatter_rootPatternLayout]
format=%(asctime)s %(levelname)s pid=%(process)d prog=%(funcName)s line=%(lineno)d %(message)s
datefmt=%Y-%m-%d %H:%M:%S

[logger_root]
level=NOTSET
handlers=nullRoot

[logger_psconfig]
level=NOTSET
qualname=psconfig
handlers=fileRotatePSConfig

[logger_TaskLogger]
level=INFO
qualname=TaskLogger
handlers=fileRotateTask

[logger_TransactionLogger]
level=INFO
qualname=TransactionLogger
handlers=fileRotateTransaction

[handler_fileRotateTask]
class=handlers.RotatingFileHandler
level=INFO
formatter=patternLayout
maxBytes=16777216
backupCount=7
args=('/var/log/perfsonar/psconfig-pscheduler-agent-tasks.log', 'a')

[handler_nullRoot]
class=logging.NullHandler

[handler_fileRotatePSConfig]
class=handlers.RotatingFileHandler
level=INFO
formatter=rootPatternLayout
maxBytes=16777216
backupCount=7
args=('/var/log/perfsonar/psconfig-pscheduler-agent.log', 'a')

[handler_fileRotateTransaction]
class=handlers.RotatingFileHandler
level=DEBUG
formatter=patternLayout
maxBytes=16777216
backupCount=7
args=('/var/log/perfsonar/psconfig-pscheduler-agent-transactions.log', 'a')
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-pscheduler-configmap
141 changes: 141 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "perfsonar.fullname" . }}
labels:
{{- include "perfsonar.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "perfsonar.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "perfsonar.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "perfsonar.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
- name: init-postgresql
image: perfsonar/testpoint:v5.2.2
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |
if [ ! -d "/var/lib/postgresql/data/pg_wal" ]; then
echo "Initializing PostgreSQL database..."
cp -rP /var/lib/postgresql/* /var/lib/postgresql-1/
chown -R postgres:postgres /var/lib/postgresql-1/
else
echo "PostgreSQL data directory already initialized."
fi
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/postgresql-1
containers:
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}

{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- include "perfsonar.postgresMount" $ | nindent 12 }}
{{- with $.Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Release.Name }}-pschedulerconfig
mountPath: "/etc/perfsonar/psconfig/pscheduler-agent-logger.conf"
subPath: pscheduler-agent-logger.conf
readOnly: true
- name: {{ .Release.Name }}-pscheduleragentconfig
mountPath: "/etc/perfsonar/psconfig/pscheduler-agent.json"
subPath: pscheduler-agent.json
readOnly: true
- name: {{ .Release.Name }}-owampconfig
mountPath: "/etc/owamp-server/owamp-server.conf"
subPath: owamp-server.conf
readOnly: true
- name: {{ .Release.Name }}-twampconfig
mountPath: "/etc/twamp-server/twamp-server.conf"
subPath: twamp-server.conf
readOnly: true
- name: {{ .Release.Name }}-twamplimits
mountPath: "/etc/twamp-server/twamp-server.limits"
subPath: twamp-server.limits
readOnly: true
- name: {{ .Release.Name }}-owamplimits
mountPath: "/etc/twamp-server/owamp-server.limits"
subPath: owamp-server.limits
readOnly: true

volumes:
{{- include "perfsonar.postgresPVC" $ | nindent 8 }}
{{- with $.Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ .Release.Name }}-pschedulerconfig
configMap:
name: {{ .Release.Name }}-pscheduler-configmap
- name: {{ .Release.Name }}-pscheduleragentconfig
configMap:
name: {{ .Release.Name }}-pscheduler-agent-configmap
- name: {{ .Release.Name }}-owampconfig
configMap:
name: {{ .Release.Name }}-owamp-config
- name: {{ .Release.Name }}-twampconfig
configMap:
name: {{ .Release.Name }}-twamp-config
- name: {{ .Release.Name }}-twamplimits
configMap:
name: {{ .Release.Name }}-twamp-limits
- name: {{ .Release.Name }}-owamplimits
configMap:
name: {{ .Release.Name }}-owamp-limits

{{- with $.Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- with $.Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- with $.Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
32 changes: 32 additions & 0 deletions helm/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "perfsonar.fullname" . }}
labels:
{{- include "perfsonar.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "perfsonar.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions helm/templates/owamp-server-limits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-owamp-limits
data:
owamp-server.limits: |
limit root with disk=0,\
bandwidth=0,\
delete_on_fetch=on

limit regular with parent=root,\
disk=10G,\
bandwidth=20M

assign default regular
15 changes: 15 additions & 0 deletions helm/templates/owamp-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-owamp-config
data:
owamp-server.conf: |
user owamp
group owamp
verbose
facility local5
loglocation
vardir /var/run
datadir /var/lib/owamp
testports 8760-8770
diskfudge 3.0
10 changes: 10 additions & 0 deletions helm/templates/pscheduler-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
data:
pscheduler-agent.json: |
{
"remotes": []
}

kind: ConfigMap
metadata:
name: {{ .Release.Name }}-pscheduler-agent-configmap
Loading
Loading