Skip to content

fcgi annotation error incorrect interpretation of PHP_VALUE #13184

Closed
@jidckii

Description

@jidckii

What happened:

I updated the controller using helm from version 4.7.2 (controller-v1.8.2) to the latest version helm 4.12.1 (controller-v1.12.1)
After that, the ingress resource stopped deploying with the error "ingress contains invalid annotation value" err="annotation fastcgi-params-configmap contains invalid value". This also repeats on version helm 4.11.5 (controller-v1.11.5).

here is the complete error:

E0408 12:59:44.682718       7 main.go:149] "fcgi annotation error" err="fcgi contains invalid key or value" configmap="jidckii-test-api" namespace="dev-sdelka-api" key="PHP_VALUE" value=<
        upload_max_filesize=100M
        post_max_size=100M
        memory_limit=256M'
 >
E0408 12:59:44.682747       7 annotations.go:196] "ingress contains invalid annotation value" err="annotation fastcgi-params-configmap contains invalid value"

I didn't change the specs and it worked before.

configmap itself looked like this:

$ kubectl get -n dev-sdelka-api -o yaml  configmap/jidckii-test-api
apiVersion: v1
data:
  PHP_VALUE: |-
    upload_max_filesize=100M
    post_max_size=100M
    memory_limit=256M
kind: ConfigMap
Full example of resources
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: jidckii-test-api
  labels:
    app.kubernetes.io/name: api
    app.kubernetes.io/instance: jidckii-test
data:
  PHP_VALUE: |-
    upload_max_filesize=100M
    post_max_size=100M
    memory_limit=256M

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jidckii-test-api
  labels:
    app.kubernetes.io/name: api
    app.kubernetes.io/instance: jidckii-test
  annotations:
    nginx.ingress.kubernetes.io/fastcgi-params-configmap: "jidckii-test-api"
spec:
  tls:
    - hosts:
        - "dev.example.com"
  rules:
    - host: "dev.example.com""
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: jidckii-test-api
                port:
                  number: 9000

I tried to reduce it to one line but started getting a different error:

Full example of resources
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: jidckii-test-api
  labels:
    app.kubernetes.io/name: api
    app.kubernetes.io/instance: jidckii-test
data:
  PHP_VALUE: 'upload_max_filesize=100M\npost_max_size=100M\nmemory_limit=256M'

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jidckii-test-api
  labels:
    app.kubernetes.io/name: api
    app.kubernetes.io/instance: jidckii-test
  annotations:
    nginx.ingress.kubernetes.io/fastcgi-params-configmap: "jidckii-test-api"
spec:
  tls:
    - hosts:
        - "dev.example.com"
  rules:
    - host: "dev.example.com""
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: jidckii-test-api
                port:
                  number: 9000

configmap itself looked like this:

$ kubectl get -n dev-sdelka-api -o yaml  configmap/jidckii-test-api
apiVersion: v1
data:
  PHP_VALUE: upload_max_filesize=100M\npost_max_size=100M\nmemory_limit=256M
kind: ConfigMap
E0408 13:00:45.356945       7 main.go:149] "fcgi annotation error" err="fcgi contains invalid key or value" configmap="jidckii-test-api" namespace="dev-sdelka-api" key="PHP_VALUE" value="upload_max_filesize=100M\\npost_max_size=100M\\nmemory_limit=256M"
E0408 13:00:45.357039       7 annotations.go:196] "ingress contains invalid annotation value" err="annotation fastcgi-params-configmap contains invalid value"
E0408 13:00:45.357420       7 main.go:96] "invalid ingress configuration" err="annotation fastcgi-params-configmap contains invalid value" ingress="dev-sdelka-api/jidckii-test-api"

As you can see, for some reason when passing to the controller \n is replaced by \\n and apparently this breaks the validation.

Well, I can't go back to the earlier version due to vulnerabilities, but I can't work on the new one either. Can anyone tell me if this is a bug or if I can somehow make the correct configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.needs-prioritytriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions