diff --git a/README.md b/README.md index 3520f027219..6bfd9d41d4b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ > An open-source, real-time monitoring system with custom monitoring, high performance cluster and agentless capabilities. | 易用友好的开源实时监控告警系统,无需Agent,高性能集群,强大自定义监控能力. +[![Docker Pulls](https://img.shields.io/docker/pulls/tancloud/hertzbeat?style=%20for-the-badge&logo=docker&label=DockerHub%20Download)](https://hub.docker.com/repository/docker/tancloud/hertzbeat/general) +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/hertzbeat)](https://artifacthub.io/packages/search?repo=hertzbeat) [![discord](https://img.shields.io/badge/chat-on%20discord-brightgreen)](https://discord.gg/Fb6M73htGr) [![Gitter](https://badges.gitter.im/hertzbeat/community.svg)](https://gitter.im/hertzbeat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![QQ](https://img.shields.io/badge/qq-236915833-orange)](https://jq.qq.com/?_wv=1027&k=aVIVB2K9) @@ -164,10 +166,16 @@ Detailed steps refer to [CONTRIBUTING](CONTRIBUTING.md) ##### 4:Install All(hertzbeat+mysql+iotdb/tdengine) via Docker-compose -Install and deploy the mysql database, iotdb/tdengine database and hertzbeat at one time through [docker-compose deployment script](script/docker-compose). +Install the mysql database, iotdb/tdengine database and hertzbeat at one time through [docker-compose deployment script](script/docker-compose). Detailed steps refer to [Install via Docker-Compose](script/docker-compose/README.md) +##### 5. Install All(hertzbeat+collector+mysql+iotdb) via kubernetes helm charts + +Install HertzBeat cluster in a Kubernetes cluster by Helm chart. + +Detailed steps refer to [Artifact Hub](https://artifacthub.io/packages/helm/hertzbeat/hertzbeat) + **HAVE FUN** ## 🥐 Roadmap diff --git a/README_CN.md b/README_CN.md index 2cf988cf1b5..b6a8998868b 100644 --- a/README_CN.md +++ b/README_CN.md @@ -10,6 +10,8 @@ > 易用友好的开源实时监控告警系统,无需Agent,高性能集群,强大自定义监控能力。 +[![Docker Pulls](https://img.shields.io/docker/pulls/tancloud/hertzbeat?style=%20for-the-badge&logo=docker&label=DockerHub%20Download)](https://hub.docker.com/repository/docker/tancloud/hertzbeat/general) +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/hertzbeat)](https://artifacthub.io/packages/search?repo=hertzbeat) [![discord](https://img.shields.io/badge/chat-on%20discord-brightgreen)](https://discord.gg/Fb6M73htGr) [![Gitter](https://badges.gitter.im/hertzbeat/community.svg)](https://gitter.im/hertzbeat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![QQ](https://img.shields.io/badge/qq-236915833-orange)](https://jq.qq.com/?_wv=1027&k=aVIVB2K9) @@ -165,6 +167,12 @@ docker run -d -e IDENTITY=custom-collector-name -e MANAGER_IP=127.0.0.1 -e MANAG 详细步骤参考 [通过Docker-Compose安装HertzBeat](script/docker-compose/README.md) +##### 方式五:Kubernetes Helm Charts 部署 hertzbeat+collector+mysql+iotdb + +通过 Helm Chart 一次性将 HertzBeat 集群组件部署到 Kubernetes 集群中。 + +详细步骤参考 [Artifact Hub](https://artifacthub.io/packages/helm/hertzbeat/hertzbeat) + **HAVE FUN** ## 🥐 路线图 diff --git a/home/docs/others/developer.md b/home/docs/others/developer.md index 343691d8b9e..dee34905147 100644 --- a/home/docs/others/developer.md +++ b/home/docs/others/developer.md @@ -17,6 +17,9 @@ sidebar_label: Contributors cuipiheqiuqiu
cuipiheqiuqiu

💻 ⚠️ 🎨 hudongdong129
hudongdong129

💻 ⚠️ 📖 + + zqr10159
Logic

📖 💻🎨 + diff --git a/home/docs/start/quickstart.md b/home/docs/start/quickstart.md index 03339eeb4b5..29648d30a46 100644 --- a/home/docs/start/quickstart.md +++ b/home/docs/start/quickstart.md @@ -77,4 +77,10 @@ Install and deploy the mysql database, iotdb/tdengine database and hertzbeat at Detailed steps refer to [Install via Docker-Compose](https://github.com/dromara/hertzbeat/tree/master/script/docker-compose) +##### 5. Install All(hertzbeat+collector+mysql+iotdb) via kubernetes helm charts + +Install HertzBeat cluster in a Kubernetes cluster by Helm chart. + +Detailed steps refer to [Artifact Hub](https://artifacthub.io/packages/helm/hertzbeat/hertzbeat) + **HAVE FUN** diff --git a/home/i18n/en/docusaurus-plugin-content-docs/current.json b/home/i18n/en/docusaurus-plugin-content-docs/current.json index 5f434b815fc..84a183d9cd6 100644 --- a/home/i18n/en/docusaurus-plugin-content-docs/current.json +++ b/home/i18n/en/docusaurus-plugin-content-docs/current.json @@ -74,5 +74,9 @@ "sidebar.docs.category.snmp": { "message": "SNMP Protocol", "description": "The label for category snmp in sidebar docs" + }, + "sidebar.docs.link.Install via Helm": { + "message": "Install via Helm", + "description": "The label for link Install via Helm in sidebar docs, linking to https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824" } } diff --git a/home/i18n/en/docusaurus-plugin-content-docs/version-v1.3.x.json b/home/i18n/en/docusaurus-plugin-content-docs/version-v1.3.x.json new file mode 100644 index 00000000000..e66ec375b03 --- /dev/null +++ b/home/i18n/en/docusaurus-plugin-content-docs/version-v1.3.x.json @@ -0,0 +1,78 @@ +{ + "version.label": { + "message": "v1.3.x", + "description": "The label for version v1.3.x" + }, + "sidebar.docs.category.quickstart": { + "message": "quickstart", + "description": "The label for category quickstart in sidebar docs" + }, + "sidebar.docs.category.custom": { + "message": "custom", + "description": "The label for category custom in sidebar docs" + }, + "sidebar.docs.category.http": { + "message": "http", + "description": "The label for category http in sidebar docs" + }, + "sidebar.docs.category.jdbc": { + "message": "jdbc", + "description": "The label for category jdbc in sidebar docs" + }, + "sidebar.docs.category.ssh": { + "message": "ssh", + "description": "The label for category ssh in sidebar docs" + }, + "sidebar.docs.category.jmx": { + "message": "jmx", + "description": "The label for category jmx in sidebar docs" + }, + "sidebar.docs.category.snmp": { + "message": "snmp", + "description": "The label for category snmp in sidebar docs" + }, + "sidebar.docs.category.help": { + "message": "help", + "description": "The label for category help in sidebar docs" + }, + "sidebar.docs.category.service": { + "message": "service", + "description": "The label for category service in sidebar docs" + }, + "sidebar.docs.category.database": { + "message": "database", + "description": "The label for category database in sidebar docs" + }, + "sidebar.docs.category.os": { + "message": "os", + "description": "The label for category os in sidebar docs" + }, + "sidebar.docs.category.mid": { + "message": "mid", + "description": "The label for category mid in sidebar docs" + }, + "sidebar.docs.category.cloud-native": { + "message": "cloud-native", + "description": "The label for category cloud-native in sidebar docs" + }, + "sidebar.docs.category.threshold": { + "message": "threshold", + "description": "The label for category threshold in sidebar docs" + }, + "sidebar.docs.category.notice": { + "message": "notice", + "description": "The label for category notice in sidebar docs" + }, + "sidebar.docs.category.Others": { + "message": "Others", + "description": "The label for category Others in sidebar docs" + }, + "sidebar.docs.link.Cloud Service": { + "message": "Cloud Service", + "description": "The label for link Cloud Service in sidebar docs, linking to https://console.tancloud.cn" + }, + "sidebar.docs.link.Install via HuaweiCloud": { + "message": "Install via HuaweiCloud", + "description": "The label for link Install via HuaweiCloud in sidebar docs, linking to https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824" + } +} diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current.json b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current.json index f1a5f84b1c5..f368b99dd43 100644 --- a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current.json +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current.json @@ -74,5 +74,9 @@ "sidebar.docs.category.snmp": { "message": "SNMP协议", "description": "The label for category snmp in sidebar docs" + }, + "sidebar.docs.link.Install via Helm": { + "message": "Kubernetes Helm部署", + "description": "The label for link Install via Helm in sidebar docs, linking to https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824" } } diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/others/developer.md b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/others/developer.md index 78998cf3fc6..f68e3affddb 100644 --- a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/others/developer.md +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/others/developer.md @@ -17,6 +17,9 @@ sidebar_label: 开发者们 cuipiheqiuqiu
cuipiheqiuqiu

💻 ⚠️ 🎨 hudongdong129
hudongdong129

💻 ⚠️ 📖 + + zqr10159
Logic

📖 💻🎨 + diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/quickstart.md b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/quickstart.md index 7951689f892..406f2b913cf 100644 --- a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/quickstart.md +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/start/quickstart.md @@ -115,4 +115,10 @@ docker run -d -e IDENTITY=custom-collector-name -e MANAGER_IP=127.0.0.1 -e MANAG 详细步骤参考 [docker-compose部署方案](https://github.com/dromara/hertzbeat/tree/master/script/docker-compose/README.md) +##### 方式五:Kubernetes Helm Charts 部署 hertzbeat+collector+mysql+iotdb + +通过 Helm Chart 一次性将 HertzBeat 集群组件部署到 Kubernetes 集群中。 + +详细步骤参考 [Artifact Hub](https://artifacthub.io/packages/helm/hertzbeat/hertzbeat) + **HAVE FUN** diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-v1.3.x.json b/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-v1.3.x.json new file mode 100644 index 00000000000..e66ec375b03 --- /dev/null +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-v1.3.x.json @@ -0,0 +1,78 @@ +{ + "version.label": { + "message": "v1.3.x", + "description": "The label for version v1.3.x" + }, + "sidebar.docs.category.quickstart": { + "message": "quickstart", + "description": "The label for category quickstart in sidebar docs" + }, + "sidebar.docs.category.custom": { + "message": "custom", + "description": "The label for category custom in sidebar docs" + }, + "sidebar.docs.category.http": { + "message": "http", + "description": "The label for category http in sidebar docs" + }, + "sidebar.docs.category.jdbc": { + "message": "jdbc", + "description": "The label for category jdbc in sidebar docs" + }, + "sidebar.docs.category.ssh": { + "message": "ssh", + "description": "The label for category ssh in sidebar docs" + }, + "sidebar.docs.category.jmx": { + "message": "jmx", + "description": "The label for category jmx in sidebar docs" + }, + "sidebar.docs.category.snmp": { + "message": "snmp", + "description": "The label for category snmp in sidebar docs" + }, + "sidebar.docs.category.help": { + "message": "help", + "description": "The label for category help in sidebar docs" + }, + "sidebar.docs.category.service": { + "message": "service", + "description": "The label for category service in sidebar docs" + }, + "sidebar.docs.category.database": { + "message": "database", + "description": "The label for category database in sidebar docs" + }, + "sidebar.docs.category.os": { + "message": "os", + "description": "The label for category os in sidebar docs" + }, + "sidebar.docs.category.mid": { + "message": "mid", + "description": "The label for category mid in sidebar docs" + }, + "sidebar.docs.category.cloud-native": { + "message": "cloud-native", + "description": "The label for category cloud-native in sidebar docs" + }, + "sidebar.docs.category.threshold": { + "message": "threshold", + "description": "The label for category threshold in sidebar docs" + }, + "sidebar.docs.category.notice": { + "message": "notice", + "description": "The label for category notice in sidebar docs" + }, + "sidebar.docs.category.Others": { + "message": "Others", + "description": "The label for category Others in sidebar docs" + }, + "sidebar.docs.link.Cloud Service": { + "message": "Cloud Service", + "description": "The label for link Cloud Service in sidebar docs, linking to https://console.tancloud.cn" + }, + "sidebar.docs.link.Install via HuaweiCloud": { + "message": "Install via HuaweiCloud", + "description": "The label for link Install via HuaweiCloud in sidebar docs, linking to https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824" + } +} diff --git a/home/sidebars.json b/home/sidebars.json index 4c7bee22afc..3af0bb4056a 100644 --- a/home/sidebars.json +++ b/home/sidebars.json @@ -19,6 +19,11 @@ "href": "https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824" }, "start/rainbond-deploy", + { + "type": "link", + "label": "Install via Helm", + "href": "https://artifacthub.io/packages/helm/hertzbeat/hertzbeat" + }, "start/iotdb-init", "start/tdengine-init", "start/greptime-init", diff --git a/script/helm/hertzbeat/.helmignore b/script/helm/hertzbeat/.helmignore new file mode 100644 index 00000000000..0e8a0eb36f4 --- /dev/null +++ b/script/helm/hertzbeat/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/script/helm/hertzbeat/Chart.yaml b/script/helm/hertzbeat/Chart.yaml new file mode 100644 index 00000000000..32658db0d82 --- /dev/null +++ b/script/helm/hertzbeat/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: hertzbeat +description: An open-source, real-time monitoring system with custom monitoring, high performance cluster and agentless capabilities. +type: application +home: https://hertzbeat.com/ +sources: + - https://github.com/dromara/hertzbeat + - https://charts.hertzbeat.com +maintainers: + - name: tom + email: tomsun28@outlook.com +icon: https://raw.githubusercontent.com/dromara/hertzbeat/master/home/static/img/hertzbeat-logo.png +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 1.4.0 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "v1.4.0" diff --git a/script/helm/hertzbeat/README.md b/script/helm/hertzbeat/README.md new file mode 100644 index 00000000000..2b871eea1cf --- /dev/null +++ b/script/helm/hertzbeat/README.md @@ -0,0 +1,160 @@ +# Helm Chart for HertzBeat + +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/hertzbeat)](https://artifacthub.io/packages/search?repo=hertzbeat) + +

hertzbeat: An open-source, real-time monitoring system with custom monitoring, high performance cluster and agentless capabilities.

— Open in Artifact Hub
+ + +## What is HertzBeat? + +> An open-source, real-time monitoring system with custom monitoring, high performance cluster and agentless capabilities. | 易用友好的开源实时监控告警系统,无需Agent,高性能集群,强大自定义监控能力. + +### Features + +* Combines **monitoring, alarm, and notification** features into one platform, and supports monitoring for web service, database, os, middleware, cloud-native, network and more. +* Easy to use and agentless, offering full web-based operations for monitoring and alerting with just a click of a mouse, all at zero learning cost. +* Makes protocols such as `Http, Jmx, Ssh, Snmp, Jdbc` configurable, allowing you to collect any metrics by simply configuring the template `YML` file online. Imagine being able to quickly adapt to a new monitoring type like K8s or Docker simply by configuring online with HertzBeat. +* High performance, supports horizontal expansion of multi-collector clusters, multi-isolated network monitoring and cloud-edge collaboration. +* Provides flexible alarm threshold rules and timely notifications delivered via `Discord` `Slack` `Telegram` `Email` `Dingtalk` `WeChat` `FeiShu` `Webhook` `SMS` `ServerChan`. + + +> HertzBeat's powerful customization, multi-type support, high performance, easy expansion, and low coupling, aims to help developers and teams quickly build their own monitoring system. +> We also provide **[SaaS Monitoring Cloud](https://console.tancloud.cn)**, users no longer need to deploy a cumbersome monitoring system to monitor their resources. **[Get started online for free](https://console.tancloud.cn)**. + +## Helm Chart for HertzBeat + +This [Helm](https://github.com/kubernetes/helm) chart installs [HertzBeat](https://github.com/dromara/hertzbeat) in a Kubernetes cluster. Welcome to [contribute](https://github.com/dromara/hertzbeat/tree/master/script/helm) to Helm Chart for HertzBeat. + +## Prerequisites + +- Kubernetes cluster 1.20+ +- Helm v3.2.0+ + +## Installation + +### Add Helm repository + +```bash +helm repo add hertzbeat https://charts.hertzbeat.com/ +helm repo update +``` + +### Configure the chart + +The following items can be set via `--set` flag during installation or configured by editing the `values.yaml` directly (need to download the chart first). + +#### Configure how to expose HertzBeat service + +- **Ingress**: The ingress controller must be installed in the Kubernetes cluster. +- **ClusterIP**: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster. +- **NodePort**: Exposes the service on each Node’s IP at a static port (the NodePort). You’ll be able to contact the NodePort service, from outside the cluster, by requesting `NodeIP:NodePort`. +- **LoadBalancer**: Exposes the service externally using a cloud provider’s load balancer. + +#### Configure the external URL + +The external URL for HertzBeat core service is used to: + +1. populate the docker/helm commands showed on portal +2. populate the token service URL returned to docker client + +Format: `protocol://domain[:port]`. Usually: + +- if service exposed via `Ingress`, the `domain` should be the value of `expose.ingress.hosts.core` +- if service exposed via `ClusterIP`, the `domain` should be the value of `expose.clusterIP.name` +- if service exposed via `NodePort`, the `domain` should be the IP address of one Kubernetes node +- if service exposed via `LoadBalancer`, set the `domain` as your own domain name and add a CNAME record to map the domain name to the one you got from the cloud provider + +If HertzBeat is deployed behind the proxy, set it as the URL of proxy. + +#### Configure how to persist data + +- **Disable**: The data does not survive the termination of a pod. +- **Persistent Volume Claim(default)**: A default `StorageClass` is needed in the Kubernetes cluster to dynamically provision the volumes. Specify another StorageClass in the `storageClass` or set `existingClaim` if you already have existing persistent volumes to use. + +#### Configure the other items listed in [configuration](#configuration) section + +### Install the chart + +Install the HertzBeat helm chart with a release name `my-release`: +```bash +helm install hertzbeat hertzbeat/hertzbeat +``` + +## Uninstallation + +To uninstall/delete the `hertzbeat` deployment: +```bash +helm uninstall hertzbeat +``` + +## Configuration + +The following table lists the configurable parameters of the HertzBeat chart and the default values. + +| Parameter | Description | Default | +|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------| +| **Expose** | | | +| `expose.type` | How to expose the service: `ingress`, `clusterIP`, `nodePort` or `loadBalancer`, other values will be ignored and the creation of service will be skipped. | `ingress` | +| `expose.clusterIP.name` | The name of ClusterIP service | `hertzbeat` | +| `expose.clusterIP.annotations` | The annotations attached to the ClusterIP service | {} | +| `expose.clusterIP.ports.port` | The service port HertzBeat listens on when serving HTTP | `80` | +| `expose.nodePort.name` | The name of NodePort service | `hertzbeat` | +| `expose.nodePort.ports.port` | The service port HertzBeat listens on when serving HTTP | `80` | +| `expose.nodePort.ports.nodePort` | The node port HertzBeat listens on when serving HTTP | `30002` | +| `expose.loadBalancer.IP` | The IP of the loadBalancer. It only works when loadBalancer supports assigning IP | `""` | +| `expose.loadBalancer.ports.port` | The service port HertzBeat listens on when serving HTTP | `80` | +| `expose.loadBalancer.sourceRanges` | List of IP address ranges to assign to loadBalancerSourceRanges | [] | +| **Manager** | | | +| `manager.account.username` | The hertzbeat account username | `admin` | +| `manager.account.password` | The hertzbeat account password | `hertzbeat` | +| `manager.resources` | The [resources] to allocate for container | undefined | +| `manager.nodeSelector` | Node labels for pod assignment | `{}` | +| `manager.tolerations` | Tolerations for pod assignment | `[]` | +| `manager.affinity` | Node/Pod affinities | `{}` | +| `manager.podAnnotations` | Annotations to add to the nginx pod | `{}` | +| **Collector** | | | +| `collector.replicaCount` | The replica count | `1` | +| `collector.autoscaling.enable` | Is enable auto scaling collector replicas | `1` | +| `collector.resources` | The [resources] to allocate for container | undefined | +| `collector.nodeSelector` | Node labels for pod assignment | `{}` | +| `collector.tolerations` | Tolerations for pod assignment | `[]` | +| `collector.affinity` | Node/Pod affinities | `{}` | +| `collector.podAnnotations` | Annotations to add to the nginx pod | `{}` | +| **Database** | | | +| `database.timezone` | The database system timezone | `1` | +| `database.rootPassword` | The database root user password | `1` | +| `database.persistence.enabled` | Enable the data persistence or not | `true` | +| `database.persistence.resourcePolicy` | Setting it to `keep` to avoid removing PVCs during a helm delete operation. Leaving it empty will delete PVCs after the chart deleted. Does not affect PVCs created for internal database and redis components. | `keep` | +| `database.persistence.existingClaim` | Use the existing PVC which must be created manually before bound, and specify the `subPath` if the PVC is shared with other components | | +| `database.persistence.storageClass` | Specify the `storageClass` used to provision the volume. Or the default StorageClass will be used (the default). Set it to `-` to disable dynamic provisioning | | +| `database.persistence.subPath` | The sub path used in the volume | | +| `database.persistence.accessMode` | The access mode of the volume | `ReadWriteOnce` | +| `database.persistence.size` | The size of the volume | `5Gi` | +| `database.persistence.annotations` | The annotations of the volume | | +| `database.resources` | The [resources] to allocate for container | undefined | +| `database.nodeSelector` | Node labels for pod assignment | `{}` | +| `database.tolerations` | Tolerations for pod assignment | `[]` | +| `database.affinity` | Node/Pod affinities | `{}` | +| `database.podAnnotations` | Annotations to add to the nginx pod | `{}` | +| **TSDB** | | | +| `tsdb.timezone` | The database system timezone | `1` | +| `tsdb.persistence.enabled` | Enable the data persistence or not | `true` | +| `tsdb.persistence.resourcePolicy` | Setting it to `keep` to avoid removing PVCs during a helm delete operation. Leaving it empty will delete PVCs after the chart deleted. Does not affect PVCs created for internal database and redis components. | `keep` | +| `tsdb.persistence.existingClaim` | Use the existing PVC which must be created manually before bound, and specify the `subPath` if the PVC is shared with other components | | +| `tsdb.persistence.storageClass` | Specify the `storageClass` used to provision the volume. Or the default StorageClass will be used (the default). Set it to `-` to disable dynamic provisioning | | +| `tsdb.persistence.subPath` | The sub path used in the volume | | +| `tsdb.persistence.accessMode` | The access mode of the volume | `ReadWriteOnce` | +| `tsdb.persistence.size` | The size of the volume | `5Gi` | +| `tsdb.persistence.annotations` | The annotations of the volume | | +| `tsdb.resources` | The [resources] to allocate for container | undefined | +| `tsdb.nodeSelector` | Node labels for pod assignment | `{}` | +| `tsdb.tolerations` | Tolerations for pod assignment | `[]` | +| `tsdb.affinity` | Node/Pod affinities | `{}` | +| `tsdb.podAnnotations` | Annotations to add to the nginx pod | `{}` | + + +[resources]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ +[hertzbeat]: https://github.com/dromara/hertzbeat/ +[artifacthub]: https://artifacthub.io/ +[helm]: https://helm.sh/ + diff --git a/script/helm/hertzbeat/templates/NOTES.txt b/script/helm/hertzbeat/templates/NOTES.txt new file mode 100644 index 00000000000..da6b52a0556 --- /dev/null +++ b/script/helm/hertzbeat/templates/NOTES.txt @@ -0,0 +1,26 @@ +1. Get the application URL by running these commands: +{{- if (eq .Values.expose.type "ingress")}} +{{- range $host := .Values.expose.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.expose.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} + +{{- else if contains "NodePort" .Values.expose.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "hertzbeat.fullname" . }}-http) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT + +{{- else if contains "LoadBalancer" .Values.expose.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "hertzbeat.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "hertzbeat.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.expose.loadBalancer.ports.port }} + +{{- else if contains "ClusterIP" .Values.expose.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "hertzbeat.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT + +{{- end }} diff --git a/script/helm/hertzbeat/templates/_helpers.tpl b/script/helm/hertzbeat/templates/_helpers.tpl new file mode 100644 index 00000000000..4b64c3a038e --- /dev/null +++ b/script/helm/hertzbeat/templates/_helpers.tpl @@ -0,0 +1,67 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "hertzbeat.name" -}} +{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "hertzbeat.fullname" -}} +{{- $name := default .Chart.Name }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + +{{- define "hertzbeat.manager" -}} +{{- printf "%s" (include "hertzbeat.fullname" .) -}} +{{- end -}} + +{{- define "hertzbeat.manager.host" -}} +{{- printf "%s-cluster" (include "hertzbeat.manager" .) -}} +{{- end -}} + +{{- define "hertzbeat.collector" -}} +{{- printf "%s-collector" (include "hertzbeat.fullname" .) -}} +{{- end -}} + +{{- define "hertzbeat.database" -}} +{{- printf "%s-database" (include "hertzbeat.fullname" .) -}} +{{- end -}} + +{{- define "hertzbeat.tsdb" -}} +{{- printf "%s-tsdb" (include "hertzbeat.fullname" .) -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "hertzbeat.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "hertzbeat.labels" -}} +helm.sh/chart: {{ include "hertzbeat.chart" . }} +{{ include "hertzbeat.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "hertzbeat.selectorLabels" -}} +app.kubernetes.io/name: {{ include "hertzbeat.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/script/helm/hertzbeat/templates/collector/configmap.yaml b/script/helm/hertzbeat/templates/collector/configmap.yaml new file mode 100644 index 00000000000..5ef8e73a0ed --- /dev/null +++ b/script/helm/hertzbeat/templates/collector/configmap.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ include "hertzbeat.collector" . }}" + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +data: + IDENTITY: "" + MANAGER_IP: "{{ include "hertzbeat.manager.host" . }}" + MANAGER_PORT: "1158" + application.yml: |+ + server: + port: 1159 + spring: + application: + name: ${HOSTNAME:@hertzbeat-collector@}${PID} + profiles: + active: cluster + jackson: + default-property-inclusion: ALWAYS + # need to disable spring boot mongodb auto config, or default mongodb connection tried and failed... + autoconfigure: + exclude: org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration, org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration + + --- + spring: + config: + activate: + on-profile: cluster + + collector: + dispatch: + entrance: + netty: + enabled: true + identity: ${IDENTITY:} + manager-ip: ${MANAGER_IP:127.0.0.1} + manager-port: ${MANAGER_PORT:1158} + + common: + queue: + # memory or kafka + type: ${QUEUE_TYPE:netty} + # properties when queue type is kafka + kafka: + servers: ${KAFKA_SERVERS:127.0.0.1:9092} + metrics-data-topic: ${KAFKA_TOPIC:async-metrics-data} diff --git a/script/helm/hertzbeat/templates/collector/deployment.yaml b/script/helm/hertzbeat/templates/collector/deployment.yaml new file mode 100644 index 00000000000..5b1de1c56e2 --- /dev/null +++ b/script/helm/hertzbeat/templates/collector/deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "hertzbeat.collector" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} + component: collector +spec: + {{- if not .Values.collector.autoscaling.enabled }} + replicas: {{ .Values.collector.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "hertzbeat.selectorLabels" . | nindent 6 }} + component: collector + template: + metadata: + {{- with .Values.collector.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "hertzbeat.selectorLabels" . | nindent 8 }} + component: collector + spec: + securityContext: + {{- toYaml .Values.collector.podSecurityContext | nindent 8 }} + containers: + - name: hertzbeat-collector + securityContext: + {{- toYaml .Values.collector.securityContext | nindent 12 }} + image: "{{ .Values.collector.image.repository }}:{{ .Values.collector.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.collector.image.pullPolicy }} + ports: + - containerPort: 1159 + protocol: TCP + livenessProbe: + tcpSocket: + port: 1159 + readinessProbe: + tcpSocket: + port: 1159 + envFrom: + - configMapRef: + name: "{{ include "hertzbeat.collector" . }}" + volumeMounts: + - mountPath: /opt/hertzbeat-collector/config/application.yml + subPath: application.yml + name: application + resources: + {{- toYaml .Values.collector.resources | nindent 12 }} + volumes: + - name: application + configMap: + name: {{ include "hertzbeat.collector" . }} + {{- with .Values.collector.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.collector.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.collector.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/script/helm/hertzbeat/templates/collector/hpa.yaml b/script/helm/hertzbeat/templates/collector/hpa.yaml new file mode 100644 index 00000000000..6a4457c6b40 --- /dev/null +++ b/script/helm/hertzbeat/templates/collector/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.collector.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "hertzbeat.collector" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "hertzbeat.collector" . }} + minReplicas: {{ .Values.collector.autoscaling.minReplicas }} + maxReplicas: {{ .Values.collector.autoscaling.maxReplicas }} + metrics: + {{- if .Values.collector.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.collector.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.collector.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.collector.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/script/helm/hertzbeat/templates/database/configmap.yaml b/script/helm/hertzbeat/templates/database/configmap.yaml new file mode 100644 index 00000000000..edbc03a6515 --- /dev/null +++ b/script/helm/hertzbeat/templates/database/configmap.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ include "hertzbeat.database" . }}" + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +data: + TZ: "{{ .Values.database.timezone }}" + MYSQL_ROOT_PASSWORD: "{{ .Values.database.rootPassword }}" + schema.sql: |+ + set names utf8mb4; + create database if not exists hertzbeat default charset utf8mb4 collate utf8mb4_general_ci; + commit; diff --git a/script/helm/hertzbeat/templates/database/pvc.yaml b/script/helm/hertzbeat/templates/database/pvc.yaml new file mode 100644 index 00000000000..279fd2785f4 --- /dev/null +++ b/script/helm/hertzbeat/templates/database/pvc.yaml @@ -0,0 +1,29 @@ +{{- if .Values.database.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "hertzbeat.database" . }} + annotations: + {{- range $key, $value := .Values.database.persistence.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if eq .Values.database.persistence.resourcePolicy "keep" }} + helm.sh/resource-policy: keep + {{- end }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} + component: database +spec: + accessModes: + - {{ .Values.database.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.database.persistence.size }} + {{- if .Values.database.persistence.storageClass }} + {{- if eq "-" .Values.database.persistence.storageClass }} + storageClassName: "" + {{- else }} + storageClassName: {{ .Values.database.persistence.storageClass }} + {{- end }} + {{- end }} +{{- end }} diff --git a/script/helm/hertzbeat/templates/database/service.yaml b/script/helm/hertzbeat/templates/database/service.yaml new file mode 100644 index 00000000000..946049bea60 --- /dev/null +++ b/script/helm/hertzbeat/templates/database/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "hertzbeat.database" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: 3306 + targetPort: 3306 + protocol: TCP + selector: + {{- include "hertzbeat.selectorLabels" . | nindent 4 }} + component: database diff --git a/script/helm/hertzbeat/templates/database/statefulset.yaml b/script/helm/hertzbeat/templates/database/statefulset.yaml new file mode 100644 index 00000000000..ea97e6cc383 --- /dev/null +++ b/script/helm/hertzbeat/templates/database/statefulset.yaml @@ -0,0 +1,99 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "hertzbeat.database" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} + component: database +spec: + replicas: 1 + serviceName: {{ include "hertzbeat.database" . }} + selector: + matchLabels: + {{- include "hertzbeat.selectorLabels" . | nindent 6 }} + component: database + template: + metadata: + {{- with .Values.database.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "hertzbeat.selectorLabels" . | nindent 8 }} + component: database + spec: + securityContext: + {{- toYaml .Values.database.podSecurityContext | nindent 8 }} + containers: + - name: database + image: {{ .Values.database.image.repository }}:{{ .Values.database.image.tag }} + imagePullPolicy: {{ .Values.database.image.pullPolicy }} + livenessProbe: + tcpSocket: + port: 3306 + initialDelaySeconds: 300 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: 3306 + initialDelaySeconds: 1 + periodSeconds: 10 + resources: + {{- toYaml .Values.database.resources | nindent 12 }} + envFrom: + - configMapRef: + name: "{{ include "hertzbeat.database" . }}" + volumeMounts: + - name: data + mountPath: /var/lib/mysql + subPath: "" + - mountPath: /docker-entrypoint-initdb.d/schema.sql + subPath: schema.sql + name: schema + volumes: + - name: schema + configMap: + name: {{ include "hertzbeat.database" . }} + {{- if not .Values.database.persistence.enabled }} + - name: data + emptyDir: {} + {{- else }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.database.persistence.existingClaim | default (include "hertzbeat.database" .) }} + {{- end }} + {{- with .Values.database.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.database.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.database.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{/* {{- if and .Values.database.persistence.enabled (not .Values.database.persistence.existingClaim) }}*/}} +{{/* volumeClaimTemplates:*/}} +{{/* - metadata:*/}} +{{/* name: data*/}} +{{/* labels:*/}} +{{/* {{- include "hertzbeat.labels" . | indent 10 }}*/}} +{{/* annotations:*/}} +{{/* {{- range $key, $value := .Values.database.persistence.annotations }}*/}} +{{/* {{ $key }}: {{ $value | quote }}*/}} +{{/* {{- end }}*/}} +{{/* spec:*/}} +{{/* accessModes: [{{ .Values.database.persistence.accessMode | quote }}]*/}} +{{/* {{- if .Values.database.persistence.storageClass }}*/}} +{{/* {{- if (eq "-" .Values.database.persistence.storageClass) }}*/}} +{{/* storageClassName: ""*/}} +{{/* {{- else }}*/}} +{{/* storageClassName: "{{ .Values.database.persistence.storageClass }}"*/}} +{{/* {{- end }}*/}} +{{/* {{- end }}*/}} +{{/* resources:*/}} +{{/* requests:*/}} +{{/* storage: {{ .Values.database.persistence.size | quote }}*/}} +{{/* {{- end -}}*/}} diff --git a/script/helm/hertzbeat/templates/manager/configmap.yaml b/script/helm/hertzbeat/templates/manager/configmap.yaml new file mode 100644 index 00000000000..6dccb5ef65e --- /dev/null +++ b/script/helm/hertzbeat/templates/manager/configmap.yaml @@ -0,0 +1,243 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ include "hertzbeat.manager" . }}" + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +data: + application.yml: |+ + server: + port: 1157 + spring: + application: + name: ${HOSTNAME:@hertzbeat@}${PID} + profiles: + active: prod + mvc: + static-path-pattern: /** + jackson: + default-property-inclusion: ALWAYS + web: + resources: + static-locations: + - classpath:/dist/ + - classpath:../dist/ + # need to disable spring boot mongodb auto config, or default mongodb connection tried and failed.. + autoconfigure: + exclude: org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration, org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration + thymeleaf: + prefix: classpath:/templates/ + check-template-location: true + cache: true + suffix: .html + mode: HTML + template-resolver-order: 1 + + management: + health: + mail: + enabled: off + endpoints: + web: + exposure: + include: + - 'metrics' + - 'health' + - 'env' + enabled-by-default: on + + sureness: + auths: + - digest + - basic + - jwt + jwt: + secret: {{ .Values.manager.jwtSecretKey }} + + --- + spring: + config: + activate: + on-profile: prod + + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: {{ .Values.database.rootPassword }} + url: jdbc:mysql://{{ include "hertzbeat.database" . }}:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false + hikari: + max-lifetime: 120000 + + jpa: + hibernate: + ddl-auto: update + + mail: + # Attention: this is mail server address. + # 请注意此为邮件服务器地址:qq邮箱为 smtp.qq.com qq 企业邮箱为 smtp.exmail.qq.com + host: smtp.qq.com + username: tancloud@qq.com + # Attention: this is not email account password, this requires an email authorization code + # 请注意此非邮箱账户密码 此需填写邮箱授权码 + password: your-password + #Attention: Tencent mail smtps 465,smtp 587 + #请注意腾讯邮箱465为smtps,587为smtp + port: 587 + properties: + mail: + smtp: + socketFactoryClass: javax.net.ssl.SSLSocketFactory + ssl: + enable: true + + common: + queue: + # memory or kafka + type: memory + # properties when queue type is kafka + kafka: + servers: 127.0.0.1:9092 + metrics-data-topic: async-metrics-data + alerts-data-topic: async-alerts-data + + warehouse: + store: + # store history metrics data, enable only one below + # 存储历史数据方式, 下方只能enabled启用一种方式 + jpa: + enabled: false + # The maximum retention time for history records, after which records will be deleted + expire-time: 1h + # The maximum number of history records retained, if this number is exceeded, half of the data in this configuration item will be deleted + # (please set this configuration reasonably as history records can affect performance when it is large) + # 历史数据的最大保留条数,超过此数量时,将会删除一半于此配量的数据(由于历史数据较大时会影响性能,请合理设置此配置) + max-history-record-num: 6000 + td-engine: + enabled: false + driver-class-name: com.taosdata.jdbc.rs.RestfulDriver + url: jdbc:TAOS-RS://localhost:6041/hertzbeat + username: root + password: taosdata + greptime: + enabled: false + endpoint: localhost:4001 + iot-db: + enabled: true + host: {{ include "hertzbeat.tsdb" . }} + rpc-port: 6667 + username: root + password: root + # org.dromara.hertzbeat.warehouse.config.IotDbVersion: V_0_13 || V_1_0 + version: V_0_13 + query-timeout-in-ms: -1 + # 数据存储时间:默认'7776000000'(90天,单位为毫秒,-1代表永不过期) + # data expire time, unit:ms, default '7776000000'(90 days, -1:never expire) + expire-time: '7776000000' + influxdb: + enabled: false + server-url: http://127.0.0.1:8086 + username: root + password: root + expire-time: '30d' + replication: 1 + + # store real-time metrics data, enable only one below + # 存储实时数据方式, 下方只能enabled启用一种方式 + memory: + enabled: true + init-size: 1024 + redis: + enabled: false + host: 127.0.0.1 + port: 6379 + password: 123456 + db: 0 + + alerter: + # custom console url + console-url: https://console.tancloud.cn + + scheduler: + server: + enabled: true + port: 1158 + + + sureness.yml: |+ + resourceRole: + - /api/account/auth/refresh===post===[admin,user,guest] + - /api/apps/**===get===[admin,user,guest] + - /api/monitor/**===get===[admin,user,guest] + - /api/monitor/**===post===[admin,user] + - /api/monitor/**===put===[admin,user] + - /api/monitor/**===delete==[admin] + - /api/monitors/**===get===[admin,user,guest] + - /api/monitors/**===post===[admin,user] + - /api/monitors/**===put===[admin,user] + - /api/monitors/**===delete===[admin] + - /api/alert/**===get===[admin,user,guest] + - /api/alert/**===post===[admin,user] + - /api/alert/**===put===[admin,user] + - /api/alert/**===delete===[admin] + - /api/alerts/**===get===[admin,user,guest] + - /api/alerts/**===post===[admin,user] + - /api/alerts/**===put===[admin,user] + - /api/alerts/**===delete===[admin] + - /api/notice/**===get===[admin,user,guest] + - /api/notice/**===post===[admin,user] + - /api/notice/**===put===[admin,user] + - /api/notice/**===delete===[admin] + - /api/tag/**===get===[admin,user,guest] + - /api/tag/**===post===[admin,user] + - /api/tag/**===put===[admin,user] + - /api/tag/**===delete===[admin] + - /api/summary/**===get===[admin,user,guest] + - /api/summary/**===post===[admin,user] + - /api/summary/**===put===[admin,user] + - /api/summary/**===delete===[admin] + + excludedResource: + - /api/account/auth/**===* + - /api/i18n/**===get + - /api/metrics===get + - /api/apps/hierarchy===get + - /actuator/**===get + # web ui + - /===get + - /dashboard/**===get + - /monitors/**===get + - /alert/**===get + - /account/**===get + - /setting/**===get + - /passport/**===get + - /**/*.html===get + - /**/*.js===get + - /**/*.css===get + - /**/*.ico===get + - /**/*.ttf===get + - /**/*.png===get + - /**/*.gif===get + - /**/*.jpg===get + - /**/*.svg===get + - /**/*.json===get + # swagger ui + - /swagger-resources/**===get + - /v2/api-docs===get + - /v3/api-docs===get + # h2 database + - /h2-console/**===* + + account: + - appId: {{ .Values.manager.account.username }} + credential: {{ .Values.manager.account.password }} + role: [admin,user] + - appId: tom + credential: hertzbeat + role: [user] + - appId: guest + credential: hertzbeat + role: [guest] + - appId: lili + credential: 1A676730B0C7F54654B0E09184448289 + salt: 123 + role: [guest] diff --git a/script/helm/hertzbeat/templates/manager/deployment.yaml b/script/helm/hertzbeat/templates/manager/deployment.yaml new file mode 100644 index 00000000000..fe966bbcec4 --- /dev/null +++ b/script/helm/hertzbeat/templates/manager/deployment.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "hertzbeat.manager" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} + component: manager +spec: + replicas: 1 + selector: + matchLabels: + {{- include "hertzbeat.selectorLabels" . | nindent 6 }} + component: manager + template: + metadata: + {{- with .Values.manager.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "hertzbeat.selectorLabels" . | nindent 8 }} + component: manager + spec: + securityContext: + {{- toYaml .Values.manager.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.manager.securityContext | nindent 12 }} + image: "{{ .Values.manager.image.repository }}:{{ .Values.manager.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.manager.image.pullPolicy }} + ports: + - name: http + containerPort: 1157 + protocol: TCP + - name: cluster + containerPort: 1158 + protocol: TCP + livenessProbe: + tcpSocket: + port: 1157 + readinessProbe: + tcpSocket: + port: 1157 + volumeMounts: + - mountPath: /opt/hertzbeat/config/application.yml + subPath: application.yml + name: application + - mountPath: /opt/hertzbeat/config/sureness.yml + subPath: sureness.yml + name: sureness + resources: + {{- toYaml .Values.manager.resources | nindent 12 }} + volumes: + - name: application + configMap: + name: {{ include "hertzbeat.manager" . }} + - name: sureness + configMap: + name: {{ include "hertzbeat.manager" . }} + {{- with .Values.manager.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.manager.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.manager.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/script/helm/hertzbeat/templates/manager/service-cluster.yaml b/script/helm/hertzbeat/templates/manager/service-cluster.yaml new file mode 100644 index 00000000000..c52298b118d --- /dev/null +++ b/script/helm/hertzbeat/templates/manager/service-cluster.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: "{{ include "hertzbeat.manager" . }}-cluster" + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: 1158 + targetPort: 1158 + protocol: TCP + name: cluster + selector: + {{- include "hertzbeat.selectorLabels" . | nindent 4 }} + component: manager diff --git a/script/helm/hertzbeat/templates/manager/service-expose.yaml b/script/helm/hertzbeat/templates/manager/service-expose.yaml new file mode 100644 index 00000000000..c890f1e80fe --- /dev/null +++ b/script/helm/hertzbeat/templates/manager/service-expose.yaml @@ -0,0 +1,44 @@ +{{- if or (eq .Values.expose.type "ClusterIP") (eq .Values.expose.type "NodePort") (eq .Values.expose.type "LoadBalancer") }} +apiVersion: v1 +kind: Service +metadata: + name: "{{ include "hertzbeat.manager" . }}-http" + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +{{- if eq .Values.expose.type "ClusterIP" }} +spec: + type: ClusterIP + ports: + - name: http + port: {{ .Values.expose.clusterIP.ports.port }} + targetPort: 1157 +{{- else if eq .Values.expose.type "NodePort" }} +spec: + type: NodePort + ports: + - port: {{ .Values.expose.nodePort.ports.port }} + targetPort: 1157 + protocol: TCP + name: http + {{- if .Values.expose.nodePort.ports.nodePort }} + nodePort: {{ .Values.expose.nodePort.ports.nodePort }} + {{- end }} + selector: + {{- include "hertzbeat.selectorLabels" . | nindent 4 }} + component: manager +{{- else if eq .Values.expose.type "LoadBalancer" }} +spec: + type: LoadBalancer + {{- with .Values.expose.loadBalancer.sourceRanges }} + loadBalancerSourceRanges: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.expose.loadBalancer.ip }} + loadBalancerIP: {{ .Values.expose.loadBalancer.ip }} + {{- end }} + ports: + - name: http + port: {{ .Values.expose.loadBalancer.ports.port }} + targetPort: 1157 +{{- end }} +{{- end }} diff --git a/script/helm/hertzbeat/templates/tsdb/configmap.yaml b/script/helm/hertzbeat/templates/tsdb/configmap.yaml new file mode 100644 index 00000000000..af0ee8cfd2f --- /dev/null +++ b/script/helm/hertzbeat/templates/tsdb/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ include "hertzbeat.tsdb" . }}" + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +data: + TZ: "{{ .Values.database.timezone }}" diff --git a/script/helm/hertzbeat/templates/tsdb/pvc.yaml b/script/helm/hertzbeat/templates/tsdb/pvc.yaml new file mode 100644 index 00000000000..0115090fe16 --- /dev/null +++ b/script/helm/hertzbeat/templates/tsdb/pvc.yaml @@ -0,0 +1,29 @@ +{{- if .Values.tsdb.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "hertzbeat.tsdb" . }} + annotations: + {{- range $key, $value := .Values.tsdb.persistence.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if eq .Values.tsdb.persistence.resourcePolicy "keep" }} + helm.sh/resource-policy: keep + {{- end }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} + component: tsdb +spec: + accessModes: + - {{ .Values.tsdb.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.tsdb.persistence.size }} + {{- if .Values.tsdb.persistence.storageClass }} + {{- if eq "-" .Values.tsdb.persistence.storageClass }} + storageClassName: "" + {{- else }} + storageClassName: {{ .Values.tsdb.persistence.storageClass }} + {{- end }} + {{- end }} +{{- end }} diff --git a/script/helm/hertzbeat/templates/tsdb/service.yaml b/script/helm/hertzbeat/templates/tsdb/service.yaml new file mode 100644 index 00000000000..73f93b1485b --- /dev/null +++ b/script/helm/hertzbeat/templates/tsdb/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "hertzbeat.tsdb" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: 6667 + targetPort: 6667 + protocol: TCP + selector: + {{- include "hertzbeat.selectorLabels" . | nindent 4 }} + component: tsdb diff --git a/script/helm/hertzbeat/templates/tsdb/statefulset.yaml b/script/helm/hertzbeat/templates/tsdb/statefulset.yaml new file mode 100644 index 00000000000..ba2aec097ad --- /dev/null +++ b/script/helm/hertzbeat/templates/tsdb/statefulset.yaml @@ -0,0 +1,70 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "hertzbeat.tsdb" . }} + labels: + {{- include "hertzbeat.labels" . | nindent 4 }} + component: tsdb +spec: + replicas: 1 + serviceName: {{ include "hertzbeat.tsdb" . }} + selector: + matchLabels: + {{- include "hertzbeat.selectorLabels" . | nindent 6 }} + component: tsdb + template: + metadata: + {{- with .Values.tsdb.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "hertzbeat.selectorLabels" . | nindent 8 }} + component: tsdb + spec: + securityContext: + {{- toYaml .Values.tsdb.podSecurityContext | nindent 8 }} + containers: + - name: tsdb + image: {{ .Values.tsdb.image.repository }}:{{ .Values.tsdb.image.tag }} + imagePullPolicy: {{ .Values.tsdb.image.pullPolicy }} + livenessProbe: + tcpSocket: + port: 6667 + initialDelaySeconds: 300 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: 6667 + initialDelaySeconds: 1 + periodSeconds: 10 + resources: + {{- toYaml .Values.tsdb.resources | nindent 12 }} + envFrom: + - configMapRef: + name: "{{ include "hertzbeat.tsdb" . }}" + volumeMounts: + - name: data + mountPath: /iotdb/data + subPath: "" + volumes: + {{- if not .Values.tsdb.persistence.enabled }} + - name: data + emptyDir: {} + {{- else }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.tsdb.persistence.existingClaim | default (include "hertzbeat.tsdb" .) }} + {{- end }} + {{- with .Values.tsdb.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tsdb.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tsdb.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/script/helm/hertzbeat/values.yaml b/script/helm/hertzbeat/values.yaml new file mode 100644 index 00000000000..c99a6c097e8 --- /dev/null +++ b/script/helm/hertzbeat/values.yaml @@ -0,0 +1,133 @@ +# Default values for hertzbeat. + +manager: + image: + repository: tancloud/hertzbeat + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + account: + username: "admin" + password: "hertzbeat" + jwtSecretKey: "CyaFv0bwq2Eik0jdrKUtsA6bx3sDJeFV143R + LnfKefTjsIfJLBa2YkhEqEGtcHDTNe4CU6+9 + 8tVt4bisXQ13rbN0oxhUZR73M6EByXIO+SV5 + dKhaX0csgOCTlCxq20yhmUea6H6JIpSE2Rwp" + podAnnotations: { } + podSecurityContext: { } + securityContext: { } + resources: { } + nodeSelector: { } + tolerations: [ ] + affinity: { } + +collector: + image: + repository: tancloud/hertzbeat-collector + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + replicaCount: 1 + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 20 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + + podAnnotations: { } + podSecurityContext: { } + securityContext: { } + resources: { } + nodeSelector: { } + tolerations: [ ] + affinity: { } + +database: + image: + repository: mysql + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "8" + timezone: "Asia/Shanghai" + rootPassword: "123456" + persistence: + enabled: true + existingClaim: "" + storageClass: "" + subPath: "" + accessMode: ReadWriteOnce + size: 4Gi + annotations: {} + resourcePolicy: "keep" + + podAnnotations: { } + podSecurityContext: { } + securityContext: { } + resources: { } + nodeSelector: { } + tolerations: [ ] + affinity: { } + +tsdb: + image: + repository: apache/iotdb + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "0.13.3-node" + timezone: "Asia/Shanghai" + persistence: + enabled: true + existingClaim: "" + storageClass: "" + subPath: "" + accessMode: ReadWriteOnce + size: 4Gi + annotations: {} + resourcePolicy: "keep" + + podAnnotations: { } + podSecurityContext: { } + securityContext: { } + resources: { } + nodeSelector: { } + tolerations: [ ] + affinity: { } + +# Expose Network +expose: + # Set how to expose the service. Set the type as "ingress", "clusterIP", "nodePort" or "loadBalancer" + # and fill the information in the corresponding section + type: NodePort + clusterIP: + ports: + # The service port Harbor listens on when serving HTTP + port: 1157 + nodePort: + ports: + # The service port Harbor listens on when serving HTTP + port: 1157 + # The node port Harbor listens on when serving HTTP + nodePort: 31157 + loadBalancer: + # Set the IP if the LoadBalancer supports assigning IP + ip: "" + ports: + # The service port Harbor listens on when serving HTTP + port: 1157 + sourceRanges: [ ] + ingress: + className: "" + annotations: { } + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: hertzbeat.domain + paths: + - path: / + pathType: ImplementationSpecific + tls: [ ] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + diff --git a/web-app/src/app/layout/basic/basic.component.ts b/web-app/src/app/layout/basic/basic.component.ts index 60f0fa9aa21..244ef62239e 100644 --- a/web-app/src/app/layout/basic/basic.component.ts +++ b/web-app/src/app/layout/basic/basic.component.ts @@ -79,7 +79,7 @@ import { CONSTS } from 'src/app/shared/consts';
HertzBeat {{ version }}
- Copyright © 2021-2023 + Copyright © 2021-{{ currentYear }} hertzbeat.com
Licensed under the Apache License, Version 2.0 @@ -104,6 +104,7 @@ export class LayoutBasicComponent { searchToggleStatus = false; showSettingDrawer = !environment.production; version = CONSTS.VERSION; + currentYear = new Date().getFullYear(); get user(): User { return this.settings.user; }