rbac_test.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. suite: test rbac
  2. templates:
  3. - rbac.yaml
  4. tests:
  5. - it: should remove the labels aggregate-to-view to the view ClusterRole
  6. set:
  7. rbac:
  8. aggregateToView: false
  9. asserts:
  10. - notExists:
  11. path: metadata.labels["rbac.authorization.k8s.io/aggregate-to-view"]
  12. documentSelector:
  13. kind: ClusterRole
  14. path: metadata.name
  15. value: RELEASE-NAME-external-secrets-view
  16. - it: should remove the labels aggregate-to-edit to the view and edit ClusterRoles
  17. set:
  18. rbac:
  19. aggregateToEdit: false
  20. asserts:
  21. - notExists:
  22. path: metadata.labels["rbac.authorization.k8s.io/aggregate-to-edit"]
  23. documentSelector:
  24. kind: ClusterRole
  25. path: metadata.name
  26. value: RELEASE-NAME-external-secrets-view
  27. - notExists:
  28. path: metadata.labels["rbac.authorization.k8s.io/aggregate-to-edit"]
  29. documentSelector:
  30. kind: ClusterRole
  31. path: metadata.name
  32. value: RELEASE-NAME-external-secrets-edit
  33. - it: should not create auth delegator ClusterRoleBinding by default
  34. documentSelector:
  35. path: kind
  36. value: ClusterRoleBinding
  37. asserts:
  38. - notEqual:
  39. path: metadata.name
  40. value: RELEASE-NAME-external-secrets-auth-delegator
  41. - it: should create auth delegator ClusterRoleBinding when systemAuthDelegator is true
  42. set:
  43. systemAuthDelegator: true
  44. documentSelector:
  45. path: metadata.name
  46. value: RELEASE-NAME-external-secrets-auth-delegator
  47. asserts:
  48. - isKind:
  49. of: ClusterRoleBinding
  50. - equal:
  51. path: roleRef.apiGroup
  52. value: rbac.authorization.k8s.io
  53. - equal:
  54. path: roleRef.kind
  55. value: ClusterRole
  56. - equal:
  57. path: roleRef.name
  58. value: system:auth-delegator
  59. - equal:
  60. path: subjects[0].kind
  61. value: ServiceAccount
  62. - equal:
  63. path: subjects[0].name
  64. value: RELEASE-NAME-external-secrets
  65. - equal:
  66. path: subjects[0].namespace
  67. value: NAMESPACE