Skip to content

Commit

Permalink
Workaround helm template bug when testing for APIVersions (#1533)
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Parent <math.parent@gmail.com>

Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
  • Loading branch information
sathieu and ritazh authored Sep 8, 2021
1 parent 45fd0c4 commit c91112c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/build/helmify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (ks *kindSet) Write() error {
}

if name == "gatekeeper-controller-manager" && kind == "PodDisruptionBudget" {
obj = strings.Replace(obj, "apiVersion: policy/v1beta1", "{{- if .Capabilities.APIVersions.Has \"policy/v1\" }}\napiVersion: policy/v1\n{{ else }}\napiVersion: policy/v1beta1\n{{ end -}}", 1)
obj = strings.Replace(obj, "apiVersion: policy/v1beta1", "{{- if .Capabilities.APIVersions.Has \"policy/v1/PodDisruptionBudget\" }}\napiVersion: policy/v1\n{{ else }}\napiVersion: policy/v1beta1\n{{ end -}}", 1)
}

if err := os.WriteFile(destFile, []byte(obj), 0600); err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Capabilities.APIVersions.Has "policy/v1" }}
{{- if .Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }}
apiVersion: policy/v1
{{ else }}
apiVersion: policy/v1beta1
Expand Down

0 comments on commit c91112c

Please sign in to comment.