Testing of creating helm for progran onos
Change-Id: I7a70bf757b3d53297f7c4cf5d73da378b8840570
diff --git a/onos-progran/templates/_helpers.tpl b/onos-progran/templates/_helpers.tpl
new file mode 100644
index 0000000..372e3c9
--- /dev/null
+++ b/onos-progran/templates/_helpers.tpl
@@ -0,0 +1,111 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Copyright 2018-present Open Networking Foundation
+
+Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+
+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.
+*/}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "onos.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 "onos.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 "onos.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "onos.logCfg" -}}
+################################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+################################################################################
+
+# Root logger
+log4j.rootLogger=INFO, out, json, osgi:*, stdout
+log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.RollingFileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+log4j.appender.out.file=${karaf.data}/log/karaf.log
+log4j.appender.out.append=true
+log4j.appender.out.maxFileSize=10MB
+log4j.appender.out.maxBackupIndex=10
+
+# JSON-ish appender (doesn't handle quotes in fields correctly)
+# docs: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
+log4j.appender.json=org.apache.log4j.RollingFileAppender
+log4j.appender.json.layout=org.apache.log4j.PatternLayout
+log4j.appender.json.layout.ConversionPattern={"@timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}","levelname":"%p","threadName":"%t","category":"%c{1}","bundle.id":"%X{bundle.id}","bundle.name":"%X{bundle.name}","bundle.version":"%X{bundle.version}","message":"%m"}%n
+log4j.appender.json.file=${karaf.data}/log/karaf_json.log
+log4j.appender.json.append=true
+log4j.appender.json.maxFileSize=10MB
+log4j.appender.json.maxBackupIndex=10
+
+# Sift appender - one logfile per bundle ID
+log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
+log4j.appender.sift.key=bundle.name
+log4j.appender.sift.default=karaf
+log4j.appender.sift.appender=org.apache.log4j.FileAppender
+log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
+log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n
+log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
+log4j.appender.sift.appender.append=true
+
+# Application logs
+{{ .Values.application_logs }}
+
+{{- end -}}
+
diff --git a/onos-progran/templates/onos-progran-configmap.yaml b/onos-progran/templates/onos-progran-configmap.yaml
new file mode 100644
index 0000000..ed068bc
--- /dev/null
+++ b/onos-progran/templates/onos-progran-configmap.yaml
@@ -0,0 +1,22 @@
+---
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: onos
+data:
+ logCfg: |
+{{ include "onos.logCfg" . | indent 4 }}
diff --git a/onos-progran/templates/onos-progran-debugger-service.yaml b/onos-progran/templates/onos-progran-debugger-service.yaml
new file mode 100644
index 0000000..f3cce87
--- /dev/null
+++ b/onos-progran/templates/onos-progran-debugger-service.yaml
@@ -0,0 +1,33 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "onos.fullname" . }}-debugger
+ namespace: {{ .Values.namespace }}
+ labels:
+ app: {{ template "onos.name" . }}
+ chart: {{ template "onos.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ type: {{ .Values.services.debuggerServiceType }}
+ ports:
+ - name: debugger
+{{ toYaml .Values.services.debugger | indent 4 }}
+ selector:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+
diff --git a/onos-progran/templates/onos-progran-deployment.yaml b/onos-progran/templates/onos-progran-deployment.yaml
new file mode 100644
index 0000000..60a9550
--- /dev/null
+++ b/onos-progran/templates/onos-progran-deployment.yaml
@@ -0,0 +1,134 @@
+---
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: apps/v1beta2
+kind: Deployment
+metadata:
+ name: {{ template "onos.fullname" . }}
+ namespace: {{ .Values.namespace }}
+ labels:
+ app: {{ template "onos.name" . }}
+ chart: {{ template "onos.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+{{- if .Values.xos_service_label }}
+ xos_service: {{ .Values.xos_service_label }}
+{{- end }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+ template:
+ metadata:
+ labels:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+{{- if .Values.xos_service_label }}
+ xos_service: {{ .Values.xos_service_label }}
+{{- end }}
+ spec:
+ serviceAccount: {{ .Values.serviceAccountName }}
+ serviceAccountName: {{ .Values.serviceAccountName }}
+ containers:
+ - name: {{ .Chart.Name }}
+ image: "{{ .Values.global.registry }}{{ .Values.images.onos.repository }}:{{ tpl .Values.images.onos.tag . }}"
+ imagePullPolicy: {{ .Values.images.onos.pullPolicy }}
+ command: ["./bin/onos-service", "server", "debug"]
+ env:
+{{ toYaml .Values.onos_env | indent 12 }}
+ ports:
+ - name: ovsdb
+ containerPort: {{ .Values.services.ovsdb.port }}
+ - name: openflow
+ containerPort: {{ .Values.services.openflow.port }}
+ - name: ssh
+ containerPort: {{ .Values.services.ssh.port }}
+ - name: ui
+ containerPort: {{ .Values.services.ui.port }}
+ - name: cluster
+ containerPort: {{ .Values.services.cluster.port }}
+ - name: debugger
+ containerPort: {{ .Values.services.debugger.port }}
+ resources:
+{{ toYaml .Values.resources | indent 12 }}
+ volumeMounts:
+ - name: node-key
+ mountPath: /root/vtn
+ readOnly: true
+ - name: onos-logs-cfg
+ mountPath: /root/onos/apache-karaf-3.0.8/etc/org.ops4j.pax.logging.cfg
+ subPath: org.ops4j.pax.logging.cfg
+ - name: onos-logs
+ mountPath: /root/onos/apache-karaf-3.0.8/data/log
+{{- if .Values.log_agent.enabled }}
+ - name: {{ .Chart.Name }}-log-agent
+ image: "{{ .Values.global.registry }}{{ .Values.images.log_agent.repository }}:{{ .Values.images.log_agent.tag }}"
+ imagePullPolicy: {{ .Values.images.log_agent.pullPolicy }}
+ args: [ "-c", "/conf/filebeat.yml", "-e" ]
+ env:
+ - name: POD_NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: NODE_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: spec.nodeName
+ volumeMounts:
+ - name: onos-logs
+ mountPath: /onos_logs
+ - name: log-agent-configmap-volume
+ mountPath: /conf
+{{- end }}
+ volumes:
+ - name: node-key
+ secret:
+ secretName: node-key
+ defaultMode: 256
+ optional: true
+ - name: onos-logs-cfg
+ configMap:
+ name: onos
+ items:
+ - key: logCfg
+ path: org.ops4j.pax.logging.cfg
+ - name: onos-logs
+ emptyDir: {}
+{{- if .Values.log_agent.enabled }}
+ - name: log-agent-configmap-volume
+ configMap:
+ name: log-agent-configmap
+ items:
+ - key: config
+ path: filebeat.yml
+{{- end }}
+{{- with .Values.nodeSelector }}
+ nodeSelector:
+{{ toYaml . | indent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+ affinity:
+{{ toYaml . | indent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+ tolerations:
+{{ toYaml . | indent 8 }}
+ {{- end }}
+{{- if .Values.log_agent.enabled }}
+{{- include "onos.log-agent-configmap" . }}
+{{- end }}
+
diff --git a/onos-progran/templates/onos-progran-log-agent-configmap.yaml b/onos-progran/templates/onos-progran-log-agent-configmap.yaml
new file mode 100644
index 0000000..e94bf33
--- /dev/null
+++ b/onos-progran/templates/onos-progran-log-agent-configmap.yaml
@@ -0,0 +1,52 @@
+{{- /*
+Copyright 2017-present Open Networking Foundation
+
+Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+
+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.
+*/ -}}
+{{- define "onos.log-agent-configmap" }}
+---
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ name: log-agent-configmap
+data:
+ config: |
+ ---
+ # filebeat configuration for ONOS
+ filebeat.inputs:
+ - type: log
+ paths:
+ - "/onos_logs/karaf_json.log"
+
+ fields_under_root: true
+
+ json.keys_under_root: true
+ json.add_error_key: true
+ json.overwrite_keys: true
+ json.message_key: "message"
+
+ multiline.pattern: '^[[:space:]]'
+ multiline.negate: false
+ multiline.match: after
+
+ # remove unneeded fields
+ processors:
+ - drop_fields:
+ fields: ["host", "prospector", "input"]
+
+ output.kafka:
+ hosts: {{ .Values.log_agent.kafka_brokers | toJson }}
+ topic: 'onos.log'
+ key: '%{[bundle.name]}'
+
+{{- end }}
diff --git a/onos-progran/templates/onos-progran-openflow-service.yaml b/onos-progran/templates/onos-progran-openflow-service.yaml
new file mode 100644
index 0000000..1328acc
--- /dev/null
+++ b/onos-progran/templates/onos-progran-openflow-service.yaml
@@ -0,0 +1,33 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "onos.fullname" . }}-openflow
+ namespace: {{ .Values.namespace }}
+ labels:
+ app: {{ template "onos.name" . }}
+ chart: {{ template "onos.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ type: {{ .Values.services.openflowServiceType }}
+ ports:
+ - name: openflow
+{{ toYaml .Values.services.openflow | indent 4 }}
+ selector:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+
diff --git a/onos-progran/templates/onos-progran-ovsdb-service.yaml b/onos-progran/templates/onos-progran-ovsdb-service.yaml
new file mode 100644
index 0000000..52c5c86
--- /dev/null
+++ b/onos-progran/templates/onos-progran-ovsdb-service.yaml
@@ -0,0 +1,33 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "onos.fullname" . }}-ovsdb
+ namespace: {{ .Values.namespace }}
+ labels:
+ app: {{ template "onos.name" . }}
+ chart: {{ template "onos.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ type: {{ .Values.services.ovsdbServiceType }}
+ ports:
+ - name: ovsdb
+{{ toYaml .Values.services.ovsdb | indent 4 }}
+ selector:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+
diff --git a/onos-progran/templates/onos-progran-ssh-service.yaml b/onos-progran/templates/onos-progran-ssh-service.yaml
new file mode 100644
index 0000000..1af1e16
--- /dev/null
+++ b/onos-progran/templates/onos-progran-ssh-service.yaml
@@ -0,0 +1,33 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "onos.fullname" . }}-ssh
+ namespace: {{ .Values.namespace }}
+ labels:
+ app: {{ template "onos.name" . }}
+ chart: {{ template "onos.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ type: {{ .Values.services.sshServiceType }}
+ ports:
+ - name: ssh
+{{ toYaml .Values.services.ssh | indent 4 }}
+ selector:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+
diff --git a/onos-progran/templates/onos-progran-ui-service.yaml b/onos-progran/templates/onos-progran-ui-service.yaml
new file mode 100644
index 0000000..fd6274e
--- /dev/null
+++ b/onos-progran/templates/onos-progran-ui-service.yaml
@@ -0,0 +1,33 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "onos.fullname" . }}-ui
+ namespace: {{ .Values.namespace }}
+ labels:
+ app: {{ template "onos.name" . }}
+ chart: {{ template "onos.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ type: {{ .Values.services.uiServiceType }}
+ ports:
+ - name: ui
+{{ toYaml .Values.services.ui | indent 4 }}
+ selector:
+ app: {{ template "onos.name" . }}
+ release: {{ .Release.Name }}
+