Skip to content

Commit

Permalink
Fix the CR yamls and make customDeployKeySecret optional
Browse files Browse the repository at this point in the history
Summary:
This fixes the problem at the root and ensures that the value isn't
in the custom resource if it's optional.
Revert "Remove deploySecret YAML"
This reverts commit 4d9db3d.

Test Plan:
Extract the templates and ensure that `customDeployKeySecret: <no value>`
does not show up.

Reviewers: michelle

Reviewed By: michelle

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D11034

GitOrigin-RevId: 60c4b84
  • Loading branch information
vihangm authored and copybaranaut committed Mar 23, 2022
1 parent f3e77dd commit fd6c7c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions k8s/operator/helm/templates/04_vizier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ spec:
version: {{ .Values.version }}
{{- end }}
deployKey: {{ .Values.deployKey }}
{{- if .Values.customDeployKeySecret }}
customDeployKeySecret: {{ .Values.customDeployKeySecret }}
{{- end }}
cloudAddr: {{ .Values.cloudAddr }}
disableAutoUpdate: {{ .Values.disableAutoUpdate }}
useEtcdOperator: {{ .Values.useEtcdOperator }}
Expand Down
6 changes: 6 additions & 0 deletions src/utils/template_generator/vizier_yamls/vizier_yamls.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,12 @@ func generateVzYAMLs(clientset *kubernetes.Clientset, yamlMap map[string]string)
value: "{{$value}}"
{{- end}}`,
},
{
TemplateMatcher: yamls.GenerateResourceNameMatcherFn("vizier-cloud-connector"),
Patch: `{"spec": {"template": {"spec": {"containers": [{"name": "app", "env": [{"name": "PL_DEPLOY_KEY", "valueFrom": { "secretKeyRef": { "key": "deploy-key", "name": "__PX_DEPLOY_KEY_SECRET_NAME__", "optional": true} } }]}] } } } }`,
Placeholder: "__PX_DEPLOY_KEY_SECRET_NAME__",
TemplateValue: `{{ if .Values.customDeployKeySecret }}"{{ .Values.customDeployKeySecret }}"{{else}}"pl-deploy-secrets"{{end}}`,
},
}...)

persistentYAML, err := yamls.TemplatizeK8sYAML(clientset, yamlMap[vizierMetadataPersistYAMLPath], tmplOptions)
Expand Down

0 comments on commit fd6c7c4

Please sign in to comment.