From b5c6eb6b51f8241edd893e6ddc4e74e05d8b2f89 Mon Sep 17 00:00:00 2001 From: Aman Pruthi Date: Tue, 25 Jun 2024 04:51:34 +0530 Subject: [PATCH] feat: Added yace support for aws rds and redis metrics (#140) Co-authored-by: Aditya Choudhari Co-authored-by: amanpruthi --- charts/operator-wandb/Chart.lock | 7 +- charts/operator-wandb/Chart.yaml | 6 +- charts/operator-wandb/charts/yace/.helmignore | 23 ++++ charts/operator-wandb/charts/yace/Chart.yaml | 5 + .../charts/yace/templates/_helpers.tpl | 102 +++++++++++++++++ .../charts/yace/templates/configmap.yaml | 18 +++ .../charts/yace/templates/deployment.yaml | 89 +++++++++++++++ .../charts/yace/templates/service.yaml | 23 ++++ .../charts/yace/templates/serviceaccount.yaml | 15 +++ charts/operator-wandb/charts/yace/values.yaml | 105 ++++++++++++++++++ charts/operator-wandb/values.yaml | 9 ++ 11 files changed, 399 insertions(+), 3 deletions(-) create mode 100644 charts/operator-wandb/charts/yace/.helmignore create mode 100644 charts/operator-wandb/charts/yace/Chart.yaml create mode 100644 charts/operator-wandb/charts/yace/templates/_helpers.tpl create mode 100644 charts/operator-wandb/charts/yace/templates/configmap.yaml create mode 100644 charts/operator-wandb/charts/yace/templates/deployment.yaml create mode 100644 charts/operator-wandb/charts/yace/templates/service.yaml create mode 100644 charts/operator-wandb/charts/yace/templates/serviceaccount.yaml create mode 100644 charts/operator-wandb/charts/yace/values.yaml diff --git a/charts/operator-wandb/Chart.lock b/charts/operator-wandb/Chart.lock index 6cc7c094..fd1f5101 100644 --- a/charts/operator-wandb/Chart.lock +++ b/charts/operator-wandb/Chart.lock @@ -35,5 +35,8 @@ dependencies: - name: stackdriver repository: file://charts/stackdriver version: 0.1.0 -digest: sha256:9a6c69506deb6969686d5b220a0692b53cfa29642e059bdf27c440c5d7086bdb -generated: "2024-06-05T11:04:02.508473-07:00" +- name: yace + repository: file://charts/yace + version: 0.1.0 +digest: sha256:c12c533a22b6f593a526e3060597ee1591bf5a2cac4ff03c588758e0dbc65d1e +generated: "2024-06-24T16:15:00.442236-07:00" diff --git a/charts/operator-wandb/Chart.yaml b/charts/operator-wandb/Chart.yaml index 547b7147..09d5a7f4 100644 --- a/charts/operator-wandb/Chart.yaml +++ b/charts/operator-wandb/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: operator-wandb description: A Helm chart for deploying W&B to Kubernetes type: application -version: 0.13.13 +version: 0.14.1 appVersion: 1.0.0 icon: https://wandb.ai/logo.svg @@ -60,3 +60,7 @@ dependencies: version: "*.*.*" repository: file://charts/stackdriver condition: stackdriver.install + - name: yace + version: "*.*.*" + repository: file://charts/yace + condition: yace.install diff --git a/charts/operator-wandb/charts/yace/.helmignore b/charts/operator-wandb/charts/yace/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/operator-wandb/charts/yace/.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/charts/operator-wandb/charts/yace/Chart.yaml b/charts/operator-wandb/charts/yace/Chart.yaml new file mode 100644 index 00000000..12bf5488 --- /dev/null +++ b/charts/operator-wandb/charts/yace/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: yace +description: A Helm chart for Kubernetes +version: 0.1.0 +appVersion: "v0.60.0" diff --git a/charts/operator-wandb/charts/yace/templates/_helpers.tpl b/charts/operator-wandb/charts/yace/templates/_helpers.tpl new file mode 100644 index 00000000..351bdda5 --- /dev/null +++ b/charts/operator-wandb/charts/yace/templates/_helpers.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "yace.name" -}} +{{- default .Chart.Name .Values.nameOverride | 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 "yace.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "yace.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "yace.labels" -}} +helm.sh/chart: {{ include "yace.chart" . }} +{{ include "yace.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +wandb.com/app-name: {{ include "yace.chart" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "yace.selectorLabels" -}} +app.kubernetes.io/name: {{ include "yace.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "yace.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "yace.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Returns the extraEnv keys and values to inject into containers. + +Global values will override any chart-specific values. +*/}} +{{- define "yace.extraEnv" -}} +{{- $allExtraEnv := merge (default (dict) .local.extraEnv) .global.extraEnv -}} +{{- range $key, $value := $allExtraEnv }} +- name: {{ $key }} + value: {{ $value | quote }} +{{- end -}} +{{- end -}} + +{{/* +Returns a list of _common_ labels to be shared across all +app deployments and other shared objects. +*/}} +{{- define "yace.commonLabels" -}} +{{- $commonLabels := default (dict) .Values.common.labels -}} +{{- if $commonLabels }} +{{- range $key, $value := $commonLabels }} +{{ $key }}: {{ $value | quote }} +{{- end }} +{{- end -}} +{{- end -}} + +{{/* +Returns a list of _pod_ labels to be shared across all +app deployments. +*/}} +{{- define "yace.podLabels" -}} +{{- range $key, $value := .Values.pod.labels }} +{{ $key }}: {{ $value | quote }} +{{- end }} +{{- end -}} + diff --git a/charts/operator-wandb/charts/yace/templates/configmap.yaml b/charts/operator-wandb/charts/yace/templates/configmap.yaml new file mode 100644 index 00000000..42fd5728 --- /dev/null +++ b/charts/operator-wandb/charts/yace/templates/configmap.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "yace.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "yace.commonLabels" . | nindent 4 }} + {{- include "yace.labels" . | nindent 4 }} + {{- if .Values.configMap.labels -}} + {{- toYaml .Values.configMap.labels | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.configMap.annotations -}} + {{- toYaml .Values.configMap.annotations | nindent 4 }} + {{- end }} +data: + config.yml: | +{{- (tpl .Values.config $) | nindent 4 }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/yace/templates/deployment.yaml b/charts/operator-wandb/charts/yace/templates/deployment.yaml new file mode 100644 index 00000000..3eb65681 --- /dev/null +++ b/charts/operator-wandb/charts/yace/templates/deployment.yaml @@ -0,0 +1,89 @@ +{{- if .Values.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "yace.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "yace.commonLabels" . | nindent 4 }} + {{- include "yace.labels" . | nindent 4 }} + {{- if .Values.deployment.labels -}} + {{- toYaml .Values.deployment.labels | nindent 4 }} + {{- end }} + annotations: + {{- include "wandb.deploymentAnnotations" $ | nindent 4 }} + {{- if .Values.deployment.annotations -}} + {{- toYaml .Values.deployment.annotations | nindent 4 }} + {{- end }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "wandb.selectorLabels" $ | nindent 6 }} + {{- include "yace.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "wandb.podLabels" . | nindent 8 }} + {{- include "yace.commonLabels" . | nindent 8 }} + {{- include "yace.podLabels" . | nindent 8 }} + {{- include "yace.labels" . | nindent 8 }} + annotations: + checksum/configmap: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }} + {{- if .Values.pod.annotations -}} + {{- toYaml .Values.pod.annotations | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "yace.serviceAccountName" . }} + {{- if .tolerations }} + tolerations: + {{- toYaml .tolerations | nindent 8 }} + {{- end }} + {{- include "wandb.nodeSelector" . | nindent 6 }} + {{- include "wandb.priorityClassName" . | nindent 6 }} + {{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: + - yace + - --config.file=/config/config.yml + - --scraping-interval=60 + ports: + - containerPort: 5000 + name: http + protocol: TCP + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: http + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: http + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: /config + name: yace-config + volumes: + - name: config + configMap: + defaultMode: 420 + name: {{ include "yace.fullname" . }} + volumes: + - configMap: + defaultMode: 420 + name: {{ include "yace.fullname" . }} + name: yace-config +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/yace/templates/service.yaml b/charts/operator-wandb/charts/yace/templates/service.yaml new file mode 100644 index 00000000..268d9b22 --- /dev/null +++ b/charts/operator-wandb/charts/yace/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "yace.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "yace.labels" . | nindent 4 }} + {{- include "yace.commonLabels" . | nindent 4 }} + {{- if .Values.service.labels -}} + {{- toYaml .Values.service.labels | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.service.annotations -}} + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 5000 + protocol: TCP + name: yace + selector: + {{- include "yace.labels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/yace/templates/serviceaccount.yaml b/charts/operator-wandb/charts/yace/templates/serviceaccount.yaml new file mode 100644 index 00000000..69eddbba --- /dev/null +++ b/charts/operator-wandb/charts/yace/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "yace.serviceAccountName" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "yace.commonLabels" . | nindent 4 }} + {{- include "yace.labels" . | nindent 4 }} + {{- if .Values.serviceAccount.labels -}} + {{- toYaml .Values.serviceAccount.labels | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.serviceAccount.annotations -}} + {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} + {{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/yace/values.yaml b/charts/operator-wandb/charts/yace/values.yaml new file mode 100644 index 00000000..e716a19c --- /dev/null +++ b/charts/operator-wandb/charts/yace/values.yaml @@ -0,0 +1,105 @@ +enabled: true + +nameOverride: "" +fullnameOverride: "" + +image: + registry: ghcr.io + repository: nerdswords/yet-another-cloudwatch-exporter + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: v0.60.0 + +# Tolerations for pod scheduling +tolerations: [] + +extraEnv: {} +extraEnvFrom: {} + + +config: |- + apiVersion: v1alpha1 + discovery: + jobs: + - type: AWS/ElastiCache + regions: + {{- range .Values.regions }} + - {{ . }} + {{- end }} + period: 60 + length: 60 + metrics: + - name: CPUUtilization + statistics: [Average] + - name: FreeableMemory + statistics: [Average] + - name: NetworkBytesIn + statistics: [Average] + - name: NetworkBytesOut + statistics: [Average] + - name: NetworkPacketsIn + statistics: [Average] + - name: NetworkPacketsOut + statistics: [Average] + - name: SwapUsage + statistics: [Average] + - name: CPUCreditUsage + statistics: [Average] + - type: AWS/RDS + regions: + {{- range .Values.regions }} + - {{ . }} + {{- end }} + period: 60 + length: 60 + metrics: + - name: CPUUtilization + statistics: [Maximum] + - name: DatabaseConnections + statistics: [Sum] + - name: FreeableMemory + statistics: [Average] + - name: FreeStorageSpace + statistics: [Average] + - name: ReadThroughput + statistics: [Average] + - name: WriteThroughput + statistics: [Average] + - name: ReadLatency + statistics: [Maximum] + - name: WriteLatency + statistics: [Maximum] + - name: ReadIOPS + statistics: [Average] + - name: WriteIOPS + statistics: [Average] +service: + type: ClusterIP + annotations: {} + +pod: + securityContext: + fsGroup: 0 + fsGroupChangePolicy: "OnRootMismatch" + labels: {} + +deployment: {} + +serviceAccount: + create: true + +common: + labels: {} + annotations: {} + +configMap: + labels: {} + annotations: {} + +resources: + requests: + cpu: 200m + memory: 200Mi + limits: + cpu: 500m + memory: 500Mi diff --git a/charts/operator-wandb/values.yaml b/charts/operator-wandb/values.yaml index a5687855..0bb71fbf 100644 --- a/charts/operator-wandb/values.yaml +++ b/charts/operator-wandb/values.yaml @@ -171,6 +171,15 @@ mysql: persistence: size: 20Gi storageClass: "" +yace: + install: true + regions: ["ap-south-1"] + pod: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "5000" + prometheus.io/path: "/metrics" + prometheus.io/scheme: http redis: install: true