Skip to content

Commit

Permalink
Adding perfsoanr-checker chart from old catalog (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
muali14 authored Dec 9, 2022
1 parent e0824b2 commit 5dc4cd1
Show file tree
Hide file tree
Showing 7 changed files with 406 additions and 0 deletions.
5 changes: 5 additions & 0 deletions charts/perfsonar-checker/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "4.3.4"
description: PerfSONAR checker app for running predefined network performance tests
name: perfsonar-checker
version: 1.1.2
84 changes: 84 additions & 0 deletions charts/perfsonar-checker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# perfSONAR Checker

Runs perfSONAR tests from your SLATE cluster to central SLATE infrastructure servers. This will give you end-to-end network measurements to verify the network status and performance at the SLATE node you deploy this Checker to.

# Installation

For all tests to run correctly, you must have proper NTP configuration on the target node that would host this perfSONAR Checker instance. This can be done by either running ntpd or chronyd on the host. For example, you can start the ntpd service by running:

`systemctl start ntpd`

Next, download the values configuration file as shown below:

`slate app get-conf --dev -o conf perfsonar-checker`

Edit that file as needed. For example, if you have a cluster node dedicated for running perfSONAR, you can specify it in the configuration file like:

```
# Default values for perfsonar-checker.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
Instance: ''
NodeSelection:
Hostname: workernode3.slateci.io
```
where `workernode3.slateci.io` is the node's DNS name, in this case.

###### Note: Please note that the node on which your instance will run must have no other perfSONAR instances running on it because perfSONAR uses host network mode. Running multiple perfSONAR applications on the same node will lead to unexpected app behavior.

If you would like to be able to see the full details of all the tests the Checker runs, you can enable the HTTPLogger in the configuration file like:

```
HTTPLogger:
Enabled: True
```
Then simply install the app.

`slate app install --dev perfsonar-checker --cluster <cluster name> --group <group name> --conf conf`

# Results
The tests run to three different destination servers so it could take some time, probably around 15-20 minutes, for all tests to finish. Each test will log its results to a log file when they're ready.

To see the summary results, you can run the the below command:

```
slate instance logs --max-lines 0 <instance-ID>
```

### HTTPLogger
If you enabled the HTTPLogger, then you can view the full results through a web browser. To do that, run the below command to get the URL address:

```
slate instance info <instance-ID>
```
and look for the URL address under the `Services` section

```
Services:
Name Cluster IP External IP Ports URL
perfsonar-checker 10.233.29.42 155.XX..YY.ZZ 8080:30503/TCP 155.XX.YY.ZZ:30503
```

Then you would need to retrieve the username and randomly-generated password from the instance log which would look like:

```
Your randomly generated logger credentials are
**********************************************
username:080lo947nclu1vs6506
**********************************************
```
Once you have that, you can navigate to the URL from a web browser, use your credentials to log in, and view the content of the `checker.log` file.

# Configuration and usage

This is the full user guide for perfSONAR:

http://docs.perfsonar.net/index.html#running-measurements-with-pscheduler

Additional tools reference:

http://docs.perfsonar.net/pscheduler_ref_tests_tools.html

32 changes: 32 additions & 0 deletions charts/perfsonar-checker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "perfsonar-checker.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-checker.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-checker.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
125 changes: 125 additions & 0 deletions charts/perfsonar-checker/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: perfsonar-checker-{{ .Values.Instance }}-startup
labels:
app: {{ template "perfsonar-checker.name" . }}
chart: {{ template "perfsonar-checker.chart" . }}
release: {{ .Release.Name }}
instance: {{ .Values.Instance | quote }}
data:
startup_script.sh: |+
#!/bin/bash
whoami
stat /usr/bin/pscheduler
echo "*/2 * * * * /usr/bin/run-my-tests.sh > /tmp/cron.out" > /var/spool/cron/root
sleep 600
# /usr/local/sbin/supervisord_startup.sh
# echo "Starting Tests..."
#/usr/bin/pscheduler task throughput -t 10 --dest sl-um-ps01.slateci.io
#echo "Done with all tests.."
# echo "Sleeping for 3 mins.."
# sleep 360

run-my-tests.sh: |+
#!/bin/bash
echo "Starting Tests..."
#/usr/bin/pscheduler task throughput -t 10 --dest sl-um-ps01.slateci.io
/usr/bin/pscheduler troubleshoot
echo "Done with all tests.."
echo "Sleeping for 3 mins.."
sleep 360
supervisord.conf: |+
[supervisord]
nodaemon=true
[program:rsyslog]
command=rsyslogd -n
redirect_stderr=true
priority=1
;[program:owampd]
;chown=owamp:owamp
;command=/usr/bin/owampd -c /etc/owamp-server -R /var/run
;[program:ls_registration_daemon]
;chown=perfsonar:perfsonar
;command=/usr/lib/perfsonar/bin/lsregistrationdaemon.pl --config=/etc/perfsonar/lsregistrationdaemon.conf --pidfile=/var/run/lsregistrationdaemon.pid --logger=/etc/perfsonar/lsregistrationdaemon-logger.conf --user=perfsonar --group=perfsonar
;priority=2
;startretries=10
[program:postgresql] ; postgress is needed by pscheduler
command=/usr/pgsql-10/bin/postgres -D /var/lib/pgsql/10/data
user=postgres
priority=1
[program:httpd] ; httpd is needed by pscheduler
command=/usr/bin/pidproxy /var/run/httpd.pid /bin/bash -c "/usr/sbin/httpd -DFOREGROUND -k start"
priority=1
[program:pscheduler-ticker]
chown=pscheduler:pscheduler
command=/usr/bin/python3 /usr/libexec/pscheduler/daemons/ticker --daemon --pid-file /var/run/pscheduler-ticker.pid --dsn @/etc/pscheduler/database/database-dsn
priority=1
[program:pscheduler-archiver]
chown=pscheduler:pscheduler
command=/usr/bin/python3 /usr/libexec/pscheduler/daemons/archiver --daemon --pid-file /var/run/pscheduler-archiver.pid --dsn @/etc/pscheduler/database/database-dsn
priority=1
[program:pscheduler-scheduler]
chown=pscheduler:pscheduler
command=/usr/bin/python3 /usr/libexec/pscheduler/daemons/scheduler --daemon --pid-file /var/run/pscheduler-scheduler.pid --dsn @/etc/pscheduler/database/database-dsn
priority=1
[program:pscheduler-runner]
chown=pscheduler:pscheduler
command=/usr/bin/python3 /usr/libexec/pscheduler/daemons/runner --daemon --pid-file /var/run/pscheduler-runner.pid --dsn @/etc/pscheduler/database/database-dsn
priority=1
;[program:psconfig_pscheduler_agent]
;chown=perfsonar:perfsonar
;command=/usr/lib/perfsonar/bin/psconfig_pscheduler_agent --config=/etc/perfsonar/psconfig/pscheduler-agent.json --logger=/etc/perfsonar/psconfig/pscheduler-agent-logger.conf --pidfile=/var/run/psconfig-pscheduler-agent.pid --user=perfsonar --group=perfsonar
;priority=2
;startretries=10
[program:slate-tests]
command=/usr/local/bin/run-perfsonar-tests.sh -dest1 "{{ .Values.PerfsonarChecker.Dest1 }}" -dest2 "{{ .Values.PerfsonarChecker.Dest2 }}" -dest3 "{{ .Values.PerfsonarChecker.Dest3 }}" -dest1bw "{{ .Values.PerfsonarChecker.Dest1bw }}" -dest2bw "{{ .Values.PerfsonarChecker.Dest2bw }}" -dest3bw "{{ .Values.PerfsonarChecker.Dest3bw }}"
priority=999
autorestart = false
startretries = 1
{{ if .Values.HTTPLogger.Enabled }}
start-nginx.sh: |+
#!/bin/bash -e
apt-get update
apt-get install openssl -y
if [ -z $HTPASSWD ]; then
PASS=$(tr -dc 'a-f0-9' < /dev/urandom | head -c16)
echo "Your randomly generated logger credentials are"
echo "**********************************************"
echo "logger:$PASS"
echo "**********************************************"
HTPASSWD="$(openssl passwd -apr1 $(echo -n $PASS))"
fi
mkdir -p /etc/nginx/auth
echo "logger:$HTPASSWD" > /etc/nginx/auth/htpasswd
echo 'server {
listen 8080;
server_name localhost;
location / {
default_type text/plain;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth/htpasswd;
root /usr/share/nginx/html;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}' > /etc/nginx/conf.d/default.conf
exec nginx -g 'daemon off;'
{{ end }}
109 changes: 109 additions & 0 deletions charts/perfsonar-checker/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "perfsonar-checker.fullname" . }}
labels:
app: {{ template "perfsonar-checker.name" . }}
chart: {{ template "perfsonar-checker.chart" . }}
release: {{ .Release.Name }}
instance: {{ .Values.Instance | quote }}
instanceID: {{ .Values.SLATE.Instance.ID | quote }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "perfsonar-checker.name" . }}
chart: {{ template "perfsonar-checker.chart" . }}
release: {{ .Release.Name }}
instance: {{ .Values.Instance | quote }}
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
app: {{ template "perfsonar-checker.name" . }}
chart: {{ template "perfsonar-checker.chart" . }}
release: {{ .Release.Name }}
instance: {{ .Values.Instance | quote }}
spec:
nodeSelector:
# For Node Selection
{{ if .Values.NodeSelection.Hostname }}
kubernetes.io/hostname: {{ .Values.NodeSelection.Hostname }}
{{ end }}
hostNetwork: true
containers:
{{ if .Values.HTTPLogger.Enabled }}
- name: logging-sidecar
image: "nginx:1.15.9"
command: ["/bin/bash"]
args: ["/usr/local/bin/start-nginx.sh"]
imagePullPolicy: IfNotPresent
ports:
- name: logs
containerPort: 8080
protocol: TCP
volumeMounts:
- name: log-volume
mountPath: /usr/share/nginx/html
- name: logger-startup
mountPath: /usr/local/bin/start-nginx.sh
subPath: start-nginx.sh
{{ end }}
- name: perfsonar-testpoint
# image: perfsonar/testpoint:latest
# image: perfsonar-checker:latest
# image: slateci/perfsonar-checker:v4.3.4
image: hub.opensciencegrid.org/slate/perfsonar-checker:4.3.4
imagePullPolicy: Always
securityContext:
privileged: true
# command: ["/usr/bin/startup_script.sh"]
# command: "pscheduler troubleshoot"
volumeMounts:
- name: perfsonar-checker-{{ .Values.Instance }}-startup
mountPath: "/usr/bin/startup_script.sh"
subPath: startup_script.sh
# - name: perfsonar-test-{{ .Values.Instance }}-startup
# mountPath: "/usr/bin/run-my-tests.sh"
# subPath: run-my-tests.sh
- name: perfsonar-checker-{{ .Values.Instance }}-supervisord-conf
mountPath: "/etc/supervisord.conf"
subPath: supervisord.conf
{{ if .Values.HTTPLogger.Enabled }}
- name: log-volume
mountPath: /var/log/perfsonar-checker
{{ end }}
restartPolicy: Always
volumes:
- name: perfsonar-checker-{{ .Values.Instance }}-startup
configMap:
name: perfsonar-checker-{{ .Values.Instance }}-startup
items:
- key: startup_script.sh
path: startup_script.sh
mode: 0755
# - name: perfsonar-test-{{ .Values.Instance }}-startup
# configMap:
# name: perfsonar-checker-{{ .Values.Instance }}-startup
# items:
# - key: run-my-tests.sh
# path: run-my-tests.sh
# mode: 0755
- name: perfsonar-checker-{{ .Values.Instance }}-supervisord-conf
configMap:
name: perfsonar-checker-{{ .Values.Instance }}-startup
items:
- key: supervisord.conf
path: supervisord.conf
mode: 0644

{{ if .Values.HTTPLogger.Enabled }}
- name: log-volume
emptyDir: {}
- name: logger-startup
configMap:
name: perfsonar-checker-{{ .Values.Instance }}-startup
{{ end }}
status: {}
21 changes: 21 additions & 0 deletions charts/perfsonar-checker/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{ if .Values.HTTPLogger.Enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "perfsonar-checker.fullname" . }}
labels:
app: {{ template "perfsonar-checker.name" . }}
chart: {{ template "perfsonar-checker.chart" . }}
release: {{ .Release.Name }}
instance: {{ .Values.Instance | quote }}
spec:
type: NodePort
ports:
- port: 8080
targetPort: logs
protocol: TCP
name: logs
selector:
app: {{ template "perfsonar-checker.name" . }}
instance: {{.Values.Instance | quote }}
{{ end }}
Loading

0 comments on commit 5dc4cd1

Please sign in to comment.