From 88681e754a912885ec39123e4dc5802637767afa Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Mon, 2 Apr 2018 14:25:44 -0500 Subject: [PATCH] Missing resource limits on apiserver pod - Add resource limits to the static defintion for the apiserver pod Change-Id: I473c67e53da148f92441563187d6e026cf697582 --- Makefile | 22 ++++++++++++------- charts/apiserver/templates/daemonset.yaml | 2 +- .../etc/_kubernetes-apiserver.yaml.tpl | 1 + charts/apiserver/values.yaml | 7 ++++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index e1c2ebc4..355dc18e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -# Copyright 2017 AT&T Intellectual Property. All other rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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 # @@ -16,24 +18,28 @@ HELM_PIDFILE ?= $(abspath ./.helm-pid) CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.)) .PHONY: all -all: charts +all: banner charts + +banner: + @echo Building charts: $(CHARTS) .PHONY: charts charts: $(CHARTS) @echo Done building charts. .PHONY: helm-init -helm-init: helm-serve +helm-init: $(addprefix helm-init-,$(CHARTS)) .PHONY: helm-init-% helm-init-%: helm-serve + @echo Initializing chart $* cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi .PHONY: lint lint: helm-lint .PHONY: helm-lint -helm-lint: helm-serve $(addprefix helm-lint-,$(CHARTS)) +helm-lint: $(addprefix helm-lint-,$(CHARTS)) .PHONY: helm-lint-% helm-lint-%: helm-init-% @@ -41,16 +47,16 @@ helm-lint-%: helm-init-% cd charts;$(HELM) lint $* .PHONY: dry-run -dry-run: helm-lint $(addprefix dry-run-,$(CHARTS)) +dry-run: $(addprefix dry-run-,$(CHARTS)) .PHONY: dry-run-% dry-run-%: helm-lint-% echo Running Dry-Run on chart $* - cd charts;$(HELM) template $* + cd charts;$(HELM) template --set pod.resources.enabled=true $* .PHONY: $(CHARTS) -$(CHARTS): dry-run-$@ - $(HELM) package -d charts $@ +$(CHARTS): $(addprefix dry-run-,$(CHARTS)) + $(HELM) package -d charts charts/$@ .PHONY: helm-serve helm-serve: diff --git a/charts/apiserver/templates/daemonset.yaml b/charts/apiserver/templates/daemonset.yaml index 664bbf27..f0204d9e 100644 --- a/charts/apiserver/templates/daemonset.yaml +++ b/charts/apiserver/templates/daemonset.yaml @@ -49,12 +49,12 @@ spec: - name: anchor image: {{ .Values.images.tags.anchor }} imagePullPolicy: {{ .Values.images.pull_policy }} +{{ tuple $envAll $envAll.Values.pod.resources.anchor_pod | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} env: - name: MANIFEST_PATH value: /host{{ .Values.anchor.kubelet.manifest_path }}/{{ .Values.service.name }}.yaml - name: PKI_PATH value: /host{{ .Values.apiserver.host_etc_path }}/pki -{{ tuple $envAll $envAll.Values.pod.resources.kubernetes_apiserver | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} command: - /tmp/bin/anchor lifecycle: diff --git a/charts/apiserver/templates/etc/_kubernetes-apiserver.yaml.tpl b/charts/apiserver/templates/etc/_kubernetes-apiserver.yaml.tpl index 31fa205c..125185ab 100644 --- a/charts/apiserver/templates/etc/_kubernetes-apiserver.yaml.tpl +++ b/charts/apiserver/templates/etc/_kubernetes-apiserver.yaml.tpl @@ -27,6 +27,7 @@ spec: containers: - name: apiserver image: {{ .Values.images.tags.apiserver }} +{{ tuple $envAll $envAll.Values.pod.resources.kubernetes_apiserver | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} env: - name: POD_IP valueFrom: diff --git a/charts/apiserver/values.yaml b/charts/apiserver/values.yaml index 1166a0fd..9c088f96 100644 --- a/charts/apiserver/values.yaml +++ b/charts/apiserver/values.yaml @@ -117,6 +117,13 @@ pod: timeout: 3600 resources: enabled: false + anchor_pod: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" kubernetes_apiserver: requests: memory: "128Mi"