[VOL-3678] Creating helm-chart for bbsim-sadis-server

Change-Id: I66c54b9dc7bcbbe8ce91b47320406be24503ce7e
diff --git a/bbsim-sadis-server/Chart.yaml b/bbsim-sadis-server/Chart.yaml
new file mode 100644
index 0000000..13ef6ac
--- /dev/null
+++ b/bbsim-sadis-server/Chart.yaml
@@ -0,0 +1,35 @@
+# Copyright 2020-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"
+name: "bbsim-sadis-server"
+version: "0.0.1"
+description: "A Helm chart for Voltha BBSIM sadis server"
+keywords:
+  - "onf"
+  - "voltha"
+  - "sadis"
+  - "bbsim"
+home: "https://www.opennetworking.org/voltha"
+icon: "https://guide.opencord.org/logos/voltha.svg"
+sources:
+  - "https://github.com/opencord/bbsim-sadis-server"
+maintainers:
+  - name: "Open Networking Foundation"
+    email: "info@opennetworking.org"
+    url: "https://www.opennetworking.org"
+
+# appVersion refers to multiple components with potentially different
+# container image versions.
+appVersion: "0.1.0"
diff --git a/bbsim-sadis-server/templates/clusterrole.yaml b/bbsim-sadis-server/templates/clusterrole.yaml
new file mode 100644
index 0000000..92f12f1
--- /dev/null
+++ b/bbsim-sadis-server/templates/clusterrole.yaml
@@ -0,0 +1,23 @@
+# Copyright 2020-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: "rbac.authorization.k8s.io/v1"
+kind: "ClusterRole"
+metadata:
+  name: "{{ .Release.Name }}-pod-svc-reader"
+  namespace: {{ .Release.Namespace | quote }}
+rules:
+  - apiGroups: [""]
+    resources: ["pods", "services"]
+    verbs: ["get", "list"]
diff --git a/bbsim-sadis-server/templates/clusterrolebinding.yaml b/bbsim-sadis-server/templates/clusterrolebinding.yaml
new file mode 100644
index 0000000..500e69c
--- /dev/null
+++ b/bbsim-sadis-server/templates/clusterrolebinding.yaml
@@ -0,0 +1,27 @@
+# Copyright 2020-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: "rbac.authorization.k8s.io/v1"
+kind: "ClusterRoleBinding"
+metadata:
+  name: "{{ .Release.Name }}-pod-svc-reader-binding"
+  namespace: {{ .Release.Namespace | quote }}
+subjects:
+  - kind: "ServiceAccount"
+    name: "{{ .Release.Name }}-service-account"
+    namespace: {{ .Release.Namespace | quote }}
+roleRef:
+    kind: "ClusterRole"
+    name: "{{ .Release.Name }}-pod-svc-reader"
+    apiGroup: "rbac.authorization.k8s.io"
diff --git a/bbsim-sadis-server/templates/deployment.yaml b/bbsim-sadis-server/templates/deployment.yaml
new file mode 100644
index 0000000..b879c9c
--- /dev/null
+++ b/bbsim-sadis-server/templates/deployment.yaml
@@ -0,0 +1,57 @@
+# Copyright 2020-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/v1"
+kind: "Deployment"
+metadata:
+  name: "bbsim-sadis-server"
+  namespace: {{ .Release.Namespace | quote }}
+spec:
+  replicas: {{ .Values.replicas | int }}
+  selector:
+    matchLabels:
+      app: "bbsim-sadis-server"
+      release: {{ .Release.Name | quote }}
+  template:
+    metadata:
+      namespace: {{ .Release.Namespace | quote }}
+      labels:
+        app: "bbsim-sadis-server"
+        release: {{ .Release.Name | quote }}
+        app.kubernetes.io/name: "bbsim-sadis-server"
+        app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+        app.kubernetes.io/component: "sadis-server"
+        app.kubernetes.io/part-of: "voltha"
+        app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+        helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    spec:
+      serviceAccountName: {{ default (printf "%s-%s" .Release.Name "service-account") .Values.serviceAccountName | quote }}
+      containers:
+        - name: "sadis"
+          image: "{{ tpl .Values.images.bbsim_sadis_server.registry . }}{{ tpl .Values.images.bbsim_sadis_server.repository . }}:{{ tpl ( tpl .Values.images.bbsim_sadis_server.tag . ) . }}"
+          imagePullPolicy: {{ tpl .Values.images.bbsim_sadis_server.pullPolicy . | quote }}
+          command: [ "/app/bbsim-sadis-server" ]
+          args:
+            - "-log_level={{.Values.defaults.log_level}}"
+            - "-log_format={{.Values.defaults.log_format}}"
+            - "-bbsim_sadis_port={{.Values.bbsim_sadis_port}}"
+          volumeMounts:
+            - name: kube-config-volume
+              mountPath: /etc/kube
+      volumes:
+        - name: kube-config-volume
+          configMap:
+            # Provide the name of the ConfigMap containing the files you want
+            # to add to the container
+            name: kube-config
diff --git a/bbsim-sadis-server/templates/service.yaml b/bbsim-sadis-server/templates/service.yaml
new file mode 100644
index 0000000..6473cbb
--- /dev/null
+++ b/bbsim-sadis-server/templates/service.yaml
@@ -0,0 +1,27 @@
+# Copyright 2020-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: "bbsim-sadis-server"
+  namespace: {{ .Release.Namespace | quote }}
+spec:
+  ports:
+    - name: "http"
+      port: 58080
+      targetPort: 8080
+  selector:
+    app: "bbsim-sadis-server"
+    release: {{ .Release.Name | quote }}
diff --git a/bbsim-sadis-server/templates/serviceaccount.yaml b/bbsim-sadis-server/templates/serviceaccount.yaml
new file mode 100644
index 0000000..1d5948a
--- /dev/null
+++ b/bbsim-sadis-server/templates/serviceaccount.yaml
@@ -0,0 +1,19 @@
+# Copyright 2020-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: "ServiceAccount"
+metadata:
+  name: "{{ .Release.Name }}-service-account"
+  namespace: {{ .Release.Namespace | quote }}
diff --git a/bbsim-sadis-server/values.yaml b/bbsim-sadis-server/values.yaml
new file mode 100644
index 0000000..bc2d5ef
--- /dev/null
+++ b/bbsim-sadis-server/values.yaml
@@ -0,0 +1,35 @@
+# Copyright 2020-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.
+---
+# Default overrides
+defaults:
+  log_level: "WARN"
+  log_format: "json"
+  image_registry: ""
+  image_tag: ~
+  image_org: "voltha/"
+  image_pullPolicy: "Always"
+
+replicas: 1
+
+bbsim_sadis_port: 50074
+
+serviceAccountName: ~
+
+images:
+  bbsim_sadis_server:
+    registry: '{{ .Values.defaults.image_registry }}'
+    repository: '{{ .Values.defaults.image_org }}bbsim-sadis-server'
+    tag: '{{- if hasKey .Values.defaults "image_tag" }}{{- if .Values.defaults.image_tag }}{{ .Values.defaults.image_tag }}{{- else }}{{ .Chart.AppVersion }}{{- end }}{{- else }}{{ .Chart.AppVersion }}{{- end }}'
+    pullPolicy: '{{ .Values.defaults.image_pullPolicy | default "Always" }}'