From 430a5d542bcf0167adc65edff46f9d9eef693c77 Mon Sep 17 00:00:00 2001 From: ihcsim Date: Thu, 25 Jul 2019 23:30:55 -0700 Subject: [PATCH] Remove duplicated resources partial template Signed-off-by: ihcsim --- charts/linkerd/templates/controller.yaml | 4 ++-- charts/linkerd/templates/grafana.yaml | 2 +- charts/linkerd/templates/heartbeat.yaml | 2 +- charts/partials/templates/_proxy-init.tpl | 2 +- charts/partials/templates/_proxy.tpl | 2 +- charts/partials/templates/_resource.tpl | 21 ------------------- .../templates/_resources.tpl | 5 ++--- 7 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 charts/partials/templates/_resource.tpl rename charts/{linkerd => partials}/templates/_resources.tpl (78%) diff --git a/charts/linkerd/templates/controller.yaml b/charts/linkerd/templates/controller.yaml index 59278af9548a8..73eea00f62867 100644 --- a/charts/linkerd/templates/controller.yaml +++ b/charts/linkerd/templates/controller.yaml @@ -104,7 +104,7 @@ spec: path: /ready port: 9995 {{- if eq .HighAvailability true -}} - {{- include "linkerd.resources" .PublicAPIResources | nindent 8 }} + {{- include "partials.resources" .PublicAPIResources | nindent 8 }} {{- end }} securityContext: runAsUser: {{.ControllerUID}} @@ -136,7 +136,7 @@ spec: path: /ready port: 9996 {{- if eq .HighAvailability true -}} - {{- include "linkerd.resources" .DestinationResources | nindent 8 }} + {{- include "partials.resources" .DestinationResources | nindent 8 }} {{- end }} securityContext: runAsUser: {{.ControllerUID}} diff --git a/charts/linkerd/templates/grafana.yaml b/charts/linkerd/templates/grafana.yaml index 2382c9c0135fa..7ddf201ebce8d 100644 --- a/charts/linkerd/templates/grafana.yaml +++ b/charts/linkerd/templates/grafana.yaml @@ -135,7 +135,7 @@ spec: path: /api/health port: 3000 {{- if eq .HighAvailability true -}} - {{- include "linkerd.resources" .GrafanaResources | nindent 8 }} + {{- include "partials.resources" .GrafanaResources | nindent 8 }} {{- end }} securityContext: runAsUser: 472 diff --git a/charts/linkerd/templates/heartbeat.yaml b/charts/linkerd/templates/heartbeat.yaml index cb1678843d03a..cd9e2bd72b58a 100644 --- a/charts/linkerd/templates/heartbeat.yaml +++ b/charts/linkerd/templates/heartbeat.yaml @@ -37,7 +37,7 @@ spec: - "-controller-namespace={{.Namespace}}" - "-log-level={{.ControllerLogLevel}}" {{- if eq .HighAvailability true -}} - {{- include "linkerd.resources" .HeartbeatResources | nindent 12 }} + {{- include "partials.resources" .HeartbeatResources | nindent 12 }} {{- end -}} securityContext: runAsUser: {{.ControllerUID}} diff --git a/charts/partials/templates/_proxy-init.tpl b/charts/partials/templates/_proxy-init.tpl index ee6f5722b7cf7..6067fbb954b6d 100644 --- a/charts/partials/templates/_proxy-init.tpl +++ b/charts/partials/templates/_proxy-init.tpl @@ -13,7 +13,7 @@ image: {{.Image.Name}}:{{.Image.Version}} imagePullPolicy: {{.Image.PullPolicy}} name: linkerd-init - {{- include "partials.resource" .ResourceRequirements | nindent 2 }} + {{- include "partials.resources" .ResourceRequirements | nindent 2 }} securityContext: allowPrivilegeEscalation: false capabilities: diff --git a/charts/partials/templates/_proxy.tpl b/charts/partials/templates/_proxy.tpl index 89905af30c759..6e5f777e5674b 100644 --- a/charts/partials/templates/_proxy.tpl +++ b/charts/partials/templates/_proxy.tpl @@ -71,7 +71,7 @@ port: {{.Port.Admin}} initialDelaySeconds: 2 {{- if eq .HighAvailability true -}} - {{- include "partials.resource" .ResourceRequirements | nindent 2 -}} + {{- include "partials.resources" .ResourceRequirements | nindent 2 -}} {{- end }} securityContext: allowPrivilegeEscalation: false diff --git a/charts/partials/templates/_resource.tpl b/charts/partials/templates/_resource.tpl deleted file mode 100644 index aa5dbf769fb2a..0000000000000 --- a/charts/partials/templates/_resource.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{{- define "partials.resource" -}} -resources: - {{- if or .CPU.Limit .Memory.Limit }} - limits: - {{- with .CPU.Limit }} - cpu: {{.}} - {{- end }} - {{- with .Memory.Limit }} - memory: {{.}} - {{- end }} - {{- end }} - {{- if or .CPU.Request .Memory.Request }} - requests: - {{- with .CPU.Request }} - cpu: {{.}} - {{- end }} - {{- with .Memory.Request }} - memory: {{.}} - {{- end }} - {{- end }} -{{- end }} diff --git a/charts/linkerd/templates/_resources.tpl b/charts/partials/templates/_resources.tpl similarity index 78% rename from charts/linkerd/templates/_resources.tpl rename to charts/partials/templates/_resources.tpl index ce5fede579325..be4eb4381a7b6 100644 --- a/charts/linkerd/templates/_resources.tpl +++ b/charts/partials/templates/_resources.tpl @@ -1,5 +1,4 @@ -{{/* Specify resource requests and limits for workloads */}} -{{- define "linkerd.resources" -}} +{{- define "partials.resources" -}} resources: {{- if or .CPU.Limit .Memory.Limit }} limits: @@ -19,4 +18,4 @@ resources: memory: {{.}} {{- end }} {{- end }} -{{- end -}} +{{- end }}