Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template PodDisruptionBudget apiVersion to enable support for older K8s versions #861

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/utils/template_generator/vizier_yamls/vizier_yamls.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type VizierTmplValues struct {
ElectionPeriodMs int64
CustomPEMFlags map[string]string
Registry string
UseBetaPdbVersion bool
}

// VizierTmplValuesToArgs converts the vizier template values to args which can be used to fill out a template.
Expand All @@ -91,6 +92,7 @@ func VizierTmplValuesToArgs(tmplValues *VizierTmplValues) *yamls.YAMLTmplArgumen
"electionPeriodMs": tmplValues.ElectionPeriodMs,
"customPEMFlags": tmplValues.CustomPEMFlags,
"registry": tmplValues.Registry,
"useBetaPdbVersion": tmplValues.UseBetaPdbVersion,
},
Release: &map[string]interface{}{
"Namespace": tmplValues.Namespace,
Expand Down Expand Up @@ -319,7 +321,14 @@ func generateVzDepsYAMLs(clientset *kubernetes.Clientset, yamlMap map[string]str
return "", "", err
}

etcdYAML, err := yamls.TemplatizeK8sYAML(clientset, yamlMap[etcdYAMLPath], GlobalTemplateOptions)
etcdYAML, err := yamls.TemplatizeK8sYAML(clientset, yamlMap[etcdYAMLPath], append(GlobalTemplateOptions, []*yamls.K8sTemplateOptions{
{
TemplateMatcher: yamls.GenerateResourceNameMatcherFn("pl-etcd-pdb"),
Patch: `{"apiVersion" : "__PX_PDB_API_VERSION__"}`,
Placeholder: "__PX_PDB_API_VERSION__",
TemplateValue: `{{ if .Values.useBetaPdbVersion }}"policy/v1beta1"{{ else }}"policy/v1"{{ end }}`,
},
}...))
if err != nil {
return "", "", err
}
Expand Down