AETHER-3577 initial charts for fabric adapter
Change-Id: I3ca0ed422df61b7cb10d63da7f4d2ea5362659c9
diff --git a/fabric-adapter/templates/_helpers.tpl b/fabric-adapter/templates/_helpers.tpl
new file mode 100644
index 0000000..7878594
--- /dev/null
+++ b/fabric-adapter/templates/_helpers.tpl
@@ -0,0 +1,57 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+SPDX-FileCopyrightText: 2022-present Intel Corporation
+SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+SPDX-License-Identifier: Apache-2.0
+
+Expand the name of the chart.
+*/}}
+{{- define "fabric-adapter.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 "fabric-adapter.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 "fabric-adapter.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+
+{{/*
+Common labels
+*/}}
+{{- define "fabric-adapter.labels" -}}
+helm.sh/chart: {{ include "fabric-adapter.chart" . }}
+{{ include "fabric-adapter.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end -}}
+
+{{/*
+Selector labels
+*/}}
+{{- define "fabric-adapter.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "fabric-adapter.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end -}}
diff --git a/fabric-adapter/templates/configmap.yaml b/fabric-adapter/templates/configmap.yaml
new file mode 100644
index 0000000..74912b8
--- /dev/null
+++ b/fabric-adapter/templates/configmap.yaml
@@ -0,0 +1,17 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ template "fabric-adapter.fullname" . }}-logconfig
+ labels:
+ app: {{ template "fabric-adapter.fullname" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+data:
+ logging.yaml: |-
+{{ toYaml .Values.logging | indent 4 }}
diff --git a/fabric-adapter/templates/deployment.yaml b/fabric-adapter/templates/deployment.yaml
new file mode 100644
index 0000000..8729d19
--- /dev/null
+++ b/fabric-adapter/templates/deployment.yaml
@@ -0,0 +1,92 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ template "fabric-adapter.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ name: {{ template "fabric-adapter.fullname" . }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ {{- include "fabric-adapter.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ labels:
+ name: {{ template "fabric-adapter.fullname" . }}
+ {{- include "fabric-adapter.selectorLabels" . | nindent 8 }}
+ spec:
+ {{- with .Values.imagePullSecrets }}
+ imagePullSecrets:
+ {{- toYaml . | nindent 6 }}
+ {{- end }}
+ securityContext:
+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
+ containers:
+ - name: {{ .Chart.Name }}
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ env:
+ - name: POD_NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: NODE_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: spec.nodeName
+ args:
+ - "/usr/local/bin/fabric-adapter"
+ - "-bind_address=:{{ .Values.ports.gnmi.secure }}"
+ - "-key=/etc/fabric-adapter/certs/tls.key"
+ - "-cert=/etc/fabric-adapter/certs/tls.crt"
+ - "-ca=/etc/fabric-adapter/certs/tls.cacert"
+ - "-alsologtostderr"
+ - "-hostCheckDisabled"
+ {{ if .Values.defaultTarget }}
+ - "-default_target={{ .Values.defaultTarget }}"
+ {{ end }}
+ {{ if not .Values.partialUpdateEnabled }}
+ - "-partial_update_disable"
+ {{ end }}
+ {{ if .Values.kafkaURI }}
+ - "-kafka_uri={{ .Values.kafkaURI }}"
+ {{ end }}
+ ports:
+ {{- range $key, $port := .Values.ports.gnmi }}
+ - name: gnmi{{ $key }}
+ containerPort: {{ $port }}
+ {{- end}}
+ readinessProbe:
+ tcpSocket:
+ port: {{ .Values.ports.gnmi.secure }}
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ livenessProbe:
+ tcpSocket:
+ port: {{ .Values.ports.gnmi.secure }}
+ initialDelaySeconds: 15
+ periodSeconds: 20
+ volumeMounts:
+ - name: secret
+ mountPath: /etc/fabric-adapter/certs
+ readOnly: true
+ - name: logconfig
+ mountPath: /etc/onos/config
+ readOnly: true
+ volumes:
+ - name: logconfig
+ configMap:
+ name: {{ template "fabric-adapter.fullname" . }}-logconfig
+ - name: secret
+ secret:
+ secretName: {{ template "fabric-adapter.fullname" . }}-secret
diff --git a/fabric-adapter/templates/secret.yaml b/fabric-adapter/templates/secret.yaml
new file mode 100644
index 0000000..11ed1c1
--- /dev/null
+++ b/fabric-adapter/templates/secret.yaml
@@ -0,0 +1,19 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ template "fabric-adapter.fullname" . }}-secret
+ labels:
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+data:
+ {{ $root := . }}
+ {{ range $path, $bytes := .Files.Glob "files/certs/tls.*" }}
+ {{ base $path }}: '{{ $root.Files.Get $path | b64enc }}'
+ {{ end }}
+type: Opaque
diff --git a/fabric-adapter/templates/service.yaml b/fabric-adapter/templates/service.yaml
new file mode 100644
index 0000000..43c92ba
--- /dev/null
+++ b/fabric-adapter/templates/service.yaml
@@ -0,0 +1,28 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "fabric-adapter.fullname" . }}
+ labels:
+ app: {{ template "fabric-adapter.fullname" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+ {{- include "fabric-adapter.labels" . | nindent 4 }}
+spec:
+ type: {{ .Values.service.type }}
+ selector:
+ name: {{ template "fabric-adapter.fullname" . }}
+ ports:
+ {{- range $key, $port := .Values.ports.gnmi }}
+ - name: gnmi{{ $key }}
+ port: {{ $port }}
+ {{- end}}
+ - name: prometheus
+ port: {{ .Values.ports.prometheus }}
+ - name: diag-api
+ port: {{ .Values.ports.diagApi }}
diff --git a/fabric-adapter/templates/servicemonitor.yaml b/fabric-adapter/templates/servicemonitor.yaml
new file mode 100644
index 0000000..8f7f55d
--- /dev/null
+++ b/fabric-adapter/templates/servicemonitor.yaml
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{{- if eq .Values.prometheusEnabled true }}
+
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+ name: fabric-adapter
+ labels:
+ {{- include "fabric-adapter.labels" . | nindent 4 }}
+spec:
+ selector:
+ matchLabels:
+ {{- include "fabric-adapter.selectorLabels" . | nindent 6 }}
+ endpoints:
+ - port: prometheus
+ path: /metrics
+ scheme: HTTP
+{{ end }}