bigbang 3rd party package chart not properly passing some toplevel chart values to subpackages
Bug
Description
While working on Jira #67 I discovered that some of the builtin networkPolicies do not function because the controlPlaneCidr is not properly inherited from the parent chart values.
Consider:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: egress-kube-api
namespace: {{ .Release.Namespace }}
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: {{ .Values.networkPolicies.controlPlaneCidr }}
... the assumption is that the bigbang 3rd party package chart will appropriately pass through the networkPolicies.controlPlaneCidr, which was set at the top level parent (bigbang/chart/values.yaml). However this isn't the behavior of the 3rd party package chart. The global values are not merged into (or beneath) the values for the 3rd party package.
bigbang/chart/templates/package/values.yaml
{{- $pkg = include "resourceName" $pkg -}}
{{- $defaults := $.Files.Get (printf "defaults/%s.yaml" $pkg) -}}
{{- if $defaults -}}
{{- $vals := mergeOverwrite $vals ($defaults | fromYaml).package -}}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ $pkg }}-values
namespace: {{ dig "namespace" "name" $pkg $vals }}
labels:
{{- include "commonLabels" $ | nindent 4 }}
type: Opaque
stringData:
{{ if and (dig "enabled" true $vals) (not $vals.kustomize) -}}
values.yaml: |
{{- tpl (toYaml $vals.values) $ | nindent 4 }}
{{ else }}
{{- tpl (toYaml $vals.values) $ | nindent 2 }}
{{ end }}
Deploying these charts in this state results in helm installation failures:
1s Warning InstallFailed HelmRelease/jira Helm install failed for release jira/jira with chart jira@1.18.1-bb.0+3ab13cc1dbc2: 1 error occurred:
* NetworkPolicy.extensions "egress-kube-api" is invalid: spec.egress[0].to[0].ipBlock.cidr: Required value
Maybe this is working as designed, but it is confusing to me to have the global spaces inherited/extended by all the other bigbang charts but not these packages.
BigBang Version
bigbang-2.22.0