From f47e5e5f672f3d51c31c72ba737df8e7bfe04762 Mon Sep 17 00:00:00 2001 From: EZ4BRUCE <69068661+EZ4BRUCE@users.noreply.github.com> Date: Sun, 17 Nov 2024 22:41:48 -0800 Subject: [PATCH] chore(): update private ob to 1.0.1 (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 升级 mo-ob-opensource chart 至1.0.7 (最新) 2. 修改默认配置,添加 mo.yaml 便于用户使用 & 简单修改 --- Tiltfile | 111 +++++++++------ charts/mo-ob-opensource/values.yaml | 16 +-- charts/mo-ob-private/Chart.yaml | 10 +- charts/mo-ob-private/mo.yaml | 213 ++++++++++++++++++++++++++++ charts/mo-ob-private/values.yaml | 172 +++++++++++++++------- dev/kind-config.yaml | 2 + dev/mo-ob-private.dev.yaml | 0 makefile | 28 +++- 8 files changed, 441 insertions(+), 111 deletions(-) create mode 100644 charts/mo-ob-private/mo.yaml create mode 100644 dev/mo-ob-private.dev.yaml diff --git a/Tiltfile b/Tiltfile index c2e3ec0..d560716 100644 --- a/Tiltfile +++ b/Tiltfile @@ -1,45 +1,74 @@ + +command = os.getenv('TILT_COMMAND', 'default') load('ext://helm_remote', 'helm_remote') -helm_remote( - 'operator', - repo_url='https://operator.min.io', - release_name='minio-operator', - namespace='minio-operator', - version='6.0.2', - create_namespace=True, -) - -helm_remote( - 'tenant', - repo_url='https://operator.min.io', - release_name='loki-tenant', - namespace='loki-tenant', - version='6.0.2', - values=['./dev/loki-tenant.yaml'], - create_namespace=True, -) - -# 设置 Helm Chart 的本地路径 -mo_ob_opensource_chart = './charts/mo-ob-opensource' -mo_ruler_stack_chart = './charts/mo-ruler-stack' - -local('kubectl get ns mo-ob || kubectl create ns mo-ob') - -k8s_yaml( - helm( - mo_ruler_stack_chart, - name='mo-ruler-stack', - namespace='mo-ob', - values=['./dev/mo-ruler-stack.dev.yaml'], + +def deploy_minio(): + helm_remote( + 'operator', + repo_url='https://operator.min.io', + release_name='minio-operator', + namespace='minio-operator', + version='6.0.2', + create_namespace=True, + ) + + helm_remote( + 'tenant', + repo_url='https://operator.min.io', + release_name='loki-tenant', + namespace='loki-tenant', + version='6.0.2', + values=['./dev/loki-tenant.yaml'], + create_namespace=True, ) -) - -k8s_yaml( - helm( - mo_ob_opensource_chart, - name='mo-ob-opensource', - namespace='mo-ob', - values=['./dev/mo-ob-opensource.dev.yaml'], + +def deploy_moc_ob(): + # 设置 Helm Chart 的本地路径 + mo_ob_opensource_chart = './charts/mo-ob-opensource' + mo_ruler_stack_chart = './charts/mo-ruler-stack' + + local('kubectl get ns mo-ob || kubectl create ns mo-ob') + + k8s_yaml( + helm( + mo_ruler_stack_chart, + name='mo-ruler-stack', + namespace='mo-ob', + values=['./dev/mo-ruler-stack.dev.yaml'], + ) + ) + + k8s_yaml( + helm( + mo_ob_opensource_chart, + name='mo-ob-opensource', + namespace='mo-ob', + values=['./dev/mo-ob-opensource.dev.yaml'], + ) + ) + + k8s_yaml("./dev/loki_test_rule.yaml") + +def deploy_ob_private(): + local('kubectl get ns mo-ob || kubectl create ns mo-ob') + mo_ob_private_chart = './charts/mo-ob-private' + + k8s_yaml( + helm( + mo_ob_private_chart, + name='mo-ob-private', + namespace='mo-ob', + values=['./dev/mo-ob-private.dev.yaml'], + ) ) -) -k8s_yaml("./dev/loki_test_rule.yaml") \ No newline at end of file +if command == 'moc': + deploy_minio() + deploy_moc_ob() +elif command == 'private': + deploy_minio() + deploy_ob_private() +elif command == 'minio': + deploy_minio() +else: + print('Unknown command, please use TILT_COMMAND=moc or TILT_COMMAND=private') \ No newline at end of file diff --git a/charts/mo-ob-opensource/values.yaml b/charts/mo-ob-opensource/values.yaml index 25fe4fc..282642c 100644 --- a/charts/mo-ob-opensource/values.yaml +++ b/charts/mo-ob-opensource/values.yaml @@ -168,20 +168,14 @@ loki: # -- Storage config. Providing this will automatically populate all necessary storage configs in the templated config. storage: bucketNames: - # use same bucket chunks: test-bucket - ruler: test-bucket type: s3 s3: - # s3: null - # e.g. s3.us-west-2.amazonaws.com - endpoint: null - # e.g. us-west-2 - region: null - secretAccessKey: null - accessKeyId: null - s3ForcePathStyle: false - insecure: false + endpoint: minio.loki-tenant + accessKeyId: obtest-access + secretAccessKey: obtest-secret + s3ForcePathStyle: true + insecure: true # -- Check https://grafana.com/docs/loki/latest/configuration/#schema_config for more info on how to configure schemas schemaConfig: configs: diff --git a/charts/mo-ob-private/Chart.yaml b/charts/mo-ob-private/Chart.yaml index f266214..f0fee13 100644 --- a/charts/mo-ob-private/Chart.yaml +++ b/charts/mo-ob-private/Chart.yaml @@ -2,15 +2,15 @@ apiVersion: v2 name: mo-ob-private description: mo-ob-private's Helm chart for Kubernetes type: application -version: 1.0.0-alpha.3 +version: 1.0.1 appVersion: 0.9.0 dependencies: - condition: mo-ob-opensource.enabled name: mo-ob-opensource - repository: https://matrixone-cloud.github.io/observability-charts - version: 1.0.0-alpha.16 + repository: https://matrixorigin.github.io/observability-charts + version: 1.0.7 - condition: mo-ruler-stack.enabled name: mo-ruler-stack - repository: https://matrixone-cloud.github.io/observability-charts - version: 1.0.2 + repository: https://matrixorigin.github.io/observability-charts + version: 1.0.4 diff --git a/charts/mo-ob-private/mo.yaml b/charts/mo-ob-private/mo.yaml new file mode 100644 index 0000000..3bdca1b --- /dev/null +++ b/charts/mo-ob-private/mo.yaml @@ -0,0 +1,213 @@ +mo-ob-opensource: + + alloy: + image: + registry: "docker.io" + repository: grafana/alloy + tag: v1.3.1 + alloy: + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 200m + memory: 200Mi + + promtail: + image: + registry: docker.io + repository: grafana/promtail + tag: "2.8.4" + resources: + limits: + cpu: "200m" + memory: "200Mi" + requests: + cpu: "100m" + memory: "200Mi" + loki: + sidecar: + image: + repository: kiwigrid/k8s-sidecar + tag: 1.27.5 + image: + registry: docker.io + repository: grafana/loki + tag: "3.2.0" + enabled: true + tableManager: + enabled: true + retention_deletes_enabled: true + retention_period: 720h + + loki: + # disable log alert in paivate env + rulerConfig: + storage: + type: "" + # commonConfig: + # replication_factor: 1 + storage_config: + object_prefix: loki-controlplane + storage: + bucketNames: + chunks: test-bucket + type: s3 + s3: + endpoint: minio.loki-tenant + accessKeyId: obtest-access + secretAccessKey: obtest-secret + s3ForcePathStyle: true + insecure: true + + write: + # -- Number of replicas for the write + replicas: 3 + persistence: + enableStatefulSetAutoDeletePVC: false + size: 20Gi + storageClass: + resources: + requests: + memory: "2Gi" + cpu: "500m" + limits: + memory: "2Gi" + cpu: "1000m" + + read: + replicas: 3 + persistence: + enableStatefulSetAutoDeletePVC: true + size: 20Gi + storageClass: + resources: + requests: + memory: "2Gi" + cpu: "500m" + limits: + memory: "2Gi" + cpu: "1000m" + + backend: + replicas: 1 + persistence: + enableStatefulSetAutoDeletePVC: true + size: 20Gi + storageClass: + resources: + requests: + memory: "2Gi" + cpu: "500m" + limits: + memory: "2Gi" + cpu: "1000m" + + # Configuration for the gateway + gateway: + image: + registry: docker.io + repository: nginxinc/nginx-unprivileged + tag: 1.27-alpine + enabled: true + replicas: 1 + resources: + requests: + memory: "500Mi" + cpu: "500m" + limits: + memory: "1Gi" + cpu: "1000m" + + kube-prometheus-stack: + prometheus-node-exporter: + image: + registry: quay.io + repository: prometheus/node-exporter + tag: v1.5.0 + + prometheusOperator: + image: + registry: quay.io + repository: prometheus-operator/prometheus-operator + tag: v0.63.0 + prometheusConfigReloader: + image: + registry: quay.io + repository: prometheus-operator/prometheus-config-reloader + # if not set appVersion field from Chart.yaml is used + tag: v0.63.0 + + prometheus: + prometheusSpec: + image: + registry: quay.io + repository: prometheus/prometheus + tag: v2.42.0 + retention: 14d + externalLabels: + clusterDetail: mo-ob-private-cluster + resources: + limits: + cpu: 2000m + memory: "6Gi" + requests: + cpu: 2000m + memory: "6Gi" + # [必要]根据部署的云厂商选择存储配置 + storageSpec: + volumeClaimTemplate: + spec: + storageClassName: "" + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 100Gi + + kube-state-metrics: + enabled: true + image: + registry: registry.k8s.io + repository: kube-state-metrics/kube-state-metrics + tag: v2.8.2 + + +mo-ruler-stack: + + alertmanager: + image: + repository: quay.io/prometheus/alertmanager + pullPolicy: IfNotPresent + tag: v0.27.0 + + grafana: + image: + repository: docker.io/grafana/grafana + tag: 10.1.6 + initChownData: + image: + repository: docker.io/library/busybox + tag: 1.31.1 + sidecar: + image: + repository: quay.io/kiwigrid/k8s-sidecar + tag: 1.25.1 + + persistence: + enabled: true + type: "statefulset" + storageClassName: + size: "5Gi" + resources: + limits: + cpu: "1000m" + memory: "2Gi" + requests: + cpu: "1000m" + memory: "2Gi" + service: + enabled: true + type: NodePort + targetPort: 3000 + portName: service diff --git a/charts/mo-ob-private/values.yaml b/charts/mo-ob-private/values.yaml index 4ce0cd4..edf9920 100644 --- a/charts/mo-ob-private/values.yaml +++ b/charts/mo-ob-private/values.yaml @@ -1,11 +1,27 @@ mo-ob-opensource: enabled: true + alloy: + enabled: true + image: + registry: "docker.io" + repository: grafana/alloy + tag: v1.3.1 + configReloader: + enabled: false + alloy: + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 200m + memory: 200Mi promtail: - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "promtail" - # tag: "2.8.4" + image: + registry: docker.io + repository: grafana/promtail + tag: "2.8.4" enabled: true resources: limits: @@ -15,12 +31,16 @@ mo-ob-opensource: cpu: "10m" memory: "20Mi" loki: - # sidecar: - # image: - # repository: "registry.cn-hangzhou.aliyuncs.com/ack-cos/k8s-sidecar" - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "loki" + lokiCanary: + enabled: false + sidecar: + image: + repository: kiwigrid/k8s-sidecar + tag: 1.27.5 + image: + registry: docker.io + repository: grafana/loki + tag: "3.2.0" enabled: true tableManager: enabled: true @@ -37,18 +57,18 @@ mo-ob-opensource: type: "" commonConfig: replication_factor: 1 + storage_config: + object_prefix: loki-controlplane storage: bucketNames: - chunks: "" + chunks: test-bucket type: s3 s3: - # s3: null - endpoint: - # region: us-west-2 - secretAccessKey: - accessKeyId: - s3ForcePathStyle: false - insecure: false + endpoint: minio.loki-tenant + accessKeyId: obtest-access + secretAccessKey: obtest-secret + s3ForcePathStyle: true + insecure: true schemaConfig: configs: - from: "2024-01-01" @@ -56,7 +76,7 @@ mo-ob-opensource: period: 24h prefix: index_ object_store: s3 - schema: v12 + schema: v13 store: tsdb write: # -- Number of replicas for the write @@ -103,6 +123,10 @@ mo-ob-opensource: # Configuration for the gateway gateway: + image: + registry: docker.io + repository: nginxinc/nginx-unprivileged + tag: 1.27-alpine enabled: true replicas: 1 resources: @@ -117,9 +141,10 @@ mo-ob-opensource: enabled: true prometheus-node-exporter: - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "node-exporter" + image: + registry: quay.io + repository: prometheus/node-exporter + tag: v1.5.0 enabled: true resources: limits: @@ -130,13 +155,16 @@ mo-ob-opensource: memory: "20Mi" prometheusOperator: - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "prometheus-operator" - # prometheusConfigReloader: - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "prometheus-config-reloader" + image: + registry: quay.io + repository: prometheus-operator/prometheus-operator + tag: v0.63.0 + prometheusConfigReloader: + image: + registry: quay.io + repository: prometheus-operator/prometheus-config-reloader + # if not set appVersion field from Chart.yaml is used + tag: v0.63.0 admissionWebhooks: enabled: false patch: @@ -151,9 +179,10 @@ mo-ob-opensource: prometheus: prometheusSpec: - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "prometheus" + image: + registry: quay.io + repository: prometheus/prometheus + tag: v2.42.0 retention: 21d externalLabels: clusterDetail: mo-ob-private-cluster @@ -168,7 +197,7 @@ mo-ob-opensource: storageSpec: volumeClaimTemplate: spec: - storageClassName: "" + storageClassName: standard accessModes: ["ReadWriteOnce"] resources: requests: @@ -425,9 +454,10 @@ mo-ob-opensource: kube-state-metrics: enabled: true - # image: - # registry: "registry.cn-hangzhou.aliyuncs.com/ack-cos" - # repository: "kube-state-metrics" + image: + registry: registry.k8s.io + repository: kube-state-metrics/kube-state-metrics + tag: v2.8.2 prometheus: monitor: enabled: ture @@ -445,17 +475,64 @@ mo-ruler-stack: tag: v1.1.7 alertmanager: - enabled: false + image: + repository: quay.io/prometheus/alertmanager + pullPolicy: IfNotPresent + tag: v0.27.0 + enabled: true + persistence: + enabled: false + config: + global: + resolve_timeout: 5m + smtp_from: "it@matrixorigin.cn" + smtp_hello: "smtp.exmail.qq.com:465" + smtp_smarthost: "smtp.exmail.qq.com:465" + smtp_auth_username: "it@matrixorigin.cn" + smtp_auth_password_file: "/tmp/alertmanager-email-smtp/smtp-authorization" + smtp_require_tls: false + route: + group_by: ["alertname"] # 分组标签 + group_wait: 10s # 告警等待时间。告警产生后等待10s,如果有同组告警一起发出 + group_interval: 10s # 两组告警的间隔时间 + repeat_interval: 1d # 重复告警的间隔时间,可减少相同邮件的发送频率 + receiver: "null" + # routes: + receivers: + - name: "null" + + extraSecretMounts: + # kubectl -n mo-ob create secret generic alertmanager-email-secret --from-literal=smtp-authorization=[your-smtp-password] + - name: smtp-authorization + mountPath: /tmp/alertmanager-email-smtp + subPath: "" + secretName: alertmanager-email-secret + readOnly: true + - name: web-config + mountPath: /tmp/alertmanager-web-config + subPath: "" + secretName: alertmanager-web-config + readOnly: true + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 10m + memory: 32Mi grafana: - # image: - # repository: "registry.cn-hangzhou.aliyuncs.com/ack-cos/grafana" - # initChownData: - # image: - # "repository": "registry.cn-hangzhou.aliyuncs.com/ack-cos/busybox" - # sidecar: - # image: - # repository: "registry.cn-hangzhou.aliyuncs.com/ack-cos/k8s-sidecar" + image: + repository: docker.io/grafana/grafana + tag: 10.1.6 + initChownData: + image: + repository: docker.io/library/busybox + tag: 1.31.1 + sidecar: + image: + repository: quay.io/kiwigrid/k8s-sidecar + tag: 1.25.1 replicas: 1 enabled: true @@ -470,7 +547,7 @@ mo-ruler-stack: persistence: enabled: true type: "statefulset" - storageClassName: "" + storageClassName: size: "5Gi" # static passwd @@ -485,8 +562,7 @@ mo-ruler-stack: service: enabled: true - type: ClusterIP - port: 80 + type: NodePort targetPort: 3000 labels: {} portName: service diff --git a/dev/kind-config.yaml b/dev/kind-config.yaml index 261e026..5ae1da9 100644 --- a/dev/kind-config.yaml +++ b/dev/kind-config.yaml @@ -8,5 +8,7 @@ kindV1Alpha4Cluster: image: kindest/node:v1.27.3 - role: worker image: kindest/node:v1.27.3 + - role: worker + image: kindest/node:v1.27.3 - role: worker image: kindest/node:v1.27.3 \ No newline at end of file diff --git a/dev/mo-ob-private.dev.yaml b/dev/mo-ob-private.dev.yaml new file mode 100644 index 0000000..e69de29 diff --git a/makefile b/makefile index 5409f86..8f85b0b 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,26 @@ -.PHONY: local/up -local/up: cluster/up ## (beta) deploy all containers locally via tilt (k8s cluster will be created if it doesn't exist) - tilt up +.PHONY: moc/up +moc/up: cluster/up ## (beta) deploy all containers locally via tilt (k8s cluster will be created if it doesn't exist) + TILT_COMMAND=moc tilt up -.PHONY: local/down -local/down: ## (beta) remove all containers deployed via tilt - tilt down +.PHONY: moc/down +moc/down: ## (beta) remove all containers deployed via tilt + TILT_COMMAND=moc tilt down + +.PHONY: private/up +private/up: cluster/up + TILT_COMMAND=private tilt up + +.PHONY: private/down +private/down: ## (beta) remove all containers deployed via tilt + TILT_COMMAND=private tilt down + +.PHONY: minio/up +minio/up: cluster/up + TILT_COMMAND=minio tilt up + +.PHONY: minio/down +minio/down: ## (beta) remove all containers deployed via tilt + TILT_COMMAND=minio tilt down .PHONY: cluster/up cluster/up: ## (beta) create a local development k8s cluster