0

I am new to the whole Kubernetes-Helm thing, please bear with me and I'll try to give as much clarity to my question as possible

So I have this ConfigMap.yaml file that does this:

apiVersion: v1
kind: ConfigMap
metadata:
  name: envread-settings
  namespace: {{ .Values.environment.namespace }}
data:
  appsettings.environment.json: |-
    {
      "featureBranch": {{ .Values.component.vars.featureId | quote }},
      "BFFServiceUrl": {{ .Values.environment.BFFServiceUrl | quote }}
    }
---

Where the Values are:

  • .Values.component.vars.featureId = 123
  • .Values.environment.BFFServiceUrl = api.dev.integrations/bff-service

This creates an appsettings.environment.json file in a volume path I specified. I need to dynamically create this json file because I need to insert the above variables in there (can't use environment variables sadly for my app).

When I ssh into the terminal and vim everything looks dandy on that file i.e:

{
   "featureBranch": "123",
   "BFFServiceUrl": "api.dev.integration/bff-service"
}

But when I curl this file I get:

{
   "featureBranch": "123",

and the same can be said when I browse directly to this file (I am running an Angular SPA app using ASP.NET Core 3.1).

Is there something horribly wrong I am doing in the yaml file?

Edit The curl command that I am running is: curl https://api.integrations.portal/assets/appsettings.json. There is a NGINX Ingress running in between the request and response.

user13731870
  • 95
  • 1
  • 1
  • 6
  • When you say "curl the file", what are you actually doing; what command are you running, from where, what application code is serving it, and what layers of proxies are between the request and the response? The ConfigMap syntactically looks fine to me and it sounds like the file is getting mapped into the pod correctly. – David Maze Jul 12 '21 at 22:28
  • @DavidMaze Sorry about the lack of information. I will update the original question. I am running this command: `curl https://api.integrations.portal/assets/appsettings.json` And I also browse to that URL in my Chrome Browser. I have Nginx Ingress running between the request and response. Does that help? Sorry if it doesn't. – user13731870 Jul 12 '21 at 23:00

1 Answers1

1

I used to have a similar problem. In my case, curl returned error code 18. You can check this for yourself by running your curl and then echo $?. As I mentioned I had error code 18 which means:

CURLE_PARTIAL_FILE (18) A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't match the previously given size.

Here you will find a link to the description of any errors that curl may return. In case you get another error.

This seems to be a server side issue. You might try to work it around by forcing HTTP 1.0 connection (to avoid chunked transfer which might cause this problem) with the --http1.0 option.

Additionally, if you have a Reverse Proxy or Load Balancer using Nginx and your /var (or your partition where Nginx logging happens) is full, Nginx's server response might be cut off.

You can also read this question.

Mikołaj Głodziak
  • 4,775
  • 7
  • 28
  • 1
    After some digging to find that error code, looks like theissue was the chunked transfer problem. Marking this as correct, thank you! – user13731870 Jul 19 '21 at 19:05