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!