cert_controller_test.yaml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. suite: test cert controller deployment
  2. templates:
  3. - cert-controller-deployment.yaml
  4. - cert-controller-service.yaml
  5. tests:
  6. - it: should match snapshot of default values
  7. templates:
  8. - cert-controller-deployment.yaml
  9. asserts:
  10. - matchSnapshot: {}
  11. - it: should set imagePullPolicy to Always
  12. set:
  13. certController.image.pullPolicy: Always
  14. templates:
  15. - cert-controller-deployment.yaml
  16. asserts:
  17. - equal:
  18. path: spec.template.spec.containers[0].imagePullPolicy
  19. value: Always
  20. - it: should imagePullPolicy to be default value IfNotPresent
  21. templates:
  22. - cert-controller-deployment.yaml
  23. asserts:
  24. - equal:
  25. path: spec.template.spec.containers[0].imagePullPolicy
  26. value: IfNotPresent
  27. - it: should override securityContext
  28. set:
  29. certController.podSecurityContext:
  30. runAsUser: 2000
  31. certController.securityContext:
  32. runAsUser: 3000
  33. templates:
  34. - cert-controller-deployment.yaml
  35. asserts:
  36. - equal:
  37. path: spec.template.spec.securityContext
  38. value:
  39. runAsUser: 2000
  40. - equal:
  41. path: spec.template.spec.containers[0].securityContext
  42. value:
  43. allowPrivilegeEscalation: false
  44. capabilities:
  45. drop:
  46. - ALL
  47. readOnlyRootFilesystem: true
  48. runAsNonRoot: true
  49. runAsUser: 3000
  50. seccompProfile:
  51. type: RuntimeDefault
  52. - it: should override hostNetwork
  53. set:
  54. certController.hostNetwork: true
  55. templates:
  56. - cert-controller-deployment.yaml
  57. asserts:
  58. - equal:
  59. path: spec.template.spec.hostNetwork
  60. value: true
  61. - it: should override readinessProbe port
  62. set:
  63. certController.readinessProbe.port: 8082
  64. templates:
  65. - cert-controller-deployment.yaml
  66. asserts:
  67. - equal:
  68. path: spec.template.spec.containers[0].args[7]
  69. value: "--healthz-addr=:8082"
  70. - it: should override metrics port
  71. set:
  72. certController.metrics.listen.port: 8888
  73. templates:
  74. - cert-controller-deployment.yaml
  75. asserts:
  76. - equal:
  77. path: spec.template.spec.containers[0].args[6]
  78. value: "--metrics-addr=:8888"
  79. - it: should override image flavour
  80. set:
  81. certController.image.repository: ghcr.io/external-secrets/external-secrets
  82. certController.image.tag: v0.9.8
  83. certController.image.flavour: ubi-boringssl
  84. templates:
  85. - cert-controller-deployment.yaml
  86. asserts:
  87. - equal:
  88. path: spec.template.spec.containers[0].image
  89. value: ghcr.io/external-secrets/external-secrets:v0.9.8-ubi-boringssl
  90. - it: should override image flavour
  91. set:
  92. certController.image.repository: example.com/external-secrets/external-secrets
  93. certController.image.tag: v0.9.9-ubi
  94. templates:
  95. - cert-controller-deployment.yaml
  96. asserts:
  97. - equal:
  98. path: spec.template.spec.containers[0].image
  99. value: example.com/external-secrets/external-secrets:v0.9.9-ubi
  100. - it: should render service without metrics label when metrics is enabled
  101. set:
  102. certController.metrics.service.enabled: true
  103. templates:
  104. - cert-controller-service.yaml
  105. asserts:
  106. - hasDocuments:
  107. count: 1
  108. - isNull:
  109. path: metadata.labels["app.kubernetes.io/metrics"]
  110. - it: should render service with metrics label when APIVersions are present and serviceMonitor is enabled
  111. set:
  112. serviceMonitor.enabled: true
  113. capabilities:
  114. apiVersions:
  115. - "monitoring.coreos.com/v1"
  116. templates:
  117. - cert-controller-service.yaml
  118. asserts:
  119. - hasDocuments:
  120. count: 1
  121. - equal:
  122. path: metadata.labels["app.kubernetes.io/metrics"]
  123. value: "cert-controller"
  124. - it: should not render service when APIVersions is not present but serviceMonitor is enabled
  125. set:
  126. serviceMonitor.enabled: true
  127. templates:
  128. - cert-controller-service.yaml
  129. asserts:
  130. - hasDocuments:
  131. count: 0
  132. - it: should not render service when APIVersions is present and serviceMonitor is disabled
  133. set:
  134. serviceMonitor.enabled: false
  135. capabilities:
  136. apiVersions:
  137. - "monitoring.coreos.com/v1"
  138. templates:
  139. - cert-controller-service.yaml
  140. asserts:
  141. - hasDocuments:
  142. count: 0
  143. - it: should not render service when APIVersions is not present and serviceMonitor is disabled
  144. set:
  145. serviceMonitor.enabled: false
  146. templates:
  147. - cert-controller-service.yaml
  148. asserts:
  149. - hasDocuments:
  150. count: 0