Skip to content
Snippets Groups Projects
Commit edcf30e2 authored by Sagar Arora's avatar Sagar Arora :bicyclist_tone1: Committed by Raphael Defosseux
Browse files

feat: traffic server charts

Adding charts to deploy a traffic server.
parent c96a615d
No related branches found
No related tags found
1 merge request!111feat: traffic server charts
Showing
with 359 additions and 0 deletions
......@@ -50,6 +50,10 @@ dependencies:
name: oai-smf
repository: "file://../oai-smf"
version: v1.5.0
- condition: oai-traffic-server.enabled
name: oai-traffic-server
repository: "file://../oai-traffic-server"
version: v1
- condition: oai-spgwu-tiny.enabled
name: oai-spgwu-tiny
repository: "file://../oai-spgwu-tiny"
......
......@@ -127,6 +127,25 @@ oai-spgwu-tiny:
dnn1: "ims" # should match with SMF information
logLevel: "debug"
nodeSelector: {}
oai-traffic-server:
enabled: true
weight: 6
kubernetesType: Openshift #Openshift/Vanilla Vanilla for Upstream Kubernetes
trafficServer:
repository: image-registry.openshift-image-registry.svc:5000/oaicicd-core/oai-traffic-server
version: latest
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: IfNotPresent
multus:
create: true
n3Ip: "172.21.6.202"
n3Netmask: "22"
n6Gw: "172.21.7.254"
hostInterface: "bond0"
config:
ueroute: 12.1.1.0/24
upfIpadd: 172.21.6.201
noOfIperf3Server: 2
oai-smf:
enabled: true
weight: 6
......
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
apiVersion: v2
name: oai-traffic-server
description: Helm chart for oai-traffic-server
type: application
icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png
version: v1
appVersion: v1
keywords:
- iperf
sources:
- https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed
- https://openairinterface.org/
maintainers:
- name: OPENAIRINTERFACE
email: contact@openairinterface.org
1. Get the application name by running these commands:
export traffic_server_POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-traffic-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "oai-traffic-server.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 "oai-traffic-server.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 "oai-traffic-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "oai-traffic-server.labels" -}}
helm.sh/chart: {{ include "oai-traffic-server.chart" . }}
{{ include "oai-traffic-server.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "oai-traffic-server.selectorLabels" -}}
app.kubernetes.io/name: {{ include "oai-traffic-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "oai-traffic-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "oai-traffic-server.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: iperf-pod
data:
script.sh: |
#!/bin/sh
ip route add {{ .Values.config.ueroute }} via {{ .Values.config.upfIpadd }} dev net1
num_servers={{ .Values.config.noOfIperf3Server }}
base_port=5001
# Run iperf multiple times
for i in `seq 1 $num_servers`; do
# Set server port
server_port=$(($base_port+$i));
# Report file includes server port
report_file=iperf3-${server_port}.txt
# Run iperf
iperf3 -s --daemon -p $server_port
done
/bin/bash -c 'trap : TERM INT; sleep infinity & wait'
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app.kubernetes.io/version: "v1"
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Chart.Name }}
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Chart.Name }}
annotations:
k8s.v1.cni.cncf.io/networks: >-
[{
"name": "{{ .Chart.Name }}-net1",
"default-route": ["{{ .Values.multus.Gateway }}"]
}]
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: iperf3
volumeMounts:
- mountPath: /tmp/script.sh
name: scripts
subPath: script.sh
command: ["./tmp/script.sh"]
image: "{{ .Values.trafficServer.repository }}:{{ .Values.trafficServer.version }}"
imagePullPolicy: IfNotPresent
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.readinessProbe}}
readinessProbe:
exec:
command:
- pgrep
- iperf3
initialDelaySeconds: 5
periodSeconds: 3
{{- end}}
{{- if .Values.livenessProbe}}
livenessProbe:
exec:
command:
- pgrep
- iperf3
initialDelaySeconds: 10
periodSeconds: 5
{{- end}}
volumes:
- name: scripts
configMap:
name: iperf-pod
defaultMode: 0777
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
serviceAccountName: {{ .Values.serviceAccount.name }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if .Values.nodeSelector}}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 12 }}
{{- end }}
{{- if .Values.nodeName}}
nodeName: {{ .Values.nodeName }}
{{- end }}
\ No newline at end of file
{{- if .Values.multus.create }}
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: {{ .Chart.Name }}-net1
spec:
config: '{
"cniVersion": "0.3.0",
"type": "macvlan",
"master": {{- cat .Values.multus.hostInterface | nospace | quote }},
"mode": "bridge",
"ipam": {
"type": "static",
"addresses": [
{
"address": {{- cat .Values.multus.IPadd "/" .Values.multus.Netmask | nospace | quote }}
}
]
}
}'
{{- end }}
---
{{- if eq .Values.kubernetesType "Openshift" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role
rules:
- apiGroups:
- security.openshift.io
resourceNames:
- privileged
resources:
- securitycontextconstraints
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Chart.Name }}-{{ .Release.Namespace }}-binding
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role
apiGroup: rbac.authorization.k8s.io
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name }}
\ No newline at end of file
kubernetesType: Vanilla #Vanilla for community kubernetes distribution
podSecurityContext:
runAsUser: 0
runAsGroup: 0
trafficServer:
repository: image-registry.openshift-image-registry.svc:5000/oaicicd-core/oai-traffic-server
version: latest
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: IfNotPresent
serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: "oai-traffic-server"
securityContext:
privileged: true
multus:
create: true
IPadd: "172.21.6.202"
Netmask: "22"
Gateway: "172.21.7.254"
hostInterface: "bond0" # Interface of the host machine on which this pod will be scheduled
config:
ueroute: 12.1.1.0/24
upfIpadd: 172.21.6.201
noOfIperf3Server: 10
readinessProbe: true
livenessProbe: false
terminationGracePeriodSeconds: 2
nodeSelector: {}
nodeName:
\ No newline at end of file
<!DOCTYPE html>
<html class="no-js" lang="en-US">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>OAI Core Network Test Results for JOB_NAME job build #BUILD_ID</title>
<style>
.badge-primary {
color: #ebeef0;
background-color: #000080;
}
.badge-danger {
color: #ebeef0;
background-color: #FF0000;
}
</style>
</head>
<body>
<div class="container-fluid" style="margin-left:1em; margin-right:1em">
<table width = "100%" style="border-collapse: collapse; border: none;">
<tr style="border-collapse: collapse; border: none;">
<td style="border-collapse: collapse; border: none;">
<a href="http://www.openairinterface.org/">
<img src="http://www.openairinterface.org/wp-content/uploads/2016/03/cropped-oai_final_logo2.png" alt="" border="none" height=50 width=150>
</img>
</a>
</td>
<td style="border-collapse: collapse; border: none; vertical-align: center;">
<b><font size = "6">Job Summary -- Job: JOB_NAME -- Build-ID: <a href="BUILD_URL">BUILD_ID</a></font></b>
</td>
</tr>
</table>
<br>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment