Got Cannot read properties of undefined (reading 'cloudprovider.harvesterhci.io/ipam') when viewing or editing config

Rancher Server: v2.7.5
Kubernetes Cluster: RKE2
Version: v1.24.4 +rke2r1

Hi,

I have depoyments in specific namespace where when I try to edit or view configuration via web interface, I get this error:
Cannot read properties of undefined (reading ‘cloudprovider.harvesterhci.io/ipam’)

Viewing or editing configuration via YAML works ok.
I have this problem only on deployments in this one specific namespace, everywhere else works ok.
I tried to check yaml files from namspace, deployment and all other resources in that specific namespace for something related to harvesterhci, but did not find anything.
Also, I am not even using Harvester, but it is enabled.

We ran into a similar issue as well but had no idea why the issue was occurring, so we just started going back through our steps 1 by 1.

Interestingly enough, we found that the NodePort’s selector for the deployment was causing our problem. Of course, we still need the selector, but the selector we had chosen was using labels that Rancher created (“workload.user.cattle.io/workloadselector”). Instead, we’re gonna move to using our own labels and see if the problem still exists.

I tried to edit the post again, but the system isn’t letting me.

We solved our issue. The problem only occurs when we use eksctl or the REST API to generate services using “http://workload.user.cattle.io/workloadselector” as a label selector.

For example, look at the deployment and the services below

Deployment:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: nginx
  labels:
    app: nginx
    workload.user.cattle.io/workloadselector: apps.deployment-43ty4tjx-nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:1.25.0
          ports:
            - containerPort: 80

Service (BAD):

---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  type: NodePort
  ports:
    - name: proxy
      port: 80
      protocol: TCP
  selector:
    workload.user.cattle.io/workloadselector: apps.deployment-43ty4tjx-nginx

Service (GOOD):

---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  type: NodePort
  ports:
    - name: proxy
      port: 80
      protocol: TCP
  selector:
    app: nginx

The rancher dashboard will use this selector as well if you create it, but it seems it does not like it when it comes from interfacing directly with kubernetes. Using your own generated labels, avoids the issue altogether.

Hopefully, this helps!

Rancher Server: v2.7.7
Kubernetes Cluster: RKE1
Version:v1.24.17

We also came across these errors when trying to edit a deployment in a specific namespace.
But the errors were dependent on the used browser.
In Firefox: "t.annotations is undefined "
But in Edge we got:
"Cannot read properties of undefined (reading ‘cloudprovider.harvesterhci.io/ipam’) "

Comparing with older deployments we saw that the deployment that we wanted to edit, had a service attached that was working fine but was missing the annotations part below metadata in the yaml:

Not Working:

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: '2023-09-18T15:11:18Z'
  managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1

Working:

apiVersion: v1
kind: Service
metadata:
  annotations:
    field.cattle.io/description: description for the service
  creationTimestamp: '2021-09-22T11:55:05Z'
  managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1

Once I edited the yaml and pasted the annotation piece, we were able to edit the deployment through the Rancher WebUI