Commit 6d7b8777 authored by Javier Velázquez's avatar Javier Velázquez
Browse files

Create Helm chart

parent 3434f4ee
Loading
Loading
Loading
Loading

helm/nsc/Chart.yaml

0 → 100644
+6 −0
Original line number Diff line number Diff line
apiVersion: v2
name: nsc
description: A Helm chart for Kubernetes deployment of the Network Slice Controller (NSC)
type: application
version: 0.1.0
appVersion: "1.0.0"
+62 −0
Original line number Diff line number Diff line
{{/*
Expand the name of the chart.
*/}}
{{- define "nsc.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 "nsc.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 "nsc.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "nsc.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "nsc.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
+29 −0
Original line number Diff line number Diff line
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "nsc.fullname" . }}-config
  labels:
    {{- include "nsc.labels" . | nindent 4 }}
data:
  NSC_PORT: {{ .Values.service.port | quote }}
  LOGGING_LEVEL: {{ .Values.config.loggingLevel | quote }}
  DUMP_TEMPLATES: {{ .Values.config.dumpTemplates | quote }}
  NRP_ENABLED: {{ .Values.config.nrpEnabled | quote }}
  PLANNER_ENABLED: {{ .Values.config.plannerEnabled | quote }}
  PCE_EXTERNAL: {{ .Values.config.pceExternal | quote }}
  PLANNER_TYPE: {{ .Values.config.plannerType | quote }}
  HRAT_IP: {{ .Values.config.hratIp | quote }}
  E2E_OPTICAL_IP: {{ .Values.config.e2eOpticalIp | quote }}
  SUBSCRIBE_ALERTS: {{ .Values.config.subscribeAlerts | quote }}
  SUBSCRIBE_ALERTS_URL: {{ .Values.config.subscribeAlertsUrl | quote }}
  DUMMY_MODE: {{ .Values.config.dummyMode | quote }}
  TFS_IP: {{ .Values.config.tfsIp | quote }}
  UPLOAD_TYPE: {{ .Values.config.uploadType | quote }}
  TFS_L2VPN_SUPPORT: {{ .Values.config.tfsL2vpnSupport | quote }}
  IXIA_IP: {{ .Values.config.ixiaIp | quote }}
  TFS_E2E_IP: {{ .Values.config.tfsE2eIp | quote }}
  RESTCONF_IP: {{ .Values.config.restconfIp | quote }}
  SDN_CONTROLLER_TYPE: {{ .Values.config.sdnControllerType | quote }}
  DATAPLANE_SUPPORT: {{ .Values.config.dataplaneSupport | quote }}
  SDN_SUBSCRIPTION_PERIOD: {{ .Values.config.sdnSubscriptionPeriod | quote }}
  WEBUI_DEPLOY: {{ .Values.config.webuiDeploy | quote }}
+82 −0
Original line number Diff line number Diff line
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "nsc.fullname" . }}
  labels:
    {{- include "nsc.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "nsc.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        rollout-timestamp: {{ now | quote }}
        {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        {{- include "nsc.selectorLabels" . | nindent 8 }}
        {{- with .Values.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "nsc.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{ .Values.service.port }}
              protocol: TCP
          envFrom:
            - configMapRef:
                name: {{ include "nsc.fullname" . }}-config
            - secretRef:
                name: {{ include "nsc.fullname" . }}-secret
          {{- if .Values.probes.liveness.enabled }}
          livenessProbe:
            httpGet:
              path: /nsc
              port: http
            initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
            periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
            timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
            failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
          {{- end }}
          {{- if .Values.probes.readiness.enabled }}
          readinessProbe:
            httpGet:
              path: /nsc
              port: http
            initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
            periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
            timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
            failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
          {{- end }}
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
+43 −0
Original line number Diff line number Diff line
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "nsc.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include "nsc.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- if .Values.ingress.className }}
  ingressClassName: {{ .Values.ingress.className }}
  {{- end }}
  {{- if .Values.ingress.tls }}
  tls:
    {{- range .Values.ingress.tls }}
    - hosts:
        {{- range .hosts }}
        - {{ . | quote }}
        {{- end }}
      secretName: {{ .secretName }}
    {{- end }}
  {{- end }}
  rules:
    {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
          {{- range .paths }}
          - path: {{ .path }}
            pathType: {{ .pathType }}
            backend:
              service:
                name: {{ $fullName }}
                port:
                  number: {{ $svcPort }}
          {{- end }}
    {{- end }}
{{- end }}
Loading