Skip to content

Commit

Permalink
Merge pull request #42 from stakater-charts/refactor-templates
Browse files Browse the repository at this point in the history
Make additional templates/resources optional
  • Loading branch information
kahootali authored Jul 3, 2020
2 parents b4749ab + 67540c9 commit c609475
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion application/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and .Values.configMap .Values.configMap.enabled }}
{{- if .Values.configMap }}
{{- if .Values.configMap.enabled }}
{{- range .Values.configMap.files }}
apiVersion: v1
kind: ConfigMap
Expand All @@ -22,4 +23,5 @@ data:
{{ toYaml .data | indent 2 }}
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions application/templates/forecastle.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.forecastle }}
{{- if and (or .Values.ingress.enabled .Values.route.enabled) .Values.forecastle.enabled }}
apiVersion: forecastle.stakater.com/v1alpha1
kind: ForecastleApp
Expand Down Expand Up @@ -26,4 +27,5 @@ spec:
properties:
{{ toYaml .Values.forecastle.properties | indent 4 }}
{{- end }}
{{- end -}}
{{- end -}}
4 changes: 3 additions & 1 deletion application/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.autoscaling }}
{{- if and .Values.autoscaling.enabled .Values.deployment }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
Expand All @@ -22,4 +23,5 @@ spec:
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- toYaml .Values.autoscaling.metrics | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions application/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.ingress -}}
{{- if .Values.ingress.enabled -}}
{{- $servicePort := .Values.ingress.servicePort -}}
apiVersion: extensions/v1beta1
Expand Down Expand Up @@ -30,3 +31,4 @@ spec:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions application/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.persistence }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
Expand Down Expand Up @@ -26,4 +27,5 @@ spec:
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions application/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.route -}}
{{- if .Values.route.enabled -}}
apiVersion: route.openshift.io/v1
kind: Route
Expand Down Expand Up @@ -28,3 +29,4 @@ spec:
termination: {{ .Values.route.tls.termination }}
insecureEdgeTerminationPolicy: {{ .Values.route.tls.insecureEdgeTerminationPolicy }}
{{- end -}}
{{- end -}}
4 changes: 3 additions & 1 deletion application/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and .Values.secret .Values.secret.enabled }}
{{- if .Values.secret }}
{{- if .Values.secret.enabled }}
{{- range .Values.secret.files }}
apiVersion: v1
kind: Secret
Expand All @@ -24,4 +25,5 @@ data:
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions application/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.serviceMonitor }}
{{- if .Values.serviceMonitor.enabled }}
apiVersion: "monitoring.coreos.com/v1"
kind: ServiceMonitor
Expand All @@ -24,4 +25,5 @@ spec:
- {{ .Release.Namespace }}
endpoints:
{{ toYaml .Values.serviceMonitor.endpoints | indent 4 }}
{{- end }}
{{- end }}

0 comments on commit c609475

Please sign in to comment.