diff options
Diffstat (limited to 'vnfs/DAaaS')
9 files changed, 181 insertions, 46 deletions
diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/.helmignore b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/.helmignore @@ -0,0 +1,22 @@ +# 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 +.vscode/ diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/Chart.yaml b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/Chart.yaml new file mode 100644 index 00000000..1de42f01 --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: Helm chart for Prometheus to Kafka Writer +name: prom-kafka-writer +version: 0.1.0 diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/NOTES.txt b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/NOTES.txt new file mode 100644 index 00000000..757b139c --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "prom-kafka-writer.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "prom-kafka-writer.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "prom-kafka-writer.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "prom-kafka-writer.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/_helpers.tpl b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/_helpers.tpl new file mode 100644 index 00000000..1213110f --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "prom-kafka-writer.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 "prom-kafka-writer.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 "prom-kafka-writer.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/deployment.yaml b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/deployment.yaml new file mode 100644 index 00000000..a3b6be3e --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "prom-kafka-writer.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "prom-kafka-writer.name" . }} + helm.sh/chart: {{ include "prom-kafka-writer.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "prom-kafka-writer.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ include "prom-kafka-writer.name" . }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "prom-kafka-writer.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ include "prom-kafka-writer.name" . }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + env: + - name: PORT + value: {{ .Values.service.port | quote }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/service.yaml b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/service.yaml new file mode 100644 index 00000000..abc874a1 --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "prom-kafka-writer.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "prom-kafka-writer.name" . }} + helm.sh/chart: {{ include "prom-kafka-writer.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + {{- if ( and (eq .Values.service.type "NodePort" ) (not (empty .Values.service.nodePort)) ) }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "prom-kafka-writer.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ include "prom-kafka-writer.name" . }} diff --git a/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/values.yaml b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/values.yaml new file mode 100644 index 00000000..0c59b8aa --- /dev/null +++ b/vnfs/DAaaS/deploy/collection/charts/prom-kafka-writer/values.yaml @@ -0,0 +1,36 @@ +# Default values for prom-kafka-writer. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: dcr.cluster.local:32644/prom-kafka-writer + tag: latest + pullPolicy: IfNotPresent + +nameOverride: "" +fullnameOverride: "" + +service: + type: ClusterIP + port: 8686 + nodePort: 30086 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/vnfs/DAaaS/deploy/collection/charts/prometheus/templates/prometheus.yaml b/vnfs/DAaaS/deploy/collection/charts/prometheus/templates/prometheus.yaml index 862e8650..53494920 100644 --- a/vnfs/DAaaS/deploy/collection/charts/prometheus/templates/prometheus.yaml +++ b/vnfs/DAaaS/deploy/collection/charts/prometheus/templates/prometheus.yaml @@ -17,34 +17,3 @@ spec: - {{ .Release.Namespace | quote }} resources: {{ toYaml .Values.prometheus.resources | indent 4 }} - - # TODO: Templatizing multiple remote read/write. - # Especially Kafka adapater. - remoteRead: - - url: "{{ .Values.m3db.url }}/api/v1/prom/remote/read" - # To test reading even when local Prometheus has the data - readRecent: true - remoteWrite: - - url: "{{ .Values.m3db.url }}/api/v1/prom/remote/write" - # To differentiate between local and remote storage we will add a storage label - writeRelabelConfigs: - - targetLabel: metrics_storage - replacement: m3db_remote - - url: "{{ .Values.kafkaAdapter.url }}/receive" - containers: - - name: {{ template "prometheus.name" . }}-adapter - image: "{{ .Values.kafkaAdapter.image.repository }}:{{ .Values.kafkaAdapter.image.tag }}" - imagePullPolicy: {{ .Values.kafkaAdapter.image.pullPolicy }} - env: - - name: KAFKA_BROKER_LIST - value: {{ .Values.kafkaAdapter.broker }} - - name: KAFKA_TOPIC - value: {{ .Values.kafkaAdapter.topic }} - - name: SERIALIZATION_FORMAT - value: {{ .Values.kafkaAdapter.serializationFormat }} - - name: PORT - value: {{ quote .Values.kafkaAdapter.port }} - - name: LOG_LEVEL - value: {{ .Values.kafkaAdapter.logLevel }} - resources: -{{ toYaml .Values.kafkaAdapter.resources | indent 6 }} diff --git a/vnfs/DAaaS/deploy/collection/charts/prometheus/values.yaml b/vnfs/DAaaS/deploy/collection/charts/prometheus/values.yaml index c939af4b..e35c6735 100644 --- a/vnfs/DAaaS/deploy/collection/charts/prometheus/values.yaml +++ b/vnfs/DAaaS/deploy/collection/charts/prometheus/values.yaml @@ -67,18 +67,3 @@ prometheus: #type: NodePort sessionAffinity: "" -m3db: - url: http://m3coordinator-m3db.m3db-operator.svc.cluster.local:7201 - -kafkaAdapter: - image: - repository: telefonica/prometheus-kafka-adapter - tag: 1.2.0 - pullPolicy: IfNotPresent - url: http://localhost:8080 - port: 8080 - broker: my-cluster-kafka-bootstrap.msg.svc.cluster.local:9092 - topic: orders - serializationFormat: json - logLevel: debug - resources: {} |