From 4136f5d8e1bfe9b967266ff7f57787871748ddcc Mon Sep 17 00:00:00 2001 From: vaibhavjayas Date: Fri, 17 Aug 2018 07:01:05 +0000 Subject: Resource Limits for policy Issue-ID: OOM-1158 Change-Id: I862d88df1ffddaf2f1cfd2b37c44f24118984f3b Signed-off-by: vaibhavjayas --- .../policy/charts/brmsgw/templates/deployment.yaml | 2 +- kubernetes/policy/charts/brmsgw/values.yaml | 36 +++++++++++----------- .../drools/charts/nexus/templates/deployment.yaml | 2 +- .../policy/charts/drools/charts/nexus/values.yaml | 36 +++++++++++----------- .../charts/drools/templates/statefulset.yaml | 2 +- kubernetes/policy/charts/drools/values.yaml | 36 +++++++++++----------- .../charts/mariadb/templates/deployment.yaml | 2 +- kubernetes/policy/charts/mariadb/values.yaml | 19 +++++++++++- .../policy/charts/pdp/templates/statefulset.yaml | 12 ++------ kubernetes/policy/charts/pdp/values.yaml | 36 +++++++++++----------- .../policy-apex-pdp/templates/statefulset.yaml | 2 +- .../policy/charts/policy-apex-pdp/values.yaml | 19 +++++++++++- kubernetes/policy/templates/deployment.yaml | 12 ++------ kubernetes/policy/values.yaml | 36 +++++++++++----------- 14 files changed, 135 insertions(+), 117 deletions(-) (limited to 'kubernetes/policy') diff --git a/kubernetes/policy/charts/brmsgw/templates/deployment.yaml b/kubernetes/policy/charts/brmsgw/templates/deployment.yaml index b5ba77baf3..7b40dbe675 100644 --- a/kubernetes/policy/charts/brmsgw/templates/deployment.yaml +++ b/kubernetes/policy/charts/brmsgw/templates/deployment.yaml @@ -85,7 +85,7 @@ spec: name: pe-scripts subPath: do-start.sh resources: -{{ toYaml .Values.resources | indent 12 }} +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 10 }} diff --git a/kubernetes/policy/charts/brmsgw/values.yaml b/kubernetes/policy/charts/brmsgw/values.yaml index fbdd94728f..4028356dd2 100644 --- a/kubernetes/policy/charts/brmsgw/values.yaml +++ b/kubernetes/policy/charts/brmsgw/values.yaml @@ -68,21 +68,21 @@ service: ingress: enabled: false -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # - # Example: - # Configure resource requests and limits - # ref: http://kubernetes.io/docs/user-guide/compute-resources/ - # Minimum memory for development is 2 CPU cores and 4GB memory - # Minimum memory for production is 4 CPU cores and 8GB memory -#resources: -# limits: -# cpu: 2 -# memory: 4Gi -# requests: -# cpu: 2 -# memory: 4Gi +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 2Gi + requests: + cpu: 10m + memory: 0.5Gi + large: + limits: + cpu: 2 + memory: 4Gi + requests: + cpu: 20m + memory: 1Gi \ No newline at end of file diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml index 06359956aa..d04f8f8e51 100644 --- a/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml +++ b/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml @@ -65,7 +65,7 @@ spec: - mountPath: /sonatype-work name: nexus-data resources: -{{ toYaml .Values.resources | indent 12 }} +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 10 }} diff --git a/kubernetes/policy/charts/drools/charts/nexus/values.yaml b/kubernetes/policy/charts/drools/charts/nexus/values.yaml index 2efeca5cf9..91089aafdd 100644 --- a/kubernetes/policy/charts/drools/charts/nexus/values.yaml +++ b/kubernetes/policy/charts/drools/charts/nexus/values.yaml @@ -77,21 +77,21 @@ persistence: mountPath: /dockerdata-nfs mountSubPath: nexus/data -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # - # Example: - # Configure resource requests and limits - # ref: http://kubernetes.io/docs/user-guide/compute-resources/ - # Minimum memory for development is 2 CPU cores and 4GB memory - # Minimum memory for production is 4 CPU cores and 8GB memory -#resources: -# limits: -# cpu: 2 -# memory: 4Gi -# requests: -# cpu: 2 -# memory: 4Gi +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 1Gi + requests: + cpu: 1m + memory: 0.5Gi + large: + limits: + cpu: 2 + memory: 2Gi + requests: + cpu: 2m + memory: 1Gi \ No newline at end of file diff --git a/kubernetes/policy/charts/drools/templates/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml index 10f7a1d9f3..417ab7e0b1 100644 --- a/kubernetes/policy/charts/drools/templates/statefulset.yaml +++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml @@ -116,7 +116,7 @@ spec: exec: command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/config/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] resources: -{{ toYaml .Values.resources | indent 12 }} +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} {{- if .Values.nodeSelector }} - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.loggingImage }}" imagePullPolicy: {{ .Values.pullPolicy }} diff --git a/kubernetes/policy/charts/drools/values.yaml b/kubernetes/policy/charts/drools/values.yaml index ef289c3a45..0a05719054 100644 --- a/kubernetes/policy/charts/drools/values.yaml +++ b/kubernetes/policy/charts/drools/values.yaml @@ -69,21 +69,21 @@ service: ingress: enabled: false -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # - # Example: - # Configure resource requests and limits - # ref: http://kubernetes.io/docs/user-guide/compute-resources/ - # Minimum memory for development is 2 CPU cores and 4GB memory - # Minimum memory for production is 4 CPU cores and 8GB memory -#resources: -# limits: -# cpu: 2 -# memory: 4Gi -# requests: -# cpu: 2 -# memory: 4Gi +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 4Gi + requests: + cpu: 100m + memory: 1Gi + large: + limits: + cpu: 2 + memory: 8Gi + requests: + cpu: 200m + memory: 2Gi \ No newline at end of file diff --git a/kubernetes/policy/charts/mariadb/templates/deployment.yaml b/kubernetes/policy/charts/mariadb/templates/deployment.yaml index d1c57cf389..17662c1c6d 100644 --- a/kubernetes/policy/charts/mariadb/templates/deployment.yaml +++ b/kubernetes/policy/charts/mariadb/templates/deployment.yaml @@ -76,7 +76,7 @@ spec: - mountPath: /var/lib/mysql name: mariadb-data resources: -{{ toYaml .Values.resources | indent 12 }} +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 10 }} diff --git a/kubernetes/policy/charts/mariadb/values.yaml b/kubernetes/policy/charts/mariadb/values.yaml index 0de53af089..b2a848b028 100644 --- a/kubernetes/policy/charts/mariadb/values.yaml +++ b/kubernetes/policy/charts/mariadb/values.yaml @@ -74,4 +74,21 @@ service: ingress: enabled: false -resources: {} +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 2Gi + requests: + cpu: 10m + memory: 0.5Gi + large: + limits: + cpu: 2 + memory: 4Gi + requests: + cpu: 20m + memory: 1Gi \ No newline at end of file diff --git a/kubernetes/policy/charts/pdp/templates/statefulset.yaml b/kubernetes/policy/charts/pdp/templates/statefulset.yaml index db6a2adbea..5bc7b55839 100644 --- a/kubernetes/policy/charts/pdp/templates/statefulset.yaml +++ b/kubernetes/policy/charts/pdp/templates/statefulset.yaml @@ -58,6 +58,8 @@ spec: name: {{ include "common.name" . }} image: "{{ include "common.repository" . }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + resources: +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} ports: - containerPort: {{ .Values.service.externalPort }} {{- if eq .Values.liveness.enabled true }} @@ -111,16 +113,6 @@ spec: name: policy-logs - mountPath: /usr/share/filebeat/data name: policy-data-filebeat - resources: -{{ toYaml .Values.resources | indent 12 }} - {{- if .Values.nodeSelector }} - nodeSelector: -{{ toYaml .Values.nodeSelector | indent 10 }} - {{- end -}} - {{- if .Values.affinity }} - affinity: -{{ toYaml .Values.affinity | indent 10 }} - {{- end }} volumes: - name: localtime hostPath: diff --git a/kubernetes/policy/charts/pdp/values.yaml b/kubernetes/policy/charts/pdp/values.yaml index f07995170c..45ab96deeb 100644 --- a/kubernetes/policy/charts/pdp/values.yaml +++ b/kubernetes/policy/charts/pdp/values.yaml @@ -67,21 +67,21 @@ service: ingress: enabled: false -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # - # Example: - # Configure resource requests and limits - # ref: http://kubernetes.io/docs/user-guide/compute-resources/ - # Minimum memory for development is 2 CPU cores and 4GB memory - # Minimum memory for production is 4 CPU cores and 8GB memory -#resources: -# limits: -# cpu: 2 -# memory: 4Gi -# requests: -# cpu: 2 -# memory: 4Gi +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 4Gi + requests: + cpu: 10m + memory: 1Gi + large: + limits: + cpu: 2 + memory: 8Gi + requests: + cpu: 20m + memory: 2Gi \ No newline at end of file diff --git a/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml b/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml index a1083b2809..d7604d3231 100644 --- a/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml +++ b/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml @@ -73,7 +73,7 @@ spec: name: apexconfig subpath: config.json resources: -{{ toYaml .Values.resources | indent 12 }} +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 10 }} diff --git a/kubernetes/policy/charts/policy-apex-pdp/values.yaml b/kubernetes/policy/charts/policy-apex-pdp/values.yaml index 3c7b5594a6..ef90c917b8 100644 --- a/kubernetes/policy/charts/policy-apex-pdp/values.yaml +++ b/kubernetes/policy/charts/policy-apex-pdp/values.yaml @@ -65,4 +65,21 @@ service: ingress: enabled: false -resources: {} +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 4Gi + requests: + cpu: 10m + memory: 1Gi + large: + limits: + cpu: 2 + memory: 8Gi + requests: + cpu: 20m + memory: 2Gi \ No newline at end of file diff --git a/kubernetes/policy/templates/deployment.yaml b/kubernetes/policy/templates/deployment.yaml index cc7728f3d7..bcd25510c8 100644 --- a/kubernetes/policy/templates/deployment.yaml +++ b/kubernetes/policy/templates/deployment.yaml @@ -54,6 +54,8 @@ spec: name: {{ include "common.name" . }} image: "{{ include "common.repository" . }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + resources: +{{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }} ports: - containerPort: {{ .Values.service.externalPort }} - containerPort: {{ .Values.service.externalPort2 }} @@ -126,16 +128,6 @@ spec: name: policy-logs - mountPath: /usr/share/filebeat/data name: policy-data-filebeat - resources: -{{ toYaml .Values.resources | indent 12 }} - {{- if .Values.nodeSelector }} - nodeSelector: -{{ toYaml .Values.nodeSelector | indent 10 }} - {{- end -}} - {{- if .Values.affinity }} - affinity: -{{ toYaml .Values.affinity | indent 10 }} - {{- end }} volumes: - name: localtime hostPath: diff --git a/kubernetes/policy/values.yaml b/kubernetes/policy/values.yaml index a162fd2af0..6583045edb 100644 --- a/kubernetes/policy/values.yaml +++ b/kubernetes/policy/values.yaml @@ -99,21 +99,21 @@ service: ingress: enabled: false -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # - # Example: - # Configure resource requests and limits - # ref: http://kubernetes.io/docs/user-guide/compute-resources/ - # Minimum memory for development is 2 CPU cores and 4GB memory - # Minimum memory for production is 4 CPU cores and 8GB memory -#resources: -# limits: -# cpu: 2 -# memory: 4Gi -# requests: -# cpu: 2 -# memory: 4Gi +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1 + memory: 4Gi + requests: + cpu: 10m + memory: 1Gi + large: + limits: + cpu: 2 + memory: 8Gi + requests: + cpu: 20m + memory: 2Gi \ No newline at end of file -- cgit 1.2.3-korg