diff --git a/.gitignore b/.gitignore index e8ec15a..4335ae1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ influxdb/manifests/*.tmp.yaml chronograf/manifests/*.tmp.yaml grafana/manifests/*.tmp.yaml rootfs/usr/bin/telegraf +charts/monitor/charts/*.tgz \ No newline at end of file diff --git a/charts/monitor/charts/grafana/templates/monitor-grafana-deployment.yaml b/charts/monitor/charts/grafana/templates/monitor-grafana-deployment.yaml index b61cf52..0ada235 100644 --- a/charts/monitor/charts/grafana/templates/monitor-grafana-deployment.yaml +++ b/charts/monitor/charts/grafana/templates/monitor-grafana-deployment.yaml @@ -59,8 +59,10 @@ spec: name: influxdb-creds key: password {{- else }} - - name: "INFLUXDB_URLS" - value: http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT) + # - name: "INFLUXDB_URLS" + # value: http://{{.Release.Name}}.influxdb.{{.Release.Namespace}}.svc.cluster.local:8086 + - name: DEIS_MONITOR_INFLUXAPI_SERVICE_HOST + value: {{.Release.Name}}-influxdb.{{.Release.Namespace}}.svc.cluster.local {{- end }} - name: "BIND_PORT" value: "3500" diff --git a/charts/monitor/charts/influxdb/Chart.yaml b/charts/monitor/charts/influxdb/Chart.yaml deleted file mode 100644 index a300431..0000000 --- a/charts/monitor/charts/influxdb/Chart.yaml +++ /dev/null @@ -1,7 +0,0 @@ -name: influxdb -home: https://github.com/deis/monitor/tree/master/influxdb -version: -description: Monitoring for Deis Workflow. -maintainers: - - name: Deis Team - email: engineering@deis.com diff --git a/charts/monitor/charts/influxdb/templates/monitor-influxdb-api-svc.yaml b/charts/monitor/charts/influxdb/templates/monitor-influxdb-api-svc.yaml deleted file mode 100644 index 0946bc0..0000000 --- a/charts/monitor/charts/influxdb/templates/monitor-influxdb-api-svc.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{- if eq .Values.global.influxdb_location "on-cluster" }} -apiVersion: v1 -kind: Service -metadata: - name: deis-monitor-influxapi - labels: - heritage: deis - app: deis-monitor-influxapi - router.deis.io/routable: "true" - annotations: - router.deis.io/domains: influxapi - router.deis.io/connectTimeout: "10" - router.deis.io/tcpTimeout: "1200" -spec: - ports: - - port: 80 - name: transport - targetPort: transport - selector: - app: deis-monitor-influxdb -{{- end }} diff --git a/charts/monitor/charts/influxdb/templates/monitor-influxdb-creds-secret.yaml b/charts/monitor/charts/influxdb/templates/monitor-influxdb-creds-secret.yaml deleted file mode 100644 index 6b7d914..0000000 --- a/charts/monitor/charts/influxdb/templates/monitor-influxdb-creds-secret.yaml +++ /dev/null @@ -1,14 +0,0 @@ -{{- if eq .Values.global.influxdb_location "off-cluster" }} -apiVersion: v1 -kind: Secret -metadata: - name: influxdb-creds - labels: - heritage: deis -type: Opaque -data: - url: {{ .Values.url | b64enc }} - database: {{ .Values.database | b64enc }} - user: {{ .Values.user | b64enc }} - password: {{ .Values.password | b64enc }} -{{- end }} diff --git a/charts/monitor/charts/influxdb/templates/monitor-influxdb-deployment.yaml b/charts/monitor/charts/influxdb/templates/monitor-influxdb-deployment.yaml deleted file mode 100644 index b5c5f6f..0000000 --- a/charts/monitor/charts/influxdb/templates/monitor-influxdb-deployment.yaml +++ /dev/null @@ -1,69 +0,0 @@ -{{- if eq .Values.global.influxdb_location "on-cluster" }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: deis-monitor-influxdb - labels: - heritage: deis - annotations: - component.deis.io/version: {{ .Values.docker_tag }} -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - app: deis-monitor-influxdb - template: - metadata: - labels: - app: deis-monitor-influxdb - spec: - containers: - - name: deis-monitor-influxdb - image: quay.io/{{.Values.org}}/influxdb:{{.Values.docker_tag}} - imagePullPolicy: {{.Values.pull_policy}} -{{- if or (.Values.limits_cpu) (.Values.limits_memory)}} - resources: - limits: -{{- if (.Values.limits_cpu) }} - cpu: {{.Values.limits_cpu}} -{{- end}} -{{- if (.Values.limits_memory) }} - memory: {{.Values.limits_memory}} -{{- end}} -{{- end}} - ports: - - containerPort: 8083 - name: admin - - containerPort: 8086 - name: transport - protocol: TCP - - containerPort: 8084 - name: ssltransport - protocol: TCP - livenessProbe: - httpGet: - path: /ping - port: 8086 - initialDelaySeconds: 1 - timeoutSeconds: 1 - readinessProbe: - httpGet: - path: /ping - port: 8086 - initialDelaySeconds: 1 - timeoutSeconds: 1 -{{- if .Values.persistence.enabled }} - volumeMounts: - - name: influxdb-data - mountPath: /data - # Allow user influxdb to write to /data - securityContext: - fsGroup: 1001 - volumes: - - name: influxdb-data - persistentVolumeClaim: - claimName: deis-monitor-influxdb -{{- end }} -{{- end }} diff --git a/charts/monitor/charts/influxdb/templates/monitor-influxdb-pvc.yaml b/charts/monitor/charts/influxdb/templates/monitor-influxdb-pvc.yaml deleted file mode 100644 index 22a8d1a..0000000 --- a/charts/monitor/charts/influxdb/templates/monitor-influxdb-pvc.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if .Values.persistence.enabled }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: deis-monitor-influxdb - labels: - heritage: deis - annotations: - {{- if .Values.persistence.storageClass }} - volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} - {{- else }} - volume.alpha.kubernetes.io/storage-class: default - {{- end }} -spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- end }} diff --git a/charts/monitor/charts/influxdb/templates/monitor-influxdb-ui-svc.yaml b/charts/monitor/charts/influxdb/templates/monitor-influxdb-ui-svc.yaml deleted file mode 100644 index 0b1c074..0000000 --- a/charts/monitor/charts/influxdb/templates/monitor-influxdb-ui-svc.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{- if eq .Values.global.influxdb_location "on-cluster" }} -apiVersion: v1 -kind: Service -metadata: - name: deis-monitor-influxui - labels: - heritage: deis - app: deis-monitor-influxui - router.deis.io/routable: "true" - annotations: - router.deis.io/domains: influx - router.deis.io/connectTimeout: "10" - router.deis.io/tcpTimeout: "1200" -spec: - ports: - - port: 80 - name: admin - targetPort: admin - selector: - app: deis-monitor-influxdb -{{- end }} diff --git a/charts/monitor/charts/telegraf/templates/monitor-telegraf-daemon.yaml b/charts/monitor/charts/telegraf/templates/monitor-telegraf-daemon.yaml index 4ea070b..5f60630 100644 --- a/charts/monitor/charts/telegraf/templates/monitor-telegraf-daemon.yaml +++ b/charts/monitor/charts/telegraf/templates/monitor-telegraf-daemon.yaml @@ -55,9 +55,9 @@ spec: key: password {{- else }} - name: "INFLUXDB_URLS" - value: "\"http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)\"" + value: "\"http://{{.Release.Name}}-influxdb.{{.Release.Namespace}}.svc.cluster.local:8086\"" - name: "INFLUXDB_INPUT_URLS" - value: "\"http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)/debug/vars\"" + value: "\"http://{{.Release.Name}}-influxdb.{{.Release.Namespace}}.svc.cluster.local:8086/debug/vars\"" - name: "ENABLE_INFLUXDB_INPUT" value: "true" {{- end }} diff --git a/charts/monitor/charts/telegraf/templates/monitor-telegraf-influxdb-creds-secret.yaml b/charts/monitor/charts/telegraf/templates/monitor-telegraf-influxdb-creds-secret.yaml new file mode 100644 index 0000000..9cbad43 --- /dev/null +++ b/charts/monitor/charts/telegraf/templates/monitor-telegraf-influxdb-creds-secret.yaml @@ -0,0 +1,14 @@ +{{- if eq .Values.global.influxdb_location "off-cluster" }} +apiVersion: v1 +kind: Secret +metadata: + name: influxdb-creds + labels: + heritage: deis +type: Opaque +data: + url: {{ .Values.influxdb.url | b64enc }} + database: {{ .Values.influxdb.database | b64enc }} + user: {{ .Values.influxdb.user | b64enc }} + password: {{ .Values.influxdb.password | b64enc }} +{{- end }} \ No newline at end of file diff --git a/charts/monitor/requirements.lock b/charts/monitor/requirements.lock new file mode 100644 index 0000000..9e490a7 --- /dev/null +++ b/charts/monitor/requirements.lock @@ -0,0 +1,9 @@ +dependencies: +- condition: "" + enabled: false + name: influxdb + repository: https://kubernetes-charts.storage.googleapis.com + tags: null + version: 0.4.0 +digest: sha256:d5acf72f0451f16fd80eebf9f7434f4a331d4a3e6cf3306e251ae604a7cd2797 +generated: 2017-03-23T14:34:11.693195309-04:00 diff --git a/charts/monitor/requirements.yaml b/charts/monitor/requirements.yaml new file mode 100644 index 0000000..5307953 --- /dev/null +++ b/charts/monitor/requirements.yaml @@ -0,0 +1,4 @@ + dependencies: + - name: influxdb + version: "0.4.0" + repository: https://kubernetes-charts.storage.googleapis.com \ No newline at end of file diff --git a/charts/monitor/templates/kill-pods.yaml b/charts/monitor/templates/kill-pods.yaml new file mode 100644 index 0000000..4c55cbe --- /dev/null +++ b/charts/monitor/templates/kill-pods.yaml @@ -0,0 +1,30 @@ +{{- if .Values.influxdb.persistence.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: kill-pods-{{ randAlphaNum 5 | lower }} + labels: + heritage: {{.Release.Service | quote }} + release: {{.Release.Name | quote }} + chart: {{.Chart.Name}} + annotations: + "helm.sh/hook": pre-upgrade + "helm.sh/hookWeight": "-10" +spec: + template: + metadata: + name: "{{.Release.Name}}" + labels: + heritage: {{.Release.Service | quote }} + release: {{.Release.Name | quote }} + chart: "{{.Chart.Name}}" + spec: + restartPolicy: Never + containers: + - name: kill-pods + image: "lachlanevenson/k8s-kubectl" + command: ["/bin/sh", "-c"] + args: ["(kubectl delete daemonset deis-monitor-telegraf || true) && \ + (kubectl delete deploy deis-monitor-influxdb || true) && \ + sleep 10"] +{{- end }} \ No newline at end of file diff --git a/charts/monitor/templates/migrate-data.yaml b/charts/monitor/templates/migrate-data.yaml new file mode 100644 index 0000000..8d42262 --- /dev/null +++ b/charts/monitor/templates/migrate-data.yaml @@ -0,0 +1,41 @@ +{{- if .Values.influxdb.persistence.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: migrate-data-{{ randAlphaNum 5 | lower }} + labels: + heritage: {{.Release.Service | quote }} + release: {{.Release.Name | quote }} + chart: {{.Chart.Name}} + annotations: + "helm.sh/hook": pre-upgrade + "helm.sh/hookWeight": "10" +spec: + template: + metadata: + name: "{{.Release.Name}}" + labels: + heritage: {{.Release.Service | quote }} + release: {{.Release.Name | quote }} + chart: "{{.Chart.Name}}" + spec: + restartPolicy: Never + containers: + - name: migrate-data + image: "lachlanevenson/k8s-kubectl" + command: ["/bin/sh", "-c"] + args: ["(echo Creating directories; \ + mkdir {{ .Values.influxdb.config.storage_directory }}/data || true) && \ + (echo Moving data from /db/wal; \ + mv {{ .Values.influxdb.config.storage_directory }}/db/wal {{ .Values.influxdb.config.storage_directory }} || true) && \ + (echo Moving data from /db/*; \ + mv {{ .Values.influxdb.config.storage_directory }}/db/* {{ .Values.influxdb.config.storage_directory }}/data; + rm -rf {{ .Values.influxdb.config.storage_directory }}/db || true)"] + volumeMounts: + - name: data + mountPath: {{ .Values.influxdb.config.storage_directory }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Values.influxdb.persistence.name }} +{{- end }} \ No newline at end of file diff --git a/charts/monitor/values.yaml b/charts/monitor/values.yaml index 135d524..75f116d 100644 --- a/charts/monitor/values.yaml +++ b/charts/monitor/values.yaml @@ -8,27 +8,26 @@ grafana: enabled: false accessMode: ReadWriteOnce size: 5Gi -influxdb: +telegraf: org: "deisci" pull_policy: "Always" docker_tag: canary # limits_cpu: "100m" # limits_memory: "50Mi" + +influxdb: + # Configure the following ONLY if using an off-cluster Influx database url: "my.influx.url" database: "kubernetes" user: "user" password: "password" + # Configure the following ONLY if you want persistence for on-cluster influxdb + # GCP PDs and EBS volumes are supported only persistence: - enabled: false - accessMode: ReadWriteOnce - size: 20Gi -telegraf: - org: "deisci" - pull_policy: "Always" - docker_tag: canary - # limits_cpu: "100m" - # limits_memory: "50Mi" - + enabled: true # Set to true to enable persistence + name: deis-monitor-influxdb + size: 20Gi # PVC size + global: # Set the location of Workflow's influxdb cluster # @@ -41,4 +40,4 @@ global: # Valid values are: # - on-cluster: Run Grafana within the Kubernetes cluster # - off-cluster: Grafana is running outside of the cluster - grafana_location: "on-cluster" + grafana_location: "on-cluster" \ No newline at end of file