diff --git a/.github/workflows/pika.yml b/.github/workflows/pika.yml index 067a9c4a9c..b8fddf5919 100644 --- a/.github/workflows/pika.yml +++ b/.github/workflows/pika.yml @@ -33,8 +33,8 @@ jobs: - name: Install Deps run: | - sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler - sudo apt-get install -y clang-tidy-12 + sudo apt-get update + sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler clang-tidy - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. diff --git a/tools/kubeblocks_helm/pika-cluster/templates/grafana/configmap-dashboards.yaml b/tools/kubeblocks_helm/pika-cluster/templates/grafana/configmap-dashboards.yaml new file mode 100644 index 0000000000..104062188e --- /dev/null +++ b/tools/kubeblocks_helm/pika-cluster/templates/grafana/configmap-dashboards.yaml @@ -0,0 +1,19 @@ +{{- $files := .Files.Glob "dashboards/*.json" }} +{{- if $files }} +apiVersion: v1 +kind: ConfigMapList +items: +{{- range $path, $fileContents := $files }} +{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} +- apiVersion: v1 + kind: ConfigMap + metadata: + name: {{ printf "%s-grafana-%s" (include "pika.name" $) $dashboardName | trunc 63 | trimSuffix "-" }} + labels: + grafana_dashboard: "1" + app: {{ template "pika.name" $ }}-grafana +{{ include "pika.labels" $ | indent 6 }} + data: + {{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/tools/kubeblocks_helm/pika-master-slave-cluster/templates/grafana/configmap-dashboards.yaml b/tools/kubeblocks_helm/pika-master-slave-cluster/templates/grafana/configmap-dashboards.yaml new file mode 100644 index 0000000000..104062188e --- /dev/null +++ b/tools/kubeblocks_helm/pika-master-slave-cluster/templates/grafana/configmap-dashboards.yaml @@ -0,0 +1,19 @@ +{{- $files := .Files.Glob "dashboards/*.json" }} +{{- if $files }} +apiVersion: v1 +kind: ConfigMapList +items: +{{- range $path, $fileContents := $files }} +{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} +- apiVersion: v1 + kind: ConfigMap + metadata: + name: {{ printf "%s-grafana-%s" (include "pika.name" $) $dashboardName | trunc 63 | trimSuffix "-" }} + labels: + grafana_dashboard: "1" + app: {{ template "pika.name" $ }}-grafana +{{ include "pika.labels" $ | indent 6 }} + data: + {{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/tools/kubeblocks_helm/pika-master-slave/config/exporter-info.tpl b/tools/kubeblocks_helm/pika-master-slave/config/exporter-info.tpl new file mode 100644 index 0000000000..5597752f93 --- /dev/null +++ b/tools/kubeblocks_helm/pika-master-slave/config/exporter-info.tpl @@ -0,0 +1,12 @@ +server = true +data = true +clients = true +stats = true +cpu = true +replication = true +keyspace = true +cache = true + +execcount = false +commandstats = false +rocksdb = false diff --git a/tools/kubeblocks_helm/pika-master-slave/templates/componentdefinition-pika-exporter.yaml b/tools/kubeblocks_helm/pika-master-slave/templates/componentdefinition-pika-exporter.yaml new file mode 100644 index 0000000000..3b2b42930e --- /dev/null +++ b/tools/kubeblocks_helm/pika-master-slave/templates/componentdefinition-pika-exporter.yaml @@ -0,0 +1,65 @@ +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: ComponentDefinition +metadata: + name: pika-exporter + namespace: {{ .Release.Namespace }} + labels: + {{- include "pika.labels" . | nindent 4 }} +spec: + provider: pika + description: A pika exporter component definition + serviceKind: pika-exporter + serviceVersion: {{ .Chart.AppVersion }} + services: + - name: expoter + spec: + ports: + - name: expoter + port: 9121 + targetPort: expoter + updateStrategy: Serial + configs: + - name: pika-config + templateRef: pika-conf-template + namespace: {{ .Release.Namespace }} + volumeName: config + vars: + ## reference to the pika-codis-dashboard service + - name: DASHBOARD_ADDR + valueFrom: + serviceVarRef: + compDef: pika-codis-dashboard + name: dashboard + optional: true + host: Optional + runtime: + initContainers: + - name: wait-codis-dashboard + env: + - name: DASHBOARD_ADDR + value: "$(KB_CLUSTER_NAME)-codis-dashboard" + image: busybox:1.28 + command: + - 'sh' + - '-c' + - "until nc -z ${DASHBOARD_ADDR} 18080; do echo waiting for codis dashboard; sleep 2; done;" + containers: + - name: pika-exporter + image: {{ include "pikaExporter.image" . }} + imagePullPolicy: {{ include "pikaExporter.imagePullPolicy" . }} + ports: + - name: expoter + containerPort: 9121 + volumeMounts: + - name: config + mountPath: /etc/pika + env: + - name: DASHBOARD_ADDR + value: "$(KB_CLUSTER_NAME)-codis-dashboard" + command: + - "/pika/bin/pika_exporter" + args: + - "-config" + - "/etc/pika/info.toml" + - "-codis.addr" + - "http://$(DASHBOARD_ADDR):18080/topom" \ No newline at end of file diff --git a/tools/kubeblocks_helm/pika-master-slave/templates/componentdefinition-redis-sentinel.yaml b/tools/kubeblocks_helm/pika-master-slave/templates/componentdefinition-redis-sentinel.yaml new file mode 100644 index 0000000000..60c6330476 --- /dev/null +++ b/tools/kubeblocks_helm/pika-master-slave/templates/componentdefinition-redis-sentinel.yaml @@ -0,0 +1,50 @@ +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: ComponentDefinition +metadata: + name: redis-sentinel + namespace: {{ .Release.Namespace }} + labels: + {{- include "pika.labels" . | nindent 4 }} +spec: + clusterSize: 3 + podSecurityContext: + runAsUser: 1000 + fsGroup: 1000 + redisSentinelConfig: + redisReplicationName: redis-replication + kubernetesConfig: + image: 'quay.io/opstree/redis-sentinel:v7.0.7' + imagePullPolicy: IfNotPresent + resources: + requests: + cpu: 101m + memory: 128Mi + limits: + cpu: 101m + memory: 128Mi + updateStrategy: Serial + configs: + - name: pika-config + templateRef: pika-conf-template + namespace: {{ .Release.Namespace }} + volumeName: config + containers: + - name: redis-sentinel + image: {{ include "pikaExporter.image" . }} + imagePullPolicy: {{ include "pikaExporter.imagePullPolicy" . }} + ports: + - name: expoter + containerPort: 9121 + volumeMounts: + - name: config + mountPath: /etc/pika + env: + - name: DASHBOARD_ADDR + value: "$(KB_CLUSTER_NAME)-codis-dashboard" + command: + - "/pika/bin/pika_exporter" + args: + - "-config" + - "/etc/pika/info.toml" + - "-codis.addr" + - "http://$(DASHBOARD_ADDR):18080/topom" \ No newline at end of file diff --git a/tools/kubeblocks_helm/pika-master-slave/templates/componentversion-pika-expoter.yaml b/tools/kubeblocks_helm/pika-master-slave/templates/componentversion-pika-expoter.yaml new file mode 100644 index 0000000000..b06d098d78 --- /dev/null +++ b/tools/kubeblocks_helm/pika-master-slave/templates/componentversion-pika-expoter.yaml @@ -0,0 +1,18 @@ +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: ComponentVersion +metadata: + name: pika-exporter + labels: + {{- include "pika.labels" . | nindent 4 }} +spec: + compatibilityRules: + - compDefs: + - pika-exporter + releases: + - {{ .Chart.AppVersion }} + releases: + - name: {{ .Chart.AppVersion }} + changes: + serviceVersion: {{ .Chart.AppVersion }} + images: + codis-dashboard: {{ include "pikaExporter.image" . }} \ No newline at end of file diff --git a/tools/kubeblocks_helm/pika-master-slave/templates/componentversion-redis-sentinel.yaml b/tools/kubeblocks_helm/pika-master-slave/templates/componentversion-redis-sentinel.yaml new file mode 100644 index 0000000000..d5d003d623 --- /dev/null +++ b/tools/kubeblocks_helm/pika-master-slave/templates/componentversion-redis-sentinel.yaml @@ -0,0 +1,21 @@ +apiVersion: redis.redis.opstreelabs.in/v1beta1 +kind: RedisSentinel +metadata: + name: redis-sentinel +spec: + clusterSize: 3 + podSecurityContext: + runAsUser: 1000 + fsGroup: 1000 + redisSentinelConfig: + redisReplicationName: redis-replication + kubernetesConfig: + image: 'quay.io/opstree/redis-sentinel:v7.0.7' + imagePullPolicy: IfNotPresent + resources: + requests: + cpu: 101m + memory: 128Mi + limits: + cpu: 101m + memory: 128Mi \ No newline at end of file