diff --git a/hack/copy-crds-to-chart/main.go b/hack/copy-crds-to-chart/main.go index 7276c468f8..7085bdb9e6 100644 --- a/hack/copy-crds-to-chart/main.go +++ b/hack/copy-crds-to-chart/main.go @@ -9,6 +9,14 @@ import ( "strings" ) +var ( + // HACK IT! + requiresPeering = map[string]struct{}{ + "consul.hashicorp.com_peeringacceptors.yaml": {}, + "consul.hashicorp.com_peeringdialers.yaml": {}, + } +) + func main() { if len(os.Args) != 1 { fmt.Println("Usage: go run ./...") @@ -43,8 +51,13 @@ func realMain(helmPath string) error { // Strip leading newline. contents = strings.TrimPrefix(contents, "\n") - // Add {{- if .Values.connectInject.enabled }} {{- end }} wrapper. - contents = fmt.Sprintf("{{- if .Values.connectInject.enabled }}\n%s{{- end }}\n", contents) + if _, ok := requiresPeering[info.Name()]; ok { + // Add {{- if and .Values.connectInject.enabled .Values.global.peering.enabled }} {{- end }} wrapper. + contents = fmt.Sprintf("{{- if and .Values.connectInject.enabled .Values.global.peering.enabled }}\n%s{{- end }}\n", contents) + } else { + // Add {{- if .Values.connectInject.enabled }} {{- end }} wrapper. + contents = fmt.Sprintf("{{- if .Values.connectInject.enabled }}\n%s{{- end }}\n", contents) + } // Add labels, this is hacky because we're relying on the line number // but it means we don't need to regex or yaml parse.