Skip to content

Bug: Deployment template does not allow saving when the http_code variable is present in the liveness command. #4009

@ajaydevtron

Description

@ajaydevtron

📜 Description

We cannot save the deployment template when we had the following liveness configuration in the deployment template.

LivenessProbe:
Path: ""
command:
- /bin/bash
- -c
- >-
export GEO=$( curl --location --request --fail -s -o /dev/null -i -w
"%{http_code}" -XPOST 'http://localhost:8080/predictions/ap' --header
'Content-Type: application/json' --data-raw '{ "data": "lane
12,vasanthapuri colony,malkajgiri,tirumalagiri,telangana,500047" }')
if [[ $GEO -eq 200 ]]; then echo 'yes'; else cat test.txt; fi

This was working fine previously and now when we are trying to update any other configuration in deployment template it through below error.

Screenshot

ss

Error logs

{"level":"error","ts":1696406896.324264,"caller":"parsers/VariableTemplateParser.go:43","msg":"error occurred while extracting variables from template","template":"{"ContainerPort":[{"envoyPort":8799,"idleTimeout":"1800s","name":"app","port":8080,"servicePort":80,"envoyTimeout":"60s","supportStreaming":false,"useHTTP2":false}],"EnvVariables":[],"GracePeriod":30,"LivenessProbe":{"Path":"","command":["/bin/bash","-c","export GEO=$( curl --location --request --fail -s -o /dev/null -i -w \"%{http_code}\" -XPOST 'http://localhost:8080/predictions/ap' --header 'Content-Type: application/json' --data-raw '{ \"data\": \"lane 12,vasanthapuri colony,malkajgiri,tirumalagiri,telangana,500047\" }')\nif [[ $GEO -eq 200 ]]; then echo 'yes'; else cat test.txt; fi"],"failureThreshold":3,"httpHeader":{"MaxReplicas":20,"MinReplicas":2,"TargetCPUUtilizationPercentage":70,"TargetMemoryUtilizationPercentage":100,"enabled":true,"extraMetrics":[]},"command":{"enabled":false,"value":[]},"containers":[],"dbMigrationConfig":{"enabled":false},"envoyproxy":{"configMapName":"","image":"quay.io/devtron/envoy:v1.14.1","resources":{"limits":{"cpu":"100m","memory":"100Mi"},"requests":{"cpu":"100m","memory":"100Mi"}}},"image":{"pullPolicy":"IfNotPresent"},"ingress":{"annotations":{},"enabled":false,"host":"gcp-geocoderv2-dl.delhivery.com","path":"/*","pathType":"ImplementationSpecific","tls":[]},"ingressInternal":{"annotations":{},"enabled":false,"host":"","path":"","tls":[]},"initContainers":[],"pauseForSecondsBeforeSwitchActive":30,"prometheus":{"release":"monitoring"},"replicaCount":1,"resources":{"limits":{"cpu":"12000m","memory":"5000Mi"},"requests":{"cpu":"7501m","memory":"4000Mi"}},"secret":{"data":{},"enabled":false},"server":{"deployment":{"image":"","image_tag":"1-95af053"}},"service":{"annotations":{},"type":"NodePort"},"servicemonitor":{"additionalLabels":{}},"tolerations":[{"effect":"NoSchedule","key":"dedicated","operator":"Equal","value":"n2d-highcpu-16"}],"volumeMounts":[],"volumes":[],"waitForSecondsBeforeScalingDown":30}","error":":1,330-339: Invalid template control keyword; "http_code" is not a valid template control keyword

{"level":"info","ts":1696406896.3244371,"caller":"common/apiError.go:118","msg":"ERROR RES","TYPE":"API-ERROR","RES":400,"ERROR-MSG":[{"code":"000","internalMessage":"[{invalid-template}]","userMessage":"invalid-template"}],"err":null}

👟 Reproduction steps

  1. Create a Devtron app.
  2. Put the liveness and use same http_code variable in commands.
  3. try to update deployment template.

👍 Expected behavior

It should allow me to save

👎 Actual Behavior

Getting error during save operation

☸ Kubernetes version

1.23

Cloud provider

AWS

🌍 Browser

Chrome

🧱 Your Environment

No response

✅ Proposed Solution

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find any similar issue

🏢 Have you read the Code of Conduct?

AB#5916

Metadata

Metadata

Labels

bugSomething isn't workingpager-dutyBugs / Issues found while on pager duty

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions