travisghansen / kubernetes-pfsense-controller

Integrate Kubernetes and pfSense
Apache License 2.0
197 stars 22 forks source link

PHP Warning: Undefined array key "data" #21

Closed ck3mp closed 1 year ago

ck3mp commented 1 year ago

I seem to be seeing this quite a lot in the logs for the pod when this runs...

2022-10-25T14:56:17+00:00 controller config loaded/updated
2022-10-25T14:56:17+00:00 loading plugin haproxy-declarative
PHP Warning:  Undefined array key "data" in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Trying to access array offset on value of type null in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  foreach() argument must be of type array|object, null given in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Undefined array key "data" in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Trying to access array offset on value of type null in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  foreach() argument must be of type array|object, null given in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Undefined array key "data" in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 100
PHP Warning:  Trying to access array offset on value of type null in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 100
PHP Warning:  foreach() argument must be of type array|object, null given in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 100
2022-10-25T14:56:18+00:00 plugin (haproxy-declarative): successfully reloaded HAProxy service
PHP Warning:  Undefined array key "data" in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Trying to access array offset on value of type null in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  foreach() argument must be of type array|object, null given in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Undefined array key "data" in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  Trying to access array offset on value of type null in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310
PHP Warning:  foreach() argument must be of type array|object, null given in phar:///usr/local/bin/kubernetes-pfsense-controller/src/KubernetesPfSenseController/Plugin/HAProxyDeclarative.php on line 310

I'm not sure why its happening but I've been trying to debug all afternoon and cant seem to see any patterns...

I'm using the declarative plugin only with a custom configmap as (just to test):

apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: "2022-10-25T14:54:45Z"
  labels:
    app: pfsense
    kustomize.toolkit.fluxcd.io/name: apps
    kustomize.toolkit.fluxcd.io/namespace: flux-system
    pfsense.org/type: declarative
  name: haproxy-declaratives-75hbc5ccgd
  namespace: networking
  resourceVersion: "2847484"
  uid: 4af2b995-dd56-40fb-a507-a31c0429a87f
data:
  data: |
    resources:
      - type: frontend
        definition:
          name: some-frontend-name
          type: http
          forwardfor: yes
          status: active
          backend_serverpool:
          a_extaddr:
            item:
              - extaddr: wan_ipv4
                extaddr_port: 443
                extaddr_ssl: yes
travisghansen commented 1 year ago

You may have a configmap which is empty or something else strang going on:

kubectl get configmaps -l pfsense.org/type=declarative -A

ck3mp commented 1 year ago

You were right. It was empty, typo in the name. Thanks.