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

CF_INSTANCE_PORTS env missing on workloads #3229

Closed
marsteg opened this issue Apr 23, 2024 · 1 comment
Closed

CF_INSTANCE_PORTS env missing on workloads #3229

marsteg opened this issue Apr 23, 2024 · 1 comment
Labels

Comments

@marsteg
Copy link
Contributor

marsteg commented Apr 23, 2024

Background

Problem
The CATS test identified by ContainerHierarchyTexts and LeafNodeText "Application Lifecycle", "pushing", "makes system environment variables available" and "and validates" fails with the following:

Unexpected error:
    <*json.SyntaxError | 0xc0004993e0>: 
    unexpected end of JSON input
    {
        msg: \"unexpected end of JSON input\",
        Offset: 0,
    }
occurred

in the log we see (keep an eye at the envValues at the bottom):


[2024-03-13 12:45:47.69 (UTC)]> curl -k -H Expect: -s https://CATS-1-APP-13550cb8b2f1b507.apps.b78b386.kyma.ondemand.com/env.json 
{\"CF_INSTANCE_GUID\":\"b3d9ac78-0b87-4e93-a705-43c770fa95c1\",\"CF_INSTANCE_INDEX\":\"0\",\"CF_INSTANCE_INTERNAL_IP\":\"10.96.5.36\",\"CF_INSTANCE_IP\":\"10.250.2.45\",\"HOME\":\"/home/cnb\",\"HOSTNAME\":\"46575810-b521-4024-b885-57af50ab1f7d-7e1-676b771382-0\",\"KUBERNETES_PORT\":\"tcp://10.104.0.1:443\",\"KUBERNETES_PORT_443_TCP\":\"tcp://10.104.0.1:443\",\"KUBERNETES_PORT_443_TCP_ADDR\":\"10.104.0.1\",\"KUBERNETES_PORT_443_TCP_PORT\":\"443\",\"KUBERNETES_PORT_443_TCP_PROTO\":\"tcp\",\"KUBERNETES_SERVICE_HOST\":\"api.b78b386.kyma.internal.live.k8s.ondemand.com\",\"KUBERNETES_SERVICE_PORT\":\"443\",\"KUBERNETES_SERVICE_PORT_HTTPS\":\"443\",\"MEMORY_LIMIT\":\"256M\",\"OLDPWD\":\"/workspace\",\"PATH\":\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\"POD_NAME\":\"46575810-b521-4024-b885-57af50ab1f7d-7e1-676b771382-0\",\"PORT\":\"8080\",\"PWD\":\"/workspace\",\"SHLVL\":\"0\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_PORT\":\"tcp://10.110.247.76:8080\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_PORT_8080_TCP\":\"tcp://10.110.247.76:8080\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_PORT_8080_TCP_ADDR\":\"10.110.247.76\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_PORT_8080_TCP_PORT\":\"8080\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_PORT_8080_TCP_PROTO\":\"tcp\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_SERVICE_HOST\":\"10.110.247.76\",\"S_00E378C6_08D4_4244_92F2_0CCC30E70246_SERVICE_PORT\":\"8080\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_PORT\":\"tcp://10.109.24.173:8080\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_PORT_8080_TCP\":\"tcp://10.109.24.173:8080\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_PORT_8080_TCP_ADDR\":\"10.109.24.173\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_PORT_8080_TCP_PORT\":\"8080\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_PORT_8080_TCP_PROTO\":\"tcp\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_SERVICE_HOST\":\"10.109.24.173\",\"S_523D42B0_F955_4244_961E_1ED354D44CFE_SERVICE_PORT\":\"8080\",\"VCAP_APPLICATION\":\"{\\\"application_id\\\":\\\"46575810-b521-4024-b885-57af50ab1f7d\\\",\\\"application_name\\\":\\\"CATS-1-APP-13550cb8b2f1b507\\\",\\\"application_uris\\\":[\\\"cats-1-app-13550cb8b2f1b507.apps.b78b386.kyma.ondemand.com\\\"],\\\"cf_api\\\":\\\"https://cfapi.b78b386.kyma.ondemand.com\\\",\\\"name\\\":\\\"CATS-1-APP-13550cb8b2f1b507\\\",\\\"organization_id\\\":\\\"8f32369b-6e47-4f63-b173-bca7b47b18a8\\\",\\\"organization_name\\\":\\\"CATS-1-ORG-cc38861a56d7ebd3\\\",\\\"space_id\\\":\\\"7e178d2a-410e-4418-9803-a740fdd4da0b\\\",\\\"space_name\\\":\\\"CATS-1-SPACE-2c2ce204e0ba6dad\\\",\\\"uris\\\":[\\\"cats-1-app-13550cb8b2f1b507.apps.b78b386.kyma.ondemand.com\\\"]}\",\"VCAP_APP_HOST\":\"0.0.0.0\",\"VCAP_APP_PORT\":\"8080\",\"VCAP_SERVICES\":\"{}\",\"_\":\"./catnip\"}envValues: {0 10.250.2.45 10.96.5.36   }
Looking at the code https://github.com/cloudfoundry/cf-acceptance-tests/blob/main/apps/lifecycle.go#L293 which prints the envValues above we can conclude that the json parsing error happens at: https://github.com/cloudfoundry/cf-acceptance-tests/blob/main/apps/lifecycle.go#L302

And if we check manually:

curl -k -H Expect: -s https://CATS-1-APP-13550cb8b2f1b507.apps.b78b386.kyma.ondemand.com/env.json  | jq . | grep CF
  "CF_INSTANCE_GUID": "44af1010-7452-4ea6-8931-b828f98774d9",
  "CF_INSTANCE_INDEX": "0",
  "CF_INSTANCE_INTERNAL_IP": "10.96.2.235",
  "CF_INSTANCE_IP": "10.250.1.95",

The json is missing the CF_INSTANCE_PORTS field.

Action to take

add environment variable to workloads

Impact

additional env in container

Dev Notes

No response

@marsteg
Copy link
Contributor Author

marsteg commented Apr 23, 2024

opened PR #3230

@marsteg marsteg closed this as completed May 7, 2024
@github-project-automation github-project-automation bot moved this from 🧊 Icebox to ✅ Done in Korifi - Backlog May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

1 participant