Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

KeyError: 'metadata' while validating API "RoleList" #96

Open
zensolution opened this issue Oct 21, 2019 · 4 comments
Open

KeyError: 'metadata' while validating API "RoleList" #96

zensolution opened this issue Oct 21, 2019 · 4 comments

Comments

@zensolution
Copy link

I received the follow error while I am validating RoleList. It seems that RoleList doesn't have to have a name.

  File "kubediff/kubedifflib/_kube.py", line 58, in from_dict
    name = data["metadata"]["name"]
KeyError: 'metadata'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleList
items:
- apiVersion: rbac.authorization.k8s.io/v1
  kind: Role
  metadata:
    name: prometheus-k8s
    namespace: default
  rules:
  - apiGroups:
    - ""
    resources:
    - services
    - endpoints
    - pods
    verbs:
    - get
    - list
    - watch
@gibbonsjohnm
Copy link

Any update on this?

@zensolution
Copy link
Author

I am sorry for the late reply. The fix went well. Thanks,

@gibbonsjohnm
Copy link

@zensolution Sorry, what was the fix?

@CtheSky
Copy link
Contributor

CtheSky commented Mar 16, 2020

Same here using latest master (385f72f) with RoleBindingList:

apiVersion: rbac.authorization.k8s.io/v1
items:
- apiVersion: rbac.authorization.k8s.io/v1
  kind: RoleBinding
  metadata:
    name: prometheus-k8s
    namespace: default
  roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: Role
    name: prometheus-k8s
  subjects:
  - kind: ServiceAccount
    name: prometheus-k8s
    namespace: monitoring
- apiVersion: rbac.authorization.k8s.io/v1
  kind: RoleBinding
  metadata:
    name: prometheus-k8s
    namespace: kube-system
  roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: Role
    name: prometheus-k8s
  subjects:
  - kind: ServiceAccount
    name: prometheus-k8s
    namespace: monitoring
- apiVersion: rbac.authorization.k8s.io/v1
  kind: RoleBinding
  metadata:
    name: prometheus-k8s
    namespace: monitoring
  roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: Role
    name: prometheus-k8s
  subjects:
  - kind: ServiceAccount
    name: prometheus-k8s
    namespace: monitoring
kind: RoleBindingList

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants