metadata_test.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. suite: rbac metadata test
  2. templates:
  3. - common.yaml
  4. chart:
  5. appVersion: &appVer v9.9.9
  6. tests:
  7. - it: should pass with rbac created with labels and annotations
  8. set:
  9. label1: label1
  10. label2: global_label2
  11. annotation1: annotation1
  12. annotation2: global_annotation2
  13. global:
  14. labels:
  15. g_label1: global_label1
  16. g_label2: "{{ .Values.label2 }}"
  17. annotations:
  18. g_annotation1: global_annotation1
  19. g_annotation2: "{{ .Values.annotation2 }}"
  20. serviceAccount:
  21. my-sa1:
  22. enabled: true
  23. primary: true
  24. rbac:
  25. my-rbac1:
  26. enabled: true
  27. primary: true
  28. labels:
  29. label1: "{{ .Values.label1 }}"
  30. label2: label2
  31. annotations:
  32. annotation1: "{{ .Values.annotation1 }}"
  33. annotation2: annotation2
  34. rules:
  35. - apiGroups:
  36. - ""
  37. resources:
  38. - pods
  39. verbs:
  40. - get
  41. - list
  42. - watch
  43. my-rbac2:
  44. enabled: true
  45. primary: false
  46. clusterWide: true
  47. allServiceAccounts: true
  48. labels:
  49. label1: "{{ .Values.label1 }}"
  50. label2: label2
  51. annotations:
  52. annotation1: "{{ .Values.annotation1 }}"
  53. annotation2: annotation2
  54. rules:
  55. - apiGroups:
  56. - ""
  57. resources:
  58. - pods
  59. verbs:
  60. - get
  61. - list
  62. - watch
  63. asserts:
  64. - documentIndex: &roleDoc 1
  65. isKind:
  66. of: Role
  67. - documentIndex: *roleDoc
  68. equal:
  69. path: metadata.annotations
  70. value:
  71. annotation1: annotation1
  72. annotation2: annotation2
  73. g_annotation1: global_annotation1
  74. g_annotation2: global_annotation2
  75. - documentIndex: *roleDoc
  76. equal:
  77. path: metadata.labels
  78. value:
  79. app: common-test-1.0.0
  80. release: RELEASE-NAME
  81. helm-revision: "0"
  82. helm.sh/chart: common-test-1.0.0
  83. app.kubernetes.io/name: common-test
  84. app.kubernetes.io/instance: RELEASE-NAME
  85. app.kubernetes.io/managed-by: Helm
  86. app.kubernetes.io/version: *appVer
  87. g_label1: global_label1
  88. g_label2: global_label2
  89. label1: label1
  90. label2: label2
  91. - documentIndex: &roleBindingDoc 2
  92. isKind:
  93. of: RoleBinding
  94. - documentIndex: *roleBindingDoc
  95. equal:
  96. path: metadata.annotations
  97. value:
  98. annotation1: annotation1
  99. annotation2: annotation2
  100. g_annotation1: global_annotation1
  101. g_annotation2: global_annotation2
  102. - documentIndex: *roleBindingDoc
  103. equal:
  104. path: metadata.labels
  105. value:
  106. app: common-test-1.0.0
  107. release: RELEASE-NAME
  108. helm-revision: "0"
  109. helm.sh/chart: common-test-1.0.0
  110. app.kubernetes.io/name: common-test
  111. app.kubernetes.io/instance: RELEASE-NAME
  112. app.kubernetes.io/managed-by: Helm
  113. app.kubernetes.io/version: *appVer
  114. g_label1: global_label1
  115. g_label2: global_label2
  116. label1: label1
  117. label2: label2
  118. - documentIndex: &clusterRoleDoc 3
  119. isKind:
  120. of: ClusterRole
  121. - documentIndex: *clusterRoleDoc
  122. equal:
  123. path: metadata.annotations
  124. value:
  125. annotation1: annotation1
  126. annotation2: annotation2
  127. g_annotation1: global_annotation1
  128. g_annotation2: global_annotation2
  129. - documentIndex: *clusterRoleDoc
  130. equal:
  131. path: metadata.labels
  132. value:
  133. app: common-test-1.0.0
  134. release: RELEASE-NAME
  135. helm-revision: "0"
  136. helm.sh/chart: common-test-1.0.0
  137. app.kubernetes.io/name: common-test
  138. app.kubernetes.io/instance: RELEASE-NAME
  139. app.kubernetes.io/managed-by: Helm
  140. app.kubernetes.io/version: *appVer
  141. g_label1: global_label1
  142. g_label2: global_label2
  143. label1: label1
  144. label2: label2
  145. - documentIndex: &clusterRoleBindingDoc 4
  146. isKind:
  147. of: ClusterRoleBinding
  148. - documentIndex: *clusterRoleBindingDoc
  149. equal:
  150. path: metadata.annotations
  151. value:
  152. annotation1: annotation1
  153. annotation2: annotation2
  154. g_annotation1: global_annotation1
  155. g_annotation2: global_annotation2
  156. - documentIndex: *clusterRoleBindingDoc
  157. equal:
  158. path: metadata.labels
  159. value:
  160. app: common-test-1.0.0
  161. release: RELEASE-NAME
  162. helm-revision: "0"
  163. helm.sh/chart: common-test-1.0.0
  164. app.kubernetes.io/name: common-test
  165. app.kubernetes.io/instance: RELEASE-NAME
  166. app.kubernetes.io/managed-by: Helm
  167. app.kubernetes.io/version: *appVer
  168. g_label1: global_label1
  169. g_label2: global_label2
  170. label1: label1
  171. label2: label2