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

[Issue]: azd deploy not able to handle properly formatted configmap for AKS #2367

Closed
1 task
carmodyquinnms opened this issue Jun 6, 2023 · 1 comment · Fixed by #2455
Closed
1 task
Assignees
Labels
aks Azure Kubernetes Service customer-reported identify a customer issue question

Comments

@carmodyquinnms
Copy link

Output from azd version

cquinn@DESKTOP-72A3U61:.../ratings-nodejs-azd-akslza$ azd version
azd version 1.0.1 (commit e0cd1aca716fa5d08704beade7dcc734fe68f5f1)

Describe the bug
azd deployment fails on mongodb configmap yaml

To Reproduce
use the attached mangodb configmap yaml and attempt to deploy with azd deploy and it fails with the following error message:

(x) Failed: Deploying service api
ERROR: failed deploying service 'api': failing invoking action 'deploy', failed applying kube manifests: failed process templates, failed applying template 'src/manifests/api/ratings-mongodb-configmap.yaml', failed replacing env vars, missing closing brace

Expected behavior
azd deploy is expected to either handle the yaml file which is formatted properly

ratings-mongodb-configmap.yaml.txt

@ghost ghost added needs-triage For new issues customer-reported identify a customer issue question labels Jun 6, 2023
@carmodyquinnms carmodyquinnms changed the title [Issue] [Issue]: azd deploy not able to handle properly formatted configmap for AKS Jun 6, 2023
@wbreza wbreza added the aks Azure Kubernetes Service label Jun 8, 2023
@ghost ghost removed the needs-triage For new issues label Jun 8, 2023
@rajeshkamal5050
Copy link

@wbreza can you take a look? Please adjust milestone based on findings.

wbreza added a commit that referenced this issue Jul 26, 2023
…manifests (#2455)

Resolves #2367

This addresses an issue where a configmap or other k8s resource can contain script files that fails parsing by the envsubst library.

The specific issue that failed in this example was the envsubst attempting to replace ${BASH_REMATCH[1]} in a config map. This is likely a bug in the library since it was throwing an MissingClosingBrace error.

Background
k8s manifests DO NOT support any default templating language out of the box. To support environment variables you would read directly from a configmap / secret to reference those values.

Helm is a very popular package manager for k8s and supports a robust templating language. The templating language uses Go text templating language as its foundation with some additional features built on top.

Kustomize is another very popular way to provide customization on top of k8s manifests without templates.
It previously supported a vars feature that has now been deprecated and replaced by replacements.

Breaking Change
This commit would be considered a breaking change for AKS support. Prior to this update simple environment substitution was being performed on all *.yaml manifest files.

Blind replacement of any bash style variable could have unintended consequences and cause runtime error when variables are not available within azd environment.

Now, devs must opt-in by renaming there manifests to *.tmpl.yaml and have access to Go text templating within their manifests.

This feature would be considered an incremental journey towards a fully featured templating & packaging system like Helm since the syntax is the same. The templating syntax used here is the same as used in Helm)

In addition to the opt-in text templates k8s devs still have the ability to directly pull values from config maps / secrets as needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aks Azure Kubernetes Service customer-reported identify a customer issue question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants