provisioning-configmap.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {{- /*
  2. Copyright VMware, Inc.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if .Values.provisioning.enabled }}
  6. {{- $fullname := printf "%s-provisioning" (include "common.names.fullname" .) }}
  7. apiVersion: v1
  8. kind: ConfigMap
  9. metadata:
  10. name: {{ $fullname }}
  11. namespace: {{ include "common.names.namespace" . | quote }}
  12. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  13. app.kubernetes.io/component: minio-provisioning
  14. {{- if .Values.commonAnnotations }}
  15. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  16. {{- end }}
  17. data:
  18. {{- range $bucket := .Values.provisioning.buckets }}
  19. {{- if $bucket.lifecycle }}
  20. bucket-{{ $bucket.name }}.json: |
  21. {
  22. "Rules": [
  23. {{- range $idx, $lifecycle := $bucket.lifecycle }}
  24. {{- if not (eq $idx 0) }}
  25. ,
  26. {{- end }}
  27. {
  28. "ID": "{{ $lifecycle.id }}",
  29. "Status": "{{ ternary "Disabled" "Enabled" (and (not (empty $lifecycle.disabled)) $lifecycle.disabled) }}",
  30. {{- if $lifecycle.expiry }}
  31. "Expiration": {
  32. {{- with $lifecycle.expiry.date }}
  33. "Date": "{{ . }}"
  34. {{- end }}
  35. {{- with $lifecycle.expiry.days }}
  36. "Days": {{ . }}
  37. {{- end }}
  38. }
  39. {{- with $lifecycle.expiry.nonconcurrentDays }}
  40. ,
  41. "NoncurrentVersionExpiration": {
  42. "NoncurrentDays": {{ . }}
  43. }
  44. {{- end }}
  45. {{- with $lifecycle.prefix }}
  46. ,
  47. "Filter": {
  48. "Prefix": "{{ . }}"
  49. }
  50. {{- end }}
  51. }
  52. {{- end }}
  53. {{- end }}
  54. ]
  55. }
  56. {{- end }}
  57. {{- end }}
  58. {{- range $policy := .Values.provisioning.policies }}
  59. policy-{{ $policy.name }}.json: |
  60. {{- $statementsLength := sub (len $policy.statements) 1 }}
  61. {
  62. "Version": "2012-10-17",
  63. "Statement": [
  64. {{- range $i, $statement := $policy.statements }}
  65. {
  66. "Effect": "{{ default "Deny" $statement.effect }}"{{ if $statement.actions }},
  67. "Action": {{ toJson $statement.actions }}{{end}}{{ if $statement.resources }},
  68. "Resource": {{ toJson $statement.resources }}{{end}}
  69. }{{ if lt $i $statementsLength }},{{end }}
  70. {{- end }}
  71. ]
  72. }
  73. {{- end }}
  74. {{- end }}