feat(helm): fix condition when no requirements.yaml exists during tag/condition processing

pull/1917/head
Justin Scott 8 years ago
parent faae1f68b6
commit 004c5bcc88

@ -209,7 +209,13 @@ func ProcessRequirementsTags(reqs *Requirements, cvals Values) {
func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
reqs, err := LoadRequirements(c)
if err != nil {
return ErrRequirementsNotFound
// if not just missing requirements file, return error
if nerr, ok := err.(ErrNoRequirementsFile); !ok {
return nerr
} else {
// no requirements to process
return nil
}
}
// set all to true
for _, lr := range reqs.Dependencies {
@ -223,7 +229,7 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
ProcessRequirementsTags(reqs, cvals)
ProcessRequirementsConditions(reqs, cvals)
// make a map of charts to keep
// make a map of charts to remove
rm := map[string]bool{}
for _, r := range reqs.Dependencies {
if !r.Enabled {

@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: parentchart
version: 0.1.0

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ .Chart.Name }}

@ -0,0 +1,27 @@
# Default values for subchart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
tag: stable
pullPolicy: IfNotPresent
service:
name: nginx
type: ClusterIP
externalPort: 80
internalPort: 80
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
# switch-like
tags:
front-end: true
back-end: false
Loading…
Cancel
Save