瀏覽代碼

Add netdata application

M. Rehan 3 年之前
父節點
當前提交
b6d687e2ae
共有 40 個文件被更改,包括 1194 次插入0 次删除
  1. 23 0
      charts/netdata/1.0.0/.helmignore
  2. 19 0
      charts/netdata/1.0.0/Chart.yaml
  3. 10 0
      charts/netdata/1.0.0/README.md
  4. 1 0
      charts/netdata/1.0.0/app-readme.md
  5. 二進制
      charts/netdata/1.0.0/charts/common-2112.0.0.tgz
  6. 6 0
      charts/netdata/1.0.0/ix_values.yaml
  7. 227 0
      charts/netdata/1.0.0/questions.yaml
  8. 6 0
      charts/netdata/1.0.0/requirements.lock
  9. 32 0
      charts/netdata/1.0.0/templates/_helpers.tpl
  10. 25 0
      charts/netdata/1.0.0/templates/clusterrole.yaml
  11. 17 0
      charts/netdata/1.0.0/templates/clusterrolebinding.yaml
  12. 90 0
      charts/netdata/1.0.0/templates/deployment.yaml
  13. 34 0
      charts/netdata/1.0.0/templates/pre-install-job.yaml
  14. 6 0
      charts/netdata/1.0.0/templates/service.yaml
  15. 9 0
      charts/netdata/1.0.0/templates/serviceaccount.yaml
  16. 21 0
      charts/netdata/1.0.0/templates/tests/deployment-check.yaml
  17. 42 0
      charts/netdata/1.0.0/test_values.yaml
  18. 3 0
      charts/netdata/item.yaml
  19. 1 0
      charts/netdata/upgrade_info.json
  20. 25 0
      charts/netdata/upgrade_strategy
  21. 23 0
      test/netdata/1.0.0/.helmignore
  22. 19 0
      test/netdata/1.0.0/Chart.yaml
  23. 10 0
      test/netdata/1.0.0/README.md
  24. 1 0
      test/netdata/1.0.0/app-readme.md
  25. 二進制
      test/netdata/1.0.0/charts/common-2112.0.0.tgz
  26. 6 0
      test/netdata/1.0.0/ix_values.yaml
  27. 227 0
      test/netdata/1.0.0/questions.yaml
  28. 6 0
      test/netdata/1.0.0/requirements.lock
  29. 32 0
      test/netdata/1.0.0/templates/_helpers.tpl
  30. 25 0
      test/netdata/1.0.0/templates/clusterrole.yaml
  31. 17 0
      test/netdata/1.0.0/templates/clusterrolebinding.yaml
  32. 90 0
      test/netdata/1.0.0/templates/deployment.yaml
  33. 34 0
      test/netdata/1.0.0/templates/pre-install-job.yaml
  34. 6 0
      test/netdata/1.0.0/templates/service.yaml
  35. 9 0
      test/netdata/1.0.0/templates/serviceaccount.yaml
  36. 21 0
      test/netdata/1.0.0/templates/tests/deployment-check.yaml
  37. 42 0
      test/netdata/1.0.0/test_values.yaml
  38. 3 0
      test/netdata/item.yaml
  39. 1 0
      test/netdata/upgrade_info.json
  40. 25 0
      test/netdata/upgrade_strategy

+ 23 - 0
charts/netdata/1.0.0/.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
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+# OWNERS file for Kubernetes
+OWNERS

+ 19 - 0
charts/netdata/1.0.0/Chart.yaml

@@ -0,0 +1,19 @@
+apiVersion: v1
+appVersion: 'v1.33.1'
+dependencies:
+- name: common
+  repository: file://../../../library/common/2112.0.0
+  version: 2112.0.0
+description: Real-time performance monitoring, done right!
+home: https://www.netdata.cloud/
+icon: https://netdata.github.io/helmchart/logo.png
+keywords:
+  - alerting
+  - metric
+  - monitoring
+name: netdata
+sources:
+  - https://github.com/netdata/helmchart
+  - https://github.com/netdata/netdata
+upstream_version: 3.7.12
+version: 1.0.0

+ 10 - 0
charts/netdata/1.0.0/README.md

@@ -0,0 +1,10 @@
+Netdata
+=====
+
+[Netdata](https://www.netdata.cloud/) is a fast, easy monitoring and troubleshooting system.
+
+
+Introduction
+------------
+
+This chart bootstraps Netdata deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

+ 1 - 0
charts/netdata/1.0.0/app-readme.md

@@ -0,0 +1 @@
+[Netdata](https://www.netdata.cloud/) is a fast, easy monitoring and troubleshooting system.

二進制
charts/netdata/1.0.0/charts/common-2112.0.0.tgz


+ 6 - 0
charts/netdata/1.0.0/ix_values.yaml

@@ -0,0 +1,6 @@
+image:
+  pullPolicy: IfNotPresent
+  repository: netdata/netdata
+  tag: v1.33.1
+runAsGroup: 201
+runAsUser: 201

+ 227 - 0
charts/netdata/1.0.0/questions.yaml

@@ -0,0 +1,227 @@
+groups:
+  - name: "Container Images"
+    description: "Image to be used for container"
+  - name: "Workload Configuration"
+    description: "Configure workload deployment"
+  - name: "Netdata Configuration"
+    description: "Configure Netdata credentials"
+  - name: "Storage"
+    description: "Configure Storage for Netdata"
+  - name: "Advanced DNS Settings"
+    description: "Configure DNS settings"
+
+portals:
+  web_portal:
+    protocols:
+      - "http"
+    host:
+      - "$node_ip"
+    ports:
+      - "$variable-service.nodePort"
+
+questions:
+  - variable: dnsConfig
+    label: "DNS Configuration"
+    group: "Advanced DNS Settings"
+    schema:
+      type: dict
+      attrs:
+        - variable: options
+          label: "DNS Options"
+          schema:
+            type: list
+            items:
+              - variable: optionsEntry
+                label: "Option Entry Configuration"
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: "Option Name"
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: "Option Value"
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: environmentVariables
+    label: "Netdata image environment"
+    group: "Netdata Configuration"
+    schema:
+      type: list
+      default: []
+      items:
+        - variable: environmentVariable
+          label: "Environment Variable"
+          schema:
+            type: dict
+            attrs:
+              - variable: name
+                label: "Name"
+                schema:
+                  type: string
+              - variable: value
+                label: "Value"
+                schema:
+                  type: string
+
+  - variable: service
+    description: "Netdata Service Configuration"
+    label: "Netdata Service Configuration"
+    group: "Netdata Configuration"
+    schema:
+      type: dict
+      required: true
+      attrs:
+        - variable: nodePort
+          label: "Node Port to use for Netdata UI"
+          schema:
+            type: int
+            min: 9000
+            max: 65535
+            default: 20489
+            required: true
+
+  - variable: appVolumeMounts
+    label: "Netdata Storage"
+    group: "Storage"
+    schema:
+      immutable: true
+      type: dict
+      attrs:
+        - variable: netdataconfig
+          label: "Configuration Volume"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Configuration Volume Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [ [ "hostPathEnabled", "=", false ] ]
+                  default: "ix-config"
+                  editable: false
+              - variable: mountPath
+                label: "Configuration Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/etc/netdata"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Netdata Configuration Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Netdata Configuration Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+                        immutable: true
+        - variable: netdatacache
+          label: "Cache Volume"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Cache Volume Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [["hostPathEnabled", "=", false]]
+                  default: "ix-cache"
+                  editable: false
+              - variable: mountPath
+                label: "Cache Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/var/cache/netdata"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Netdata Cache Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Netdata Cache Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+                        immutable: true
+        - variable: netdatalib
+          label: "Netdata Library Volume"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Netdata Library Volume Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [ [ "hostPathEnabled", "=", false ] ]
+                  default: "ix-lib"
+                  editable: false
+              - variable: mountPath
+                label: "Netdata Library Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/var/lib/netdata"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Netdata Library Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Netdata Library Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+                        immutable: true
+
+  - variable: extraAppVolumeMounts
+    label: "Extra Host Path Volumes"
+    group: "Storage"
+    schema:
+      type: list
+      items:
+        - variable: extraAppVolume
+          label: "Host Path Volume"
+          description: "Add an extra host path volume for Netdata application"
+          schema:
+            type: dict
+            attrs:
+              - variable: mountPath
+                label: "Mount Path in Pod"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  required: true
+              - variable: hostPath
+                label: "Host Path"
+                description: "Host path"
+                schema:
+                  type: hostpath
+                  required: true

+ 6 - 0
charts/netdata/1.0.0/requirements.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../library/common/2112.0.0
+  version: 2112.0.0
+digest: sha256:47115d9b91afe42c8537dcf0fd8224f2f7d1c775f9ff860efa68a6b57d17d1c0
+generated: "2021-12-06T21:24:36.62541+05:00"

+ 32 - 0
charts/netdata/1.0.0/templates/_helpers.tpl

@@ -0,0 +1,32 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "netdata.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 "netdata.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 "netdata.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}

+ 25 - 0
charts/netdata/1.0.0/templates/clusterrole.yaml

@@ -0,0 +1,25 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+  name: {{ template "netdata.fullname" . }}
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+rules:
+  - apiGroups: [""]
+    resources:
+      - "pods"        # used by sd, netdata (cgroup-name.sh, get-kubernetes-labels.sh)
+      - "services"    # used by sd
+      - "configmaps"  # used by sd
+      - "secrets"     # used by sd
+    verbs:
+      - "get"
+      - "list"
+      - "watch"
+  - apiGroups: [""]
+    resources:
+      - "namespaces"  # used by netdata (cgroup-name.sh, get-kubernetes-labels.sh)
+    verbs:
+      - "get"

+ 17 - 0
charts/netdata/1.0.0/templates/clusterrolebinding.yaml

@@ -0,0 +1,17 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+  name: {{ template "netdata.fullname" . }}
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: {{ template "netdata.fullname" . }}
+subjects:
+- kind: ServiceAccount
+  name: {{ .Release.Name }}
+  namespace: {{ .Release.Namespace }}

+ 90 - 0
charts/netdata/1.0.0/templates/deployment.yaml

@@ -0,0 +1,90 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ template "netdata.name" . }}
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+    role: parent
+spec:
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
+      annotations:
+        rollme: {{ randAlphaNum 5 | quote }}
+    spec:
+      securityContext:
+        fsGroup: 201
+      serviceAccountName: {{ .Release.Name }}
+      containers:
+        - name: {{ .Chart.Name }}
+          image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          env:
+            {{ $envList := (default list .Values.environmentVariables) }}
+            {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
+          ports:
+            - name: http
+              containerPort: 19999
+              protocol: TCP
+          livenessProbe:
+            httpGet:
+              path: /api/v1/info
+              port: http
+            failureThreshold: 3
+            periodSeconds: 30
+            successThreshold: 1
+            timeoutSeconds: 1
+          readinessProbe:
+            httpGet:
+              path: /api/v1/info
+              port: http
+            failureThreshold: 3
+            periodSeconds: 30
+            successThreshold: 1
+            timeoutSeconds: 1
+          volumeMounts:{{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
+            - name: os-release
+              mountPath: /host/etc/os-release
+              readOnly: true
+            - name: sys
+              mountPath: /host/sys
+              readOnly: true
+            - name: proc
+              mountPath: /host/proc
+              readOnly: true
+            - name: user
+              mountPath: /host/etc/passwd
+              readOnly: true
+            - name: group
+              mountPath: /host/etc/group
+              readOnly: true
+          securityContext:
+            capabilities:
+              add:
+                - SYS_PTRACE
+      terminationGracePeriodSeconds: 60
+      {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
+      volumes:{{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
+        - name: os-release
+          hostPath:
+            path: /etc/os-release
+        - name: proc
+          hostPath:
+            path: /proc
+        - name: sys
+          hostPath:
+            path: /sys
+        - name: user
+          hostPath:
+            path: /etc/passwd
+        - name: group
+          hostPath:
+            path: /etc/group

+ 34 - 0
charts/netdata/1.0.0/templates/pre-install-job.yaml

@@ -0,0 +1,34 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: "{{ template "common.names.fullname" . }}-preinstall-job"
+  labels:
+    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+    app.kubernetes.io/instance: {{ .Release.Name | quote }}
+    app.kubernetes.io/version: {{ .Chart.AppVersion }}
+    helm.sh/chart: {{ template "common.names.chart" . }}
+  annotations:
+    "helm.sh/hook": pre-install
+    "helm.sh/hook-delete-policy": hook-succeeded
+spec:
+  template:
+    metadata:
+      name: "{{ template "common.names.fullname" . }}-preinstall-hook"
+      labels:
+        app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+        app.kubernetes.io/instance: {{ .Release.Name | quote }}
+        helm.sh/chart: {{ template "common.names.chart" . }}
+    spec:
+      restartPolicy: Never
+      containers:
+      - name: pre-install-job
+        image: "alpine:latest"
+        command:
+          - chown
+          - -R
+          - {{ .Values.runAsUser }}:{{ .Values.runAsGroup }}
+          - {{ .Values.appVolumeMounts.netdatacache.mountPath }}
+          - {{ .Values.appVolumeMounts.netdatalib.mountPath }}
+          - {{ .Values.appVolumeMounts.netdataconfig.mountPath }}
+        volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
+      volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}

+ 6 - 0
charts/netdata/1.0.0/templates/service.yaml

@@ -0,0 +1,6 @@
+{{ $svc := .Values.service }}
+{{ $ports := list }}
+{{ $ports = mustAppend $ports (dict "name" "ui" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 19999) }}
+{{ $params := . }}
+{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
+{{ include "common.classes.service" $params }}

+ 9 - 0
charts/netdata/1.0.0/templates/serviceaccount.yaml

@@ -0,0 +1,9 @@
+kind: ServiceAccount
+apiVersion: v1
+metadata:
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  name: {{ .Release.Name }}

+ 21 - 0
charts/netdata/1.0.0/templates/tests/deployment-check.yaml

@@ -0,0 +1,21 @@
+{{- $serviceName := (include "common.names.fullname" .) -}}
+apiVersion: v1
+kind: Pod
+metadata:
+  name: "{{ .Release.Name }}-netdata-test"
+  labels:
+    app: {{ .Release.Name }}
+    release: {{ .Release.Name }}
+  annotations:
+    "helm.sh/hook": test
+spec:
+    containers:
+      - name: test-curl
+        image: alpine/curl
+        imagePullPolicy: "IfNotPresent"
+        command:
+          - /bin/sh
+          - -ec
+          - |
+            curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 15 --retry-max-time 90 --retry-all-errors -ksf http://{{ $serviceName }}:{{ .Values.service.nodePort }}/
+    restartPolicy: Never

+ 42 - 0
charts/netdata/1.0.0/test_values.yaml

@@ -0,0 +1,42 @@
+appVolumeMounts:
+  netdatacache:
+    emptyDir: true
+    mountPath: /var/cache/netdata
+  netdataconfig:
+    emptyDir: true
+    mountPath: /etc/netdata
+  netdatalib:
+    emptyDir: true
+    mountPath: /var/lib/netdata
+dnsConfig:
+  options: []
+environmentVariables: []
+extraAppVolumeMounts: []
+global:
+  ixChartContext:
+    isInstall: true
+    isUpdate: false
+    isUpgrade: false
+    operation: INSTALL
+    storageClassName: ix-storage-class-netdata
+    upgradeMetadata: {}
+image:
+  pullPolicy: IfNotPresent
+  repository: netdata/netdata
+  tag: v1.33.1
+ixCertificateAuthorities: {}
+ixCertificates: {}
+ixChartContext:
+  isInstall: true
+  isUpdate: false
+  isUpgrade: false
+  operation: INSTALL
+  storageClassName: ix-storage-class-netdata
+  upgradeMetadata: {}
+ixExternalInterfacesConfiguration: []
+ixExternalInterfacesConfigurationNames: []
+ixVolumes: []
+runAsGroup: 201
+runAsUser: 201
+service:
+  nodePort: 32189

+ 3 - 0
charts/netdata/item.yaml

@@ -0,0 +1,3 @@
+categories:
+  - reporting
+icon_url: https://netdata.github.io/helmchart/logo.png

+ 1 - 0
charts/netdata/upgrade_info.json

@@ -0,0 +1 @@
+{"filename":  "ix_values.yaml", "keys": ["image"], "test_filename": "test_values.yaml"}

+ 25 - 0
charts/netdata/upgrade_strategy

@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+import json
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+
+def newer_mapping(image_tags):
+    key = list(image_tags.keys())[0]
+    tags = {t.strip('v').replace('_', '.'): t for t in image_tags[key]}
+    version = semantic_versioning(tags)
+    if not version:
+        return {}
+
+    return {
+        'tags': {key: tags[version]},
+        'app_version': tags[version],
+    }
+
+
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        exit(1)
+
+    print(json.dumps(newer_mapping(json.loads(sys.argv[1]))))

+ 23 - 0
test/netdata/1.0.0/.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
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+# OWNERS file for Kubernetes
+OWNERS

+ 19 - 0
test/netdata/1.0.0/Chart.yaml

@@ -0,0 +1,19 @@
+apiVersion: v1
+appVersion: 'v1.33.1'
+dependencies:
+- name: common
+  repository: file://../../../library/common/2112.0.0
+  version: 2112.0.0
+description: Real-time performance monitoring, done right!
+home: https://www.netdata.cloud/
+icon: https://netdata.github.io/helmchart/logo.png
+keywords:
+  - alerting
+  - metric
+  - monitoring
+name: netdata
+sources:
+  - https://github.com/netdata/helmchart
+  - https://github.com/netdata/netdata
+upstream_version: 3.7.12
+version: 1.0.0

+ 10 - 0
test/netdata/1.0.0/README.md

@@ -0,0 +1,10 @@
+Netdata
+=====
+
+[Netdata](https://www.netdata.cloud/) is a fast, easy monitoring and troubleshooting system.
+
+
+Introduction
+------------
+
+This chart bootstraps Netdata deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

+ 1 - 0
test/netdata/1.0.0/app-readme.md

@@ -0,0 +1 @@
+[Netdata](https://www.netdata.cloud/) is a fast, easy monitoring and troubleshooting system.

二進制
test/netdata/1.0.0/charts/common-2112.0.0.tgz


+ 6 - 0
test/netdata/1.0.0/ix_values.yaml

@@ -0,0 +1,6 @@
+image:
+  pullPolicy: IfNotPresent
+  repository: netdata/netdata
+  tag: v1.33.1
+runAsGroup: 201
+runAsUser: 201

+ 227 - 0
test/netdata/1.0.0/questions.yaml

@@ -0,0 +1,227 @@
+groups:
+  - name: "Container Images"
+    description: "Image to be used for container"
+  - name: "Workload Configuration"
+    description: "Configure workload deployment"
+  - name: "Netdata Configuration"
+    description: "Configure Netdata credentials"
+  - name: "Storage"
+    description: "Configure Storage for Netdata"
+  - name: "Advanced DNS Settings"
+    description: "Configure DNS settings"
+
+portals:
+  web_portal:
+    protocols:
+      - "http"
+    host:
+      - "$node_ip"
+    ports:
+      - "$variable-service.nodePort"
+
+questions:
+  - variable: dnsConfig
+    label: "DNS Configuration"
+    group: "Advanced DNS Settings"
+    schema:
+      type: dict
+      attrs:
+        - variable: options
+          label: "DNS Options"
+          schema:
+            type: list
+            items:
+              - variable: optionsEntry
+                label: "Option Entry Configuration"
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: "Option Name"
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: "Option Value"
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: environmentVariables
+    label: "Netdata image environment"
+    group: "Netdata Configuration"
+    schema:
+      type: list
+      default: []
+      items:
+        - variable: environmentVariable
+          label: "Environment Variable"
+          schema:
+            type: dict
+            attrs:
+              - variable: name
+                label: "Name"
+                schema:
+                  type: string
+              - variable: value
+                label: "Value"
+                schema:
+                  type: string
+
+  - variable: service
+    description: "Netdata Service Configuration"
+    label: "Netdata Service Configuration"
+    group: "Netdata Configuration"
+    schema:
+      type: dict
+      required: true
+      attrs:
+        - variable: nodePort
+          label: "Node Port to use for Netdata UI"
+          schema:
+            type: int
+            min: 9000
+            max: 65535
+            default: 20489
+            required: true
+
+  - variable: appVolumeMounts
+    label: "Netdata Storage"
+    group: "Storage"
+    schema:
+      immutable: true
+      type: dict
+      attrs:
+        - variable: netdataconfig
+          label: "Configuration Volume"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Configuration Volume Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [ [ "hostPathEnabled", "=", false ] ]
+                  default: "ix-config"
+                  editable: false
+              - variable: mountPath
+                label: "Configuration Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/etc/netdata"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Netdata Configuration Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Netdata Configuration Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+                        immutable: true
+        - variable: netdatacache
+          label: "Cache Volume"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Cache Volume Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [["hostPathEnabled", "=", false]]
+                  default: "ix-cache"
+                  editable: false
+              - variable: mountPath
+                label: "Cache Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/var/cache/netdata"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Netdata Cache Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Netdata Cache Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+                        immutable: true
+        - variable: netdatalib
+          label: "Netdata Library Volume"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Netdata Library Volume Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [ [ "hostPathEnabled", "=", false ] ]
+                  default: "ix-lib"
+                  editable: false
+              - variable: mountPath
+                label: "Netdata Library Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/var/lib/netdata"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Netdata Library Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Netdata Library Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+                        immutable: true
+
+  - variable: extraAppVolumeMounts
+    label: "Extra Host Path Volumes"
+    group: "Storage"
+    schema:
+      type: list
+      items:
+        - variable: extraAppVolume
+          label: "Host Path Volume"
+          description: "Add an extra host path volume for Netdata application"
+          schema:
+            type: dict
+            attrs:
+              - variable: mountPath
+                label: "Mount Path in Pod"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  required: true
+              - variable: hostPath
+                label: "Host Path"
+                description: "Host path"
+                schema:
+                  type: hostpath
+                  required: true

+ 6 - 0
test/netdata/1.0.0/requirements.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../library/common/2112.0.0
+  version: 2112.0.0
+digest: sha256:47115d9b91afe42c8537dcf0fd8224f2f7d1c775f9ff860efa68a6b57d17d1c0
+generated: "2021-12-06T21:24:36.62541+05:00"

+ 32 - 0
test/netdata/1.0.0/templates/_helpers.tpl

@@ -0,0 +1,32 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "netdata.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 "netdata.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 "netdata.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}

+ 25 - 0
test/netdata/1.0.0/templates/clusterrole.yaml

@@ -0,0 +1,25 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+  name: {{ template "netdata.fullname" . }}
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+rules:
+  - apiGroups: [""]
+    resources:
+      - "pods"        # used by sd, netdata (cgroup-name.sh, get-kubernetes-labels.sh)
+      - "services"    # used by sd
+      - "configmaps"  # used by sd
+      - "secrets"     # used by sd
+    verbs:
+      - "get"
+      - "list"
+      - "watch"
+  - apiGroups: [""]
+    resources:
+      - "namespaces"  # used by netdata (cgroup-name.sh, get-kubernetes-labels.sh)
+    verbs:
+      - "get"

+ 17 - 0
test/netdata/1.0.0/templates/clusterrolebinding.yaml

@@ -0,0 +1,17 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+  name: {{ template "netdata.fullname" . }}
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: {{ template "netdata.fullname" . }}
+subjects:
+- kind: ServiceAccount
+  name: {{ .Release.Name }}
+  namespace: {{ .Release.Namespace }}

+ 90 - 0
test/netdata/1.0.0/templates/deployment.yaml

@@ -0,0 +1,90 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ template "netdata.name" . }}
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+    role: parent
+spec:
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
+      annotations:
+        rollme: {{ randAlphaNum 5 | quote }}
+    spec:
+      securityContext:
+        fsGroup: 201
+      serviceAccountName: {{ .Release.Name }}
+      containers:
+        - name: {{ .Chart.Name }}
+          image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          env:
+            {{ $envList := (default list .Values.environmentVariables) }}
+            {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
+          ports:
+            - name: http
+              containerPort: 19999
+              protocol: TCP
+          livenessProbe:
+            httpGet:
+              path: /api/v1/info
+              port: http
+            failureThreshold: 3
+            periodSeconds: 30
+            successThreshold: 1
+            timeoutSeconds: 1
+          readinessProbe:
+            httpGet:
+              path: /api/v1/info
+              port: http
+            failureThreshold: 3
+            periodSeconds: 30
+            successThreshold: 1
+            timeoutSeconds: 1
+          volumeMounts:{{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
+            - name: os-release
+              mountPath: /host/etc/os-release
+              readOnly: true
+            - name: sys
+              mountPath: /host/sys
+              readOnly: true
+            - name: proc
+              mountPath: /host/proc
+              readOnly: true
+            - name: user
+              mountPath: /host/etc/passwd
+              readOnly: true
+            - name: group
+              mountPath: /host/etc/group
+              readOnly: true
+          securityContext:
+            capabilities:
+              add:
+                - SYS_PTRACE
+      terminationGracePeriodSeconds: 60
+      {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
+      volumes:{{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
+        - name: os-release
+          hostPath:
+            path: /etc/os-release
+        - name: proc
+          hostPath:
+            path: /proc
+        - name: sys
+          hostPath:
+            path: /sys
+        - name: user
+          hostPath:
+            path: /etc/passwd
+        - name: group
+          hostPath:
+            path: /etc/group

+ 34 - 0
test/netdata/1.0.0/templates/pre-install-job.yaml

@@ -0,0 +1,34 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: "{{ template "common.names.fullname" . }}-preinstall-job"
+  labels:
+    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+    app.kubernetes.io/instance: {{ .Release.Name | quote }}
+    app.kubernetes.io/version: {{ .Chart.AppVersion }}
+    helm.sh/chart: {{ template "common.names.chart" . }}
+  annotations:
+    "helm.sh/hook": pre-install
+    "helm.sh/hook-delete-policy": hook-succeeded
+spec:
+  template:
+    metadata:
+      name: "{{ template "common.names.fullname" . }}-preinstall-hook"
+      labels:
+        app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+        app.kubernetes.io/instance: {{ .Release.Name | quote }}
+        helm.sh/chart: {{ template "common.names.chart" . }}
+    spec:
+      restartPolicy: Never
+      containers:
+      - name: pre-install-job
+        image: "alpine:latest"
+        command:
+          - chown
+          - -R
+          - {{ .Values.runAsUser }}:{{ .Values.runAsGroup }}
+          - {{ .Values.appVolumeMounts.netdatacache.mountPath }}
+          - {{ .Values.appVolumeMounts.netdatalib.mountPath }}
+          - {{ .Values.appVolumeMounts.netdataconfig.mountPath }}
+        volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
+      volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}

+ 6 - 0
test/netdata/1.0.0/templates/service.yaml

@@ -0,0 +1,6 @@
+{{ $svc := .Values.service }}
+{{ $ports := list }}
+{{ $ports = mustAppend $ports (dict "name" "ui" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 19999) }}
+{{ $params := . }}
+{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
+{{ include "common.classes.service" $params }}

+ 9 - 0
test/netdata/1.0.0/templates/serviceaccount.yaml

@@ -0,0 +1,9 @@
+kind: ServiceAccount
+apiVersion: v1
+metadata:
+  labels:
+    app: {{ template "netdata.name" . }}
+    chart: {{ template "netdata.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  name: {{ .Release.Name }}

+ 21 - 0
test/netdata/1.0.0/templates/tests/deployment-check.yaml

@@ -0,0 +1,21 @@
+{{- $serviceName := (include "common.names.fullname" .) -}}
+apiVersion: v1
+kind: Pod
+metadata:
+  name: "{{ .Release.Name }}-netdata-test"
+  labels:
+    app: {{ .Release.Name }}
+    release: {{ .Release.Name }}
+  annotations:
+    "helm.sh/hook": test
+spec:
+    containers:
+      - name: test-curl
+        image: alpine/curl
+        imagePullPolicy: "IfNotPresent"
+        command:
+          - /bin/sh
+          - -ec
+          - |
+            curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 15 --retry-max-time 90 --retry-all-errors -ksf http://{{ $serviceName }}:{{ .Values.service.nodePort }}/
+    restartPolicy: Never

+ 42 - 0
test/netdata/1.0.0/test_values.yaml

@@ -0,0 +1,42 @@
+appVolumeMounts:
+  netdatacache:
+    emptyDir: true
+    mountPath: /var/cache/netdata
+  netdataconfig:
+    emptyDir: true
+    mountPath: /etc/netdata
+  netdatalib:
+    emptyDir: true
+    mountPath: /var/lib/netdata
+dnsConfig:
+  options: []
+environmentVariables: []
+extraAppVolumeMounts: []
+global:
+  ixChartContext:
+    isInstall: true
+    isUpdate: false
+    isUpgrade: false
+    operation: INSTALL
+    storageClassName: ix-storage-class-netdata
+    upgradeMetadata: {}
+image:
+  pullPolicy: IfNotPresent
+  repository: netdata/netdata
+  tag: v1.33.1
+ixCertificateAuthorities: {}
+ixCertificates: {}
+ixChartContext:
+  isInstall: true
+  isUpdate: false
+  isUpgrade: false
+  operation: INSTALL
+  storageClassName: ix-storage-class-netdata
+  upgradeMetadata: {}
+ixExternalInterfacesConfiguration: []
+ixExternalInterfacesConfigurationNames: []
+ixVolumes: []
+runAsGroup: 201
+runAsUser: 201
+service:
+  nodePort: 32189

+ 3 - 0
test/netdata/item.yaml

@@ -0,0 +1,3 @@
+categories:
+  - reporting
+icon_url: https://netdata.github.io/helmchart/logo.png

+ 1 - 0
test/netdata/upgrade_info.json

@@ -0,0 +1 @@
+{"filename":  "ix_values.yaml", "keys": ["image"], "test_filename": "test_values.yaml"}

+ 25 - 0
test/netdata/upgrade_strategy

@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+import json
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+
+def newer_mapping(image_tags):
+    key = list(image_tags.keys())[0]
+    tags = {t.strip('v').replace('_', '.'): t for t in image_tags[key]}
+    version = semantic_versioning(tags)
+    if not version:
+        return {}
+
+    return {
+        'tags': {key: tags[version]},
+        'app_version': tags[version],
+    }
+
+
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        exit(1)
+
+    print(json.dumps(newer_mapping(json.loads(sys.argv[1]))))