deployment.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Grafana pod
  16. kubernetes.core.k8s:
  17. state: present
  18. definition:
  19. apiVersion: apps/v1
  20. kind: Deployment
  21. metadata:
  22. name: "{{ grafana_k8s }}"
  23. namespace: "{{ grafana_namespace }}"
  24. labels:
  25. app: "{{ grafana_k8s }}"
  26. spec:
  27. selector:
  28. matchLabels:
  29. app: "{{ grafana_k8s }}"
  30. replicas: 1
  31. strategy:
  32. type: RollingUpdate
  33. template:
  34. metadata:
  35. labels:
  36. app: "{{ grafana_k8s }}"
  37. spec:
  38. containers:
  39. - name: grafana
  40. image: "{{ grafana_image }}"
  41. imagePullPolicy: "IfNotPresent"
  42. env:
  43. - name: GF_SERVER_HTTP_PORT
  44. value: "{{ grafana_port }}"
  45. - name: GF_PLUGINS_PLUGIN_ADMIN_ENABLED
  46. value: "true"
  47. - name: GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS
  48. value: "{{ grafana_plugins_names }}"
  49. - name: GF_SECURITY_ADMIN_USER
  50. valueFrom:
  51. secretKeyRef:
  52. name: "{{ grafana_secrets }}"
  53. key: grafana_username
  54. - name: GF_SECURITY_ADMIN_PASSWORD
  55. valueFrom:
  56. secretKeyRef:
  57. name: "{{ grafana_secrets }}"
  58. key: grafana_password
  59. ports:
  60. - containerPort: "{{ grafana_http_port }}"
  61. volumeMounts:
  62. - mountPath: /var/lib/grafana/
  63. name: grafana-data
  64. volumes:
  65. - name: grafana-data
  66. persistentVolumeClaim:
  67. claimName: grafana-volume-claim
  68. - name: Service for grafana
  69. kubernetes.core.k8s:
  70. state: present
  71. definition:
  72. apiVersion: v1
  73. kind: Service
  74. metadata:
  75. name: "{{ grafana_k8s }}"
  76. namespace: "{{ grafana_namespace }}"
  77. labels:
  78. app: "{{ grafana_k8s }}"
  79. spec:
  80. type: ClusterIP
  81. ports:
  82. - name: http
  83. port: "{{ grafana_http_port }}"
  84. selector:
  85. app: "{{ grafana_k8s }}"