Skip to content

Commit

Permalink
chore: Add features from vector-aggregator chart (#45)
Browse files Browse the repository at this point in the history
* feat(vector): Add dnsConfig and dnsPolicy support

Signed-off-by: Spencer Gilbert <[email protected]>

* feat(vector): Add support for an existing ConfigMap

Signed-off-by: Spencer Gilbert <[email protected]>

* feat(vector): Add support for termination period and management policy

Signed-off-by: Spencer Gilbert <[email protected]>

* feat(vector): Add PodMonitor and update default prometheus port name

Signed-off-by: Spencer Gilbert <[email protected]>

* chore(vector): Run helm-docs

Signed-off-by: Spencer Gilbert <[email protected]>

* feat(vector): Support existing ConfigMap for HAProxy

Signed-off-by: Spencer Gilbert <[email protected]>

* chore(vector): Rename vector ci files for better organization

Signed-off-by: Spencer Gilbert <[email protected]>

* fix(vector): Use full url and path in NOTES template

`top` fails without the base and path

Signed-off-by: Spencer Gilbert <[email protected]>

* chore(vector): Rename remaining vector ci files

Signed-off-by: Spencer Gilbert <[email protected]>
  • Loading branch information
spencergilbert authored Sep 14, 2021
1 parent 39f49e3 commit af3ad49
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 11 deletions.
12 changes: 12 additions & 0 deletions charts/vector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ helm install --name <RELEASE_NAME> \
| autoscaling.targetCPUUtilizationPercentage | int | `80` | Target CPU utilization for Vector's HPA |
| autoscaling.targetMemoryUtilizationPercentage | int | `nil` | Target memory utilization for Vector's HPA |
| customConfig | object | `{}` | Override Vector's default configs, if used **all** options need to be specified |
| dnsConfig | object | `{}` | Specify DNS configuration options for Vector Pods |
| dnsPolicy | string | `"ClusterFirst"` | Specify DNS policy for Vector Pods |
| env | list | `[]` | Set environment variables in Vector containers |
| existingConfigMap | string | `""` | Use existing ConfigMap for Vector's configuration instead of creating a new one |
| image.pullPolicy | string | `"IfNotPresent"` | Vector image pullPolicy |
| image.pullSecrets | list | `[]` | Agent repository pullSecret (ex: specify docker registry credentials) |
| image.repository | string | `"timberio/vector"` | Override default registry + name for Vector |
Expand All @@ -104,6 +107,13 @@ helm install --name <RELEASE_NAME> \
| persistence.size | string | `"10Gi"` | Specifies the size of PersistentVolumeClaims |
| podAnnotations | object | `{}` | Set annotations on Vector Pods |
| podLabels | object | `{}` | Set labels on Vector Pods |
| podManagementPolicy | string | `"OrderedReady"` | Specify the podManagementPolicy for the Aggregator role |
| podMonitor.enabled | bool | `false` | If true, create a PodMonitor for Vector |
| podMonitor.jobLabel | string | `"app.kubernetes.io/name"` | Override the label to retrieve the job name from |
| podMonitor.metricRelabelings | list | `[]` | MetricRelabelConfigs to apply to samples before ingestion |
| podMonitor.path | string | `"/metrics"` | Override the path to scrape |
| podMonitor.port | string | `"prom-exporter"` | Override the port to scrape |
| podMonitor.relabelings | list | `[]` | RelabelConfigs to apply to samples before scraping |
| podPriorityClassName | string | `""` | Set the priorityClassName on Vector Pods |
| podSecurityContext | object | `{}` | Allows you to overwrite the default PodSecurityContext for Vector |
| rbac.create | bool | `true` | If true, create and use RBAC resources |
Expand All @@ -122,6 +132,7 @@ helm install --name <RELEASE_NAME> \
| serviceAccount.automountToken | bool | `true` | Automount API credentials for the Vector ServiceAccount |
| serviceAccount.create | bool | `true` | If true, create ServiceAccount |
| serviceAccount.name | string | `nil` | The name of the ServiceAccount to use. |
| terminationGracePeriodSeconds | int | `60` | Override Vector's terminationGracePeriodSeconds |
| tolerations | list | `[]` | Allow Vector to schedule on tainted nodes |
| updateStrategy | object | `{}` | Customize the updateStrategy used to replace Vector Pods |

Expand All @@ -138,6 +149,7 @@ helm install --name <RELEASE_NAME> \
| haproxy.autoscaling.targetMemoryUtilizationPercentage | int | `nil` | Target memory utilization for HAProxy's HPA |
| haproxy.customConfig | string | `""` | Override HAProxy's default configs, if used **all** options need to be specified |
| haproxy.enabled | bool | `false` | If true, create a HAProxy load balancer |
| haproxy.existingConfigMap | string | `""` | Use existing ConfigMap for HAProxy's configuration instead of creating a new one |
| haproxy.image.pullPolicy | string | `"IfNotPresent"` | HAProxy image pullPolicy |
| haproxy.image.pullSecrets | list | `[]` | HAProxy repository pullSecret (ex: specify docker registry credentials) |
| haproxy.image.repository | string | `"haproxytech/haproxy-alpine"` | Override default registry + name for HAProxy |
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions charts/vector/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Vector is starting in your cluster. After a few minutes, you can use Vector's AP
{{- else if .Values.customConfig.api.enabled }}
Vector is starting in your cluster. After a few minutes, you can use Vector's API to view internal metrics by running:

kubectl -n {{ .Release.Namespace }} exec -it statefulset/{{ include "vector.fullname" . }} -- vector top --url {{ .Values.customConfig.api.address | default "http://127.0.0.1:8686/graphql" }}
kubectl -n {{ .Release.Namespace }} exec -it statefulset/{{ include "vector.fullname" . }} -- vector top --url {{ printf "http://%s/graphql" .Values.customConfig.api.address | default "http://127.0.0.1:8686/graphql" }}
{{- end }}
{{ else if (eq .Values.role "Stateless-Aggregator") }}
{{- if not .Values.customConfig }}
Expand All @@ -22,7 +22,7 @@ Vector is starting in your cluster. After a few minutes, you can use Vector's AP
{{- else if .Values.customConfig.api.enabled }}
Vector is starting in your cluster. After a few minutes, you can use Vector's API to view internal metrics by running:

kubectl -n {{ .Release.Namespace }} exec -it deployment/{{ include "vector.fullname" . }} -- vector top --url {{ .Values.customConfig.api.address | default "http://127.0.0.1:8686/graphql" }}
kubectl -n {{ .Release.Namespace }} exec -it deployment/{{ include "vector.fullname" . }} -- vector top --url {{ printf "http://%s/graphql" .Values.customConfig.api.address | default "http://127.0.0.1:8686/graphql" }}
{{- end }}
{{ else if (eq .Values.role "Agent") }}
{{- if not .Values.customConfig }}
Expand All @@ -32,6 +32,6 @@ Vector is starting in your cluster. After a few minutes, you can use Vector's AP
{{- else if .Values.customConfig.api.enabled }}
Vector is starting in your cluster. After a few minutes, you can use Vector's API to view internal metrics by running:

kubectl -n {{ .Release.Namespace }} exec -it daemonset/{{ include "vector.fullname" . }} -- vector top --url {{ .Values.customConfig.api.address | default "http://127.0.0.1:8686/graphql" }}
kubectl -n {{ .Release.Namespace }} exec -it daemonset/{{ include "vector.fullname" . }} -- vector top --url {{ printf "http://%s/graphql" .Values.customConfig.api.address | default "http://127.0.0.1:8686/graphql" }}
{{- end }}
{{- end }}
14 changes: 11 additions & 3 deletions charts/vector/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ securityContext:
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with .Values.dnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig:
{{ toYaml . | indent 2 }}
{{- end }}
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml . | indent 2 }}
Expand Down Expand Up @@ -73,11 +80,11 @@ containers:
- name: vector
containerPort: 6000
protocol: TCP
- name: prometheus
- name: prom-exporter
containerPort: 9090
protocol: TCP
{{- else if (eq .Values.role "Agent") }}
- name: prometheus
- name: prom-exporter
containerPort: 9090
protocol: TCP
{{- end }}
Expand Down Expand Up @@ -113,6 +120,7 @@ containers:
mountPath: "/host/sys"
readOnly: true
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 2 }}
Expand All @@ -138,7 +146,7 @@ volumes:
{{- end }}
- name: config
configMap:
name: {{ template "vector.fullname" . }}
name: {{ if .Values.existingConfigMap }}{{ .Values.existingConfigMap }}{{ else }}{{ template "vector.fullname" . }}{{ end }}
{{- if (eq .Values.role "Agent") }}
- name: data
hostPath:
Expand Down
2 changes: 2 additions & 0 deletions charts/vector/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.existingConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -84,3 +85,4 @@ data:
encoding:
codec: json
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/vector/templates/haproxy/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.haproxy.enabled }}
{{- if and .Values.haproxy.enabled (not .Values.existingConfigMap) }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/vector/templates/haproxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ spec:
volumes:
- name: haproxy-config
configMap:
name: {{ include "haproxy.fullname" . }}
name: {{ if .Values.haproxy.existingConfigMap }}{{ .Values.haproxy.existingConfigMap }}{{ else }}{{ template "haproxy.fullname" . }}{{ end }}
{{- with .Values.haproxy.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
27 changes: 27 additions & 0 deletions charts/vector/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if and .Values.podMonitor.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "vector.fullname" . }}
labels:
{{- include "vector.labels" . | nindent 4 }}
spec:
jobLabel: {{ .Values.podMonitor.jobLabel }}
selector:
matchLabels:
{{- include "vector.selectorLabels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- port: {{ .Values.podMonitor.port }}
path: {{ .Values.podMonitor.path }}
{{- with .Values.podMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/vector/templates/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- name: vector
port: 6000
protocol: TCP
- name: prometheus-exporter
- name: prom-exporter
port: 9090
protocol: TCP
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions charts/vector/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ spec:
- name: vector
port: 6000
protocol: TCP
- name: prometheus-exporter
- name: prom-exporter
port: 9090
protocol: TCP
{{- else if (eq .Values.role "Agent") }}
- name: prometheus-exporter
- name: prom-exporter
port: 9090
protocol: TCP
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions charts/vector/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
{{- include "vector.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
podManagementPolicy: {{ .Values.podManagementPolicy }}
selector:
matchLabels:
{{- include "vector.selectorLabels" . | nindent 6 }}
Expand Down
50 changes: 50 additions & 0 deletions charts/vector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ image:
## Valid for Aggregator and Stateless-Aggregator
replicas: 1

# podManagementPolicy -- Specify the podManagementPolicy for the Aggregator role
## Valid for Aggregator role
podManagementPolicy: OrderedReady

## Create a Secret resource for Vector to use
secrets:
# secrets.generic -- Each Key/Value will be added to the Secret's data key
Expand Down Expand Up @@ -125,6 +129,9 @@ updateStrategy: {}
# rollingUpdate:
# maxUnavailable: 1

# terminationGracePeriodSeconds -- Override Vector's terminationGracePeriodSeconds
terminationGracePeriodSeconds: 60

# nodeSelector -- Allow Vector to be scheduled on selected nodes
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
Expand All @@ -148,6 +155,10 @@ service:
# service.ports -- Override automated generation of Service ports
ports: []

# existingConfigMap -- Use existing ConfigMap for Vector's configuration instead of creating a new one
## If set, this parameter takes precedence over customConfig and the chart's default configs
existingConfigMap: ""

# customConfig -- Override Vector's default configs, if used **all** options need to be specified
## This section supports using helm templates to populate dynamic values
## Ref: https://vector.dev/docs/reference/configuration/
Expand Down Expand Up @@ -184,6 +195,23 @@ persistence:
## Valid for Agent role, persistence always used for Agent role
path: "/var/lib/vector"

# dnsPolicy -- Specify DNS policy for Vector Pods
## Ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
dnsPolicy: ClusterFirst

# dnsConfig -- Specify DNS configuration options for Vector Pods
## Ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
dnsConfig: {}
# nameservers:
# - 1.2.3.4
# searches:
# - ns1.svc.cluster-domain.example
# - my.dns.search.suffix
# options:
# - name: ndots
# value: "2"
# - name: edns0

# livenessProbe -- Override default liveness probe settings
## Requires Vector's API to be enabled
livenessProbe: {}
Expand All @@ -198,6 +226,24 @@ readinessProbe: {}
# path: /health
# port: api

## Configure a PodMonitor for Vector
## Requires the PodMonitor CRD to be installed
podMonitor:
# podMonitor.enabled -- If true, create a PodMonitor for Vector
enabled: false
# podMonitor.jobLabel -- Override the label to retrieve the job name from
jobLabel: app.kubernetes.io/name
# podMonitor.port -- Override the port to scrape
port: prom-exporter
# podMonitor.path -- Override the path to scrape
path: /metrics
# podMonitor.relabelings -- RelabelConfigs to apply to samples before scraping
## Ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
relabelings: []
# podMonitor.metricRelabelings -- MetricRelabelConfigs to apply to samples before ingestion
## Ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
metricRelabelings: []

## Optional built-in HAProxy load balancer
haproxy:
# haproxy.enabled -- If true, create a HAProxy load balancer
Expand Down Expand Up @@ -262,6 +308,10 @@ haproxy:
# haproxy.service.type -- Set type of HAProxy's Service
type: ClusterIP

# haproxy.existingConfigMap -- Use existing ConfigMap for HAProxy's configuration instead of creating a new one
## If set, this parameter takes precedence over customConfig and the chart's default configs
existingConfigMap: ""

# haproxy.customConfig -- Override HAProxy's default configs, if used **all** options need to be specified
## The chart will parse sources and sinks from customConfig to generate HAProxy config, this generated config
## can be overwritten with haproxy.customConfig
Expand Down

0 comments on commit af3ad49

Please sign in to comment.