From 868b0a0c77a0315b21761c0a8c5a809153760e04 Mon Sep 17 00:00:00 2001
From: rjshrjndrn <rjshrjndrn@gmail.com>
Date: Tue, 26 Nov 2019 20:59:26 +0530
Subject: [PATCH] nginx public ingress

---
 .../templates/deployment.yaml                 | 80 +++++++++----------
 .../core/nginx-public-ingress/values.j2       | 10 +++
 2 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/kubernetes/helm_charts/core/nginx-public-ingress/templates/deployment.yaml b/kubernetes/helm_charts/core/nginx-public-ingress/templates/deployment.yaml
index 0824f6753..88ecca9de 100644
--- a/kubernetes/helm_charts/core/nginx-public-ingress/templates/deployment.yaml
+++ b/kubernetes/helm_charts/core/nginx-public-ingress/templates/deployment.yaml
@@ -1,55 +1,49 @@
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: {{ include "nginx-public-ingress.fullname" . }}
-  labels:
-    {{- include "nginx-public-ingress.labels" . | nindent 4 }}
+  name: public-nginx-ingress
+  namespace: {{ .Values.namespace }}
 spec:
-  replicas: {{ .Values.replicaCount }}
+  replicas: 1
   selector:
     matchLabels:
-      {{- include "nginx-public-ingress.selectorLabels" . | nindent 6 }}
+      app: public-nginx-ingress
   template:
     metadata:
       labels:
-        {{- include "nginx-public-ingress.selectorLabels" . | nindent 8 }}
+        app: public-nginx-ingress
     spec:
-    {{- with .Values.imagePullSecrets }}
+      {{- if .Values.imagePullSecrets }}
       imagePullSecrets:
-        {{- toYaml . | nindent 8 }}
-    {{- end }}
-      serviceAccountName: {{ include "nginx-public-ingress.serviceAccountName" . }}
-      securityContext:
-        {{- toYaml .Values.podSecurityContext | nindent 8 }}
-      containers:
-        - name: {{ .Chart.Name }}
-          securityContext:
-            {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
-          imagePullPolicy: {{ .Values.image.pullPolicy }}
-          ports:
-            - name: http
-              containerPort: 80
-              protocol: TCP
-          livenessProbe:
-            httpGet:
-              path: /
-              port: http
-          readinessProbe:
-            httpGet:
-              path: /
-              port: http
-          resources:
-            {{- toYaml .Values.resources | nindent 12 }}
-      {{- with .Values.nodeSelector }}
-      nodeSelector:
-        {{- toYaml . | nindent 8 }}
+      - name: {{ .Values.imagepullsecrets }}
       {{- end }}
-    {{- with .Values.affinity }}
-      affinity:
-        {{- toYaml . | nindent 8 }}
-    {{- end }}
-    {{- with .Values.tolerations }}
-      tolerations:
-        {{- toYaml . | nindent 8 }}
-    {{- end }}
+      {{- if .Values.sunbird_portal_player_cdn_enabled }}
+      containers:
+      - name: name
+        image: "{{ .Values.dockerhub }}/{{ .Values.repository }}:{{ .Values.image_tag }}"
+        resources:
+          requests:
+            cpu: 100m
+            memory: 200Mi
+        ports:
+        - containerPort: 80
+          name: http
+        - containerPort: 443
+          name: https
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: public-nginx-ingress
+  namespace: {{ .Values.namespace }}
+spec:
+  type: LoadBalancer
+  ports:
+  - port: 80
+    name: http
+    targetPort: 80
+  - port: 443
+    name: https
+    targetPort: 443
+  selector:
+    app: public-nginx-ingress
diff --git a/kubernetes/helm_charts/core/nginx-public-ingress/values.j2 b/kubernetes/helm_charts/core/nginx-public-ingress/values.j2
index 9aef5b357..03980318d 100644
--- a/kubernetes/helm_charts/core/nginx-public-ingress/values.j2
+++ b/kubernetes/helm_charts/core/nginx-public-ingress/values.j2
@@ -1,5 +1,15 @@
 #jinja2:lstrip_blocks: True
+
 namespace: {{ namespace }}
+imagepullsecrets: {{ imagepullsecrets }}
+dockerhub: {{ dockerhub }}
+
+replicaCount: {{replicacount|default(1)}}
+repository: {{proxy.repository|default('player')}}
+image_tag: {{ proxy.image_tag }}
+resources:
+  cpu: {{player_service_cpu|default('50m')}}
+  memory: {{player_service_memory|default('50Mi')}}
 proxyconfig: |
   {% if proto=='https' %}
   server {
-- 
GitLab