idrac_telemetry_deployment.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. - name: Get timescaleDB svc IP
  15. command: kubectl get svc "{{ timescaledb_k8s_name }}" -n "{{ namespace }}" -o=jsonpath='{.spec.clusterIP}'
  16. changed_when: false
  17. register: timescale_svc_ip
  18. - name: Get mysqlDB svc IP
  19. command: kubectl get svc "{{ mysqldb_k8s_name }}" -n "{{ namespace }}" -o=jsonpath='{.spec.clusterIP}'
  20. changed_when: false
  21. register: mysql_svc_ip
  22. - name: Deploy idrac-telemetry pod
  23. kubernetes.core.k8s:
  24. state: present
  25. definition:
  26. apiVersion: apps/v1
  27. kind: Deployment
  28. metadata:
  29. name: "{{ idrac_telemetry_k8s_name }}"
  30. namespace: "{{ namespace }}"
  31. labels:
  32. app: "{{ idrac_telemetry_k8s_name }}"
  33. spec:
  34. selector:
  35. matchLabels:
  36. app: "{{ idrac_telemetry_k8s_name }}"
  37. replicas: 1
  38. strategy:
  39. type: RollingUpdate
  40. template:
  41. metadata:
  42. labels:
  43. app: "{{ idrac_telemetry_k8s_name }}"
  44. spec:
  45. volumes:
  46. - name: telemetry-reference-tools
  47. hostPath:
  48. path: "{{ mount_location + idrac_telemetry_folder_name }}"
  49. type: Directory
  50. hostAliases:
  51. - ip: "127.0.0.1"
  52. hostnames:
  53. - "activemq"
  54. - ip: "{{ timescale_svc_ip.stdout }}"
  55. hostnames:
  56. - "timescale"
  57. - ip: "{{ mysql_svc_ip.stdout }}"
  58. hostnames:
  59. - "mysqldb"
  60. containers:
  61. - name: activemq
  62. image: rmohr/activemq:5.10.0
  63. imagePullPolicy: "Always"
  64. ports:
  65. - containerPort: "{{ activemq_http_port_1 }}"
  66. - containerPort: "{{ activemq_http_port_2 }}"
  67. - name: telemetry-receiver
  68. image: golang:1.17
  69. imagePullPolicy: "IfNotPresent"
  70. volumeMounts:
  71. - mountPath: /go/src/github.com/telemetry-reference-tools
  72. name: telemetry-reference-tools
  73. workingDir: /go/src/github.com/telemetry-reference-tools
  74. env:
  75. - name: MESSAGEBUS_HOST
  76. value: activemq
  77. - name: MESSAGEBUS_PORT
  78. value: "{{ messagebus_http_port }}"
  79. - name: CONFIGUI_HTTP_PORT
  80. value: "{{ configui_http_port }}"
  81. - name: MYSQL_DATABASE
  82. value: "{{ mysqldb_name }}"
  83. - name: MYSQL_USER
  84. valueFrom:
  85. secretKeyRef:
  86. name: "{{ secrets_name }}"
  87. key: sqldb_user
  88. - name: MYSQL_PASSWORD
  89. valueFrom:
  90. secretKeyRef:
  91. name: "{{ secrets_name }}"
  92. key: sqldb_password
  93. - name: MYSQL_HOST
  94. value: mysqldb
  95. - name: MYSQL_HOST_PORT
  96. value: "{{ mysqldb_port1 }}"
  97. command:
  98. - "/bin/sh"
  99. - "-c"
  100. args: ["./cmd/idrac-telemetry-receiver.sh"]
  101. - name: timescale-ingester
  102. image: golang:1.17
  103. imagePullPolicy: "IfNotPresent"
  104. volumeMounts:
  105. - mountPath: /go/src/github.com/telemetry-reference-tools
  106. name: telemetry-reference-tools
  107. workingDir: /go/src/github.com/telemetry-reference-tools
  108. env:
  109. - name: MESSAGEBUS_HOST
  110. value: activemq
  111. - name: MESSAGEBUS_PORT
  112. value: "{{ messagebus_http_port }}"
  113. - name: POSTGRES_USER
  114. valueFrom:
  115. secretKeyRef:
  116. name: "{{ secrets_name }}"
  117. key: timescaledb_user
  118. - name: POSTGRES_DEFAULT_PWD
  119. valueFrom:
  120. secretKeyRef:
  121. name: "{{ secrets_name }}"
  122. key: timescaledb_password
  123. - name: TIMESCALE_SERVER
  124. value: timescale
  125. - name: TIMESCALE_DB
  126. value: "{{ timescaledb_name }}"
  127. command:
  128. - "/bin/sh"
  129. - "-c"
  130. args: ["go run cmd/timescalepump/timescalepump.go"]