Skip to content

Commit

Permalink
feat(helm): fix condition when no requirements.yaml exists during tag…
Browse files Browse the repository at this point in the history
…/condition processing
  • Loading branch information
jascott1 committed Feb 11, 2017
1 parent faae1f6 commit 004c5bc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/chartutil/requirements.go
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions pkg/chartutil/testdata/subpop/noreqs/Chart.yaml
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: parentchart
version: 0.1.0
15 changes: 15 additions & 0 deletions pkg/chartutil/testdata/subpop/noreqs/templates/service.yaml
@@ -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 }}
27 changes: 27 additions & 0 deletions pkg/chartutil/testdata/subpop/noreqs/values.yaml
@@ -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

0 comments on commit 004c5bc

Please sign in to comment.