rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
460 stars 261 forks source link

[BUG] Cannot read properties of undefined (reading 'cloudprovider.harvesterhci.io/ipam') #9978

Closed skaven81 closed 11 months ago

skaven81 commented 1 year ago

Rancher Server Setup

Information about the Cluster

User Information

Describe the bug Both admins and unprivileged users trying to access the configuration panel for a specific workload (which was created using the Rancher UI) get a Vue error and a long traceback in the browser console.

To Reproduce

  1. Log into Rancher
  2. Access the cluster
  3. Filter to the workload's Project
  4. Visit the "Workloads" page
  5. Click the name of the workload (a Deployment)
  6. Click the Config button at the top right

Result Vue error appears, "Cannot read properties of undefined (reading 'cloudprovider.harvesterhci.io/ipam')"

Expected Result The config page appears.

Screenshots image

Additional context image

image

console.js:31  Cannot read properties of undefined (reading 'cloudprovider.harvesterhci.io/ipam')
e.forEach.console.<computed> @ console.js:31
(anonymous) @ client.js:111
p @ regeneratorRuntime.js:44
(anonymous) @ regeneratorRuntime.js:125
(anonymous) @ regeneratorRuntime.js:69
r @ asyncToGenerator.js:3
s @ asyncToGenerator.js:22
(anonymous) @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:19
(anonymous) @ client.js:113
$n @ vue.runtime.esm.js:3031
Bn @ vue.runtime.esm.js:3008
Hn @ vue.runtime.esm.js:3024
Hr @ vue.runtime.esm.js:4031
Qi.t._init @ vue.runtime.esm.js:5693
a @ vue.runtime.esm.js:5826
di @ vue.runtime.esm.js:4544
init @ vue.runtime.esm.js:4406
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
(anonymous) @ vue.runtime.esm.js:7071
Rr.t._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t @ vue.runtime.esm.js:3436
Fr @ vue.runtime.esm.js:3892
ro.$mount @ vue.runtime.esm.js:8772
init @ vue.runtime.esm.js:4407
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
(anonymous) @ vue.runtime.esm.js:7071
Rr.t._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t @ vue.runtime.esm.js:3436
Fr @ vue.runtime.esm.js:3892
ro.$mount @ vue.runtime.esm.js:8772
init @ vue.runtime.esm.js:4407
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
(anonymous) @ vue.runtime.esm.js:7071
Rr.t._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t @ vue.runtime.esm.js:3436
Fr @ vue.runtime.esm.js:3892
ro.$mount @ vue.runtime.esm.js:8772
init @ vue.runtime.esm.js:4407
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
(anonymous) @ vue.runtime.esm.js:7071
Rr.t._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t @ vue.runtime.esm.js:3436
Fr @ vue.runtime.esm.js:3892
ro.$mount @ vue.runtime.esm.js:8772
init @ vue.runtime.esm.js:4407
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
(anonymous) @ vue.runtime.esm.js:7071
Rr.t._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t @ vue.runtime.esm.js:3436
Fr @ vue.runtime.esm.js:3892
ro.$mount @ vue.runtime.esm.js:8772
init @ vue.runtime.esm.js:4407
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
_ @ vue.runtime.esm.js:6640
d @ vue.runtime.esm.js:6544
(anonymous) @ vue.runtime.esm.js:7109
Rr.t._update @ vue.runtime.esm.js:3769
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t.run @ vue.runtime.esm.js:3522
Zr @ vue.runtime.esm.js:4121
(anonymous) @ vue.runtime.esm.js:3143
Wn @ vue.runtime.esm.js:3065
Promise.then (async)
qn @ vue.runtime.esm.js:3090
Zn @ vue.runtime.esm.js:3155
ni @ vue.runtime.esm.js:4207
t.update @ vue.runtime.esm.js:3513
t.notify @ vue.runtime.esm.js:720
set @ vue.runtime.esm.js:963
(anonymous) @ fetch.client.js:91
p @ regeneratorRuntime.js:44
(anonymous) @ regeneratorRuntime.js:125
(anonymous) @ regeneratorRuntime.js:69
r @ asyncToGenerator.js:3
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
(anonymous) @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:19
f @ fetch.client.js:67
p @ fetch.client.js:58
u @ fetch.client.js:29
Hn @ vue.runtime.esm.js:3017
Hr @ vue.runtime.esm.js:4031
Fr @ vue.runtime.esm.js:3854
ro.$mount @ vue.runtime.esm.js:8772
init @ vue.runtime.esm.js:4407
v @ vue.runtime.esm.js:6567
d @ vue.runtime.esm.js:6521
T @ vue.runtime.esm.js:6816
I @ vue.runtime.esm.js:6909
(anonymous) @ vue.runtime.esm.js:7077
Rr.t._update @ vue.runtime.esm.js:3769
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t.run @ vue.runtime.esm.js:3522
Zr @ vue.runtime.esm.js:4121
(anonymous) @ vue.runtime.esm.js:3143
Wn @ vue.runtime.esm.js:3065
Promise.then (async)
qn @ vue.runtime.esm.js:3090
Zn @ vue.runtime.esm.js:3155
ni @ vue.runtime.esm.js:4207
t.update @ vue.runtime.esm.js:3513
Rr.t.$forceUpdate @ vue.runtime.esm.js:3794
l @ vue.runtime.esm.js:2761
(anonymous) @ vue.runtime.esm.js:2781
(anonymous) @ vue.runtime.esm.js:305
Promise.then (async)
In @ vue.runtime.esm.js:2801
pi @ vue.runtime.esm.js:4474
Fn @ vue.runtime.esm.js:2927
Rn @ vue.runtime.esm.js:2866
An.t._c @ vue.runtime.esm.js:2635
n @ index.vue:1
t._render @ vue.runtime.esm.js:2684
r @ vue.runtime.esm.js:3875
t.get @ vue.runtime.esm.js:3446
t.run @ vue.runtime.esm.js:3522
Zr @ vue.runtime.esm.js:4121
(anonymous) @ vue.runtime.esm.js:3143
Wn @ vue.runtime.esm.js:3065
Promise.then (async)
qn @ vue.runtime.esm.js:3090
Zn @ vue.runtime.esm.js:3155
ni @ vue.runtime.esm.js:4207
t.update @ vue.runtime.esm.js:3513
t.notify @ vue.runtime.esm.js:720
set @ vue.runtime.esm.js:963
(anonymous) @ fetch.client.js:91
p @ regeneratorRuntime.js:44
(anonymous) @ regeneratorRuntime.js:125
(anonymous) @ regeneratorRuntime.js:69
r @ asyncToGenerator.js:3
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
(anonymous) @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:19
f @ fetch.client.js:67
p @ fetch.client.js:58
$route.query @ index.vue:326
Hn @ vue.runtime.esm.js:3017
t.run @ vue.runtime.esm.js:3534
Zr @ vue.runtime.esm.js:4121
(anonymous) @ vue.runtime.esm.js:3143
Wn @ vue.runtime.esm.js:3065
Promise.then (async)
qn @ vue.runtime.esm.js:3090
Zn @ vue.runtime.esm.js:3155
ni @ vue.runtime.esm.js:4207
t.update @ vue.runtime.esm.js:3513
t.notify @ vue.runtime.esm.js:720
set @ vue.runtime.esm.js:963
(anonymous) @ vue-router.esm.js:3005
(anonymous) @ vue-router.esm.js:3004
te.updateRoute @ vue-router.esm.js:2414
(anonymous) @ vue-router.esm.js:2263
(anonymous) @ vue-router.esm.js:2402
r @ vue-router.esm.js:2084
Wt @ vue-router.esm.js:2095
(anonymous) @ vue-router.esm.js:2397
r @ vue-router.esm.js:2084
(anonymous) @ vue-router.esm.js:2088
(anonymous) @ vue-router.esm.js:2384
(anonymous) @ vue-router.esm.js:2162
p @ vue-router.esm.js:2362
r @ vue-router.esm.js:2087
r @ vue-router.esm.js:2091
(anonymous) @ vue-router.esm.js:2088
(anonymous) @ vue-router.esm.js:2384
(anonymous) @ authenticated.js:292
p @ vue-router.esm.js:2362
r @ vue-router.esm.js:2087
(anonymous) @ vue-router.esm.js:2088
(anonymous) @ vue-router.esm.js:2384
(anonymous) @ client.js:519
p @ regeneratorRuntime.js:44
(anonymous) @ regeneratorRuntime.js:125
(anonymous) @ regeneratorRuntime.js:69
r @ asyncToGenerator.js:3
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
(anonymous) @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:19
I @ client.js:288
p @ vue-router.esm.js:2362
r @ vue-router.esm.js:2087
(anonymous) @ vue-router.esm.js:2088
(anonymous) @ vue-router.esm.js:2384
(anonymous) @ client.js:205
p @ regeneratorRuntime.js:44
(anonymous) @ regeneratorRuntime.js:125
(anonymous) @ regeneratorRuntime.js:69
r @ asyncToGenerator.js:3
s @ asyncToGenerator.js:22
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
(anonymous) @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:19
P @ client.js:166
p @ vue-router.esm.js:2362
r @ vue-router.esm.js:2087
Wt @ vue-router.esm.js:2095
te.confirmTransition @ vue-router.esm.js:2392
te.transitionTo @ vue-router.esm.js:2260
e.replace @ vue-router.esm.js:2618
(anonymous) @ vue-router.esm.js:3049
_e.replace @ vue-router.esm.js:3048
a.a.replace @ extend-router.js:33
a.a.applyQuery @ extend-router.js:52
set @ Masthead.vue:315
callback @ Masthead.vue:1
Hn @ vue.runtime.esm.js:3017
n @ vue.runtime.esm.js:1815
Hn @ vue.runtime.esm.js:3017
Ir.t.$emit @ vue.runtime.esm.js:3716
change @ ButtonGroup.vue:64
click @ ButtonGroup.vue:1
Hn @ vue.runtime.esm.js:3017
n @ vue.runtime.esm.js:1815
Ra.o._wrapper @ vue.runtime.esm.js:7473
skaven81 commented 1 year ago

I have a strong suspicion that the reference to harvester is just by chance...we have absolutely NO HarvesterHCI configuration or deployment or anything in this cluster or even at our company. So I have no idea why Vue would be looking up anything about Harvester at all.

skaven81 commented 1 year ago

Interestingly, I'm able to access other workloads in this cluster+Project and they are able to load the config panel just fine. It just seems to be this one workload that is doing this.

skaven81 commented 1 year ago

The fdat workload YAML:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    field.cattle.io/publicEndpoints: '[{"addresses":["10.86.215.43"],"port":32767,"protocol":"TCP","serviceName":"fdat:fdat-nodeport","allNodes":true}]'
  creationTimestamp: "2023-10-10T19:28:55Z"
  generation: 16
  labels:
    workload.user.cattle.io/workloadselector: apps.deployment-fdat-fdat
  name: fdat
  namespace: fdat
  resourceVersion: "812392567"
  uid: 3acb8d57-90c6-44bb-8b38-c8fff1e5483d
spec:
  progressDeadlineSeconds: 600
  replicas: 0
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      workload.user.cattle.io/workloadselector: apps.deployment-fdat-fdat
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        workload.user.cattle.io/workloadselector: apps.deployment-fdat-fdat
      namespace: fdat
    spec:
      affinity: {}
      containers:
      - image: <redacted>
        imagePullPolicy: Always
        name: container-0
        ports:
        - containerPort: 5000
          name: fdat-integ
          protocol: TCP
        resources: {}
        securityContext:
          allowPrivilegeEscalation: false
          privileged: false
          readOnlyRootFilesystem: false
          runAsNonRoot: false
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: docker-registry
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  conditions:
  - lastTransitionTime: "2023-10-10T19:28:55Z"
    lastUpdateTime: "2023-10-10T19:29:00Z"
    message: ReplicaSet "fdat-6664bdc95c" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  - lastTransitionTime: "2023-10-24T07:29:28Z"
    lastUpdateTime: "2023-10-24T07:29:28Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 16
wszgrcy commented 1 year ago

I have same bug on StatefulSet.but if I use clone or edit yaml,it will open success. I have update k3s(1.24->1.26) and rancher 2.7.2->2.7.8(docker)

menrd commented 12 months ago

We also had this problem. I added the missing annotations in the service of the workload and it works.

apiVersion: v1 kind: Service metadata: annotations: field.cattle.io/targetWorkloadIds: '["namespace/workloadName"]' management.cattle.io/ui-managed: 'true'

It is also mentioned here: https://forums.rancher.com/t/got-cannot-read-properties-of-undefined-reading-cloudprovider-harvesterhci-io-ipam-when-viewing-or-editing-config/41362/4

hhstu commented 11 months ago

It is a bug

changer this file shell/edit/workload/mixins/workload.js

- const ui = svc?.metadata?.annotations[UI_MANAGED];
+ const ui = svc?.metadata?.annotations?.[UI_MANAGED];
stdec commented 6 months ago

It is a bug

changer this file shell/edit/workload/mixins/workload.js

- const ui = svc?.metadata?.annotations[UI_MANAGED];
+ const ui = svc?.metadata?.annotations?.[UI_MANAGED];

where can find this file “shell/edit/workload/mixins/workload.js”?i find this file in rancher container, but can't find

hhstu commented 6 months ago

@stdec 我是在 v2.7.9 上修改的,也许更新的版本上有改动