diff --git a/charts/stable/blocky/.helmignore b/charts/stable/blocky/.helmignore index e559de0a..4379e2b3 100644 --- a/charts/stable/blocky/.helmignore +++ b/charts/stable/blocky/.helmignore @@ -22,3 +22,5 @@ .vscode/ # OWNERS file for Kubernetes OWNERS +# helm-docs templates +*.gotmpl diff --git a/charts/stable/blocky/Chart.yaml b/charts/stable/blocky/Chart.yaml index 8ef8b9cf..134145d3 100644 --- a/charts/stable/blocky/Chart.yaml +++ b/charts/stable/blocky/Chart.yaml @@ -1,16 +1,21 @@ apiVersion: v2 -appVersion: v0.12 +appVersion: v0.13 description: DNS proxy as ad-blocker for local network name: blocky -version: 5.0.2 +version: 6.0.0 +kubeVersion: ">=1.16.0-0" keywords: - - blocky - - adblock - - dns +- blocky +- adblock +- dns home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/blocky icon: https://github.com/0xERR0R/blocky/raw/master/docs/blocky.svg?sanitize=true sources: - - https://github.com/0xERR0R/blocky +- https://github.com/0xERR0R/blocky maintainers: - - name: billimek - email: jeff@billimek.com +- name: billimek + email: jeff@billimek.com +dependencies: +- name: common + repository: https://library-charts.k8s-at-home.com + version: 2.0.1 diff --git a/charts/stable/blocky/README.md b/charts/stable/blocky/README.md index 7d1ea0fd..a73a8923 100644 --- a/charts/stable/blocky/README.md +++ b/charts/stable/blocky/README.md @@ -1,6 +1,6 @@ # blocky -![Version: 5.0.2](https://img.shields.io/badge/Version-5.0.2-informational?style=flat-square) ![AppVersion: v0.12](https://img.shields.io/badge/AppVersion-v0.12-informational?style=flat-square) +![Version: 6.0.0](https://img.shields.io/badge/Version-6.0.0-informational?style=flat-square) ![AppVersion: v0.13](https://img.shields.io/badge/AppVersion-v0.13-informational?style=flat-square) DNS proxy as ad-blocker for local network @@ -12,10 +12,13 @@ DNS proxy as ad-blocker for local network ## Requirements +Kubernetes: `>=1.16.0-0` + ## Dependencies | Repository | Name | Version | |------------|------|---------| +| https://library-charts.k8s-at-home.com | common | 1.0.0 | ## TL;DR @@ -72,48 +75,20 @@ N/A | Key | Type | Default | Description | |-----|------|---------|-------------| -| affinity | object | `{}` | | -| config | string | `"upstream:\n # these external DNS resolvers will be used. Blocky picks 2 random resolvers from the list for each query\n # format for resolver: [net:]host:[port][/path]. net could be empty (default, shortcut for tcp+udp), tcp+udp, tcp, udp, tcp-tls or https (DoH). If port is empty, default port will be used (53 for udp and tcp, 853 for tcp-tls, 443 for https (Doh))\n externalResolvers:\n - 46.182.19.48\n - 80.241.218.68\n - tcp-tls:fdns1.dismail.de:853\n - https://dns.digitale-gesellschaft.ch/dns-query\n\n# optional: custom IP address for domain name (with all sub-domains)\n# example: query \"printer.lan\" or \"my.printer.lan\" will return 192.168.178.3\ncustomDNS:\n mapping:\n printer.lan: 192.168.178.3\n\n# optional: definition, which DNS resolver(s) should be used for queries to the domain (with all sub-domains). Multiple resolvers must be separated by comma\n# Example: Query client.fritz.box will ask DNS server 192.168.178.1. This is necessary for local network, to resolve clients by host name\nconditional:\n mapping:\n fritz.box: udp:192.168.178.1\n lan.net: udp:192.168.178.1,udp:192.168.178.2\n\n# optional: use black and white lists to block queries (for example ads, trackers, adult pages etc.)\nblocking:\n # definition of blacklist groups. Can be external link (http/https) or local file\n blackLists:\n ads:\n - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt\n - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts\n - https://mirror1.malwaredomains.com/files/justdomains\n - http://sysctl.org/cameleon/hosts\n - https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist\n - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt\n special:\n - https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts\n # definition of whitelist groups. Attention: if the same group has black and whitelists, whitelists will be used to disable particular blacklist entries. If a group has only whitelist entries -> this means only domains from this list are allowed, all other domains will be blocked\n whiteLists:\n ads:\n - whitelist.txt\n # definition: which groups should be applied for which client\n clientGroupsBlock:\n # default will be used, if no special definition for a client name exists\n default:\n - ads\n - special\n # use client name (with wildcard support: * - sequence of any characters, [0-9] - range)\n # or single ip address / client subnet as CIDR notation\n laptop*:\n - ads\n 192.168.178.1/24:\n - special\n # which response will be sent, if query is blocked:\n # zeroIp: 0.0.0.0 will be returned (default)\n # nxDomain: return NXDOMAIN as return code\n # comma separated list of destination IP adresses (for example: 192.100.100.15, 2001:0db8:85a3:08d3:1319:8a2e:0370:7344). Should contain ipv4 and ipv6 to cover all query types. Useful with running web server on this address to display the \"blocked\" page.\n blockType: zeroIp\n # optional: automatically list refresh period in minutes. Default: 4h.\n # Negative value -> deactivate automatically refresh.\n # 0 value -> use default\n refreshPeriod: 0\n\n# optional: configuration for caching of DNS responses\ncaching:\n # amount in minutes, how long a response must be cached (min value).\n # If <=0, use response's TTL, if >0 use this value, if TTL is smaller\n # Default: 0\n minTime: 5\n # amount in minutes, how long a response must be cached (max value).\n # If <0, do not cache responses\n # If 0, use TTL\n # If > 0, use this value, if TTL is greater\n # Default: 0\n maxTime: -1\n # if true, will preload DNS results for often used queries (names queried more than 5 times in a 2 hour time window)\n # this improves the response time for often used queries, but significantly increases external traffic\n # default: false\n prefetching: true\n\n# optional: configuration of client name resolution\nclientLookup:\n # optional: this DNS resolver will be used to perform reverse DNS lookup (typically local router)\n upstream: udp:192.168.178.1\n # optional: some routers return multiple names for client (host name and user defined name). Define which single name should be used.\n # Example: take second name if present, if not take first name\n singleNameOrder:\n - 2\n - 1\n # optional: custom mapping of client name to IP addresses. Useful if reverse DNS does not work properly or just to have custom client names.\n clients:\n laptop:\n - 192.168.178.29\n\n# optional: configuration for prometheus metrics endpoint\n# prometheus:\n# # enabled if true\n# enable: true\n# # url path, optional (default '/metrics')\n# path: /metrics\n\n# optional: write query information (question, answer, client, duration etc) to daily csv file\n# queryLog:\n# # directory (should be mounted as volume in docker)\n# dir: /logs\n# # if true, write one file per client. Writes all queries to single file otherwise\n# perClient: true\n# # if > 0, deletes log files which are older than ... days\n# logRetentionDays: 7\n\n# optional: DNS listener port and bind ip address, default 53 (UDP and TCP). Example: 53, :53, 127.0.0.1:53\nport: 53\n# optional: HTTP listener port, default 0 = no http listener. If > 0, will be used for prometheus metrics, pprof, REST API, DoH ...\nhttpPort: 4000\n# optional: HTTPS listener port, default 0 = no http listener. If > 0, will be used for prometheus metrics, pprof, REST API, DoH...\n#httpsPort: 443\n# mandatory, if https port > 0: path to cert and key file for SSL encryption\n#httpsCertFile: server.crt\n#httpsKeyFile: server.key\n# optional: use this DNS server to resolve blacklist urls and upstream DNS servers (DOH). Useful if no DNS resolver is configured and blocky needs to resolve a host name. Format net:IP:port, net must be udp or tcp\nbootstrapDns: tcp:1.1.1.1\n# optional: Log level (one from debug, info, warn, error). Default: info\nlogLevel: info\n# optional: Log format (text or json). Default: text\nlogFormat: text\n"` | | -| extraLists | object | `{}` | | -| fullnameOverride | string | `""` | | +| config | string | `"upstream:\n # these external DNS resolvers will be used. Blocky picks 2 random resolvers from the list for each query\n # format for resolver: [net:]host:[port][/path]. net could be empty (default, shortcut for tcp+udp), tcp+udp, tcp, udp, tcp-tls or https (DoH). If port is empty, default port will be used (53 for udp and tcp, 853 for tcp-tls, 443 for https (Doh))\n externalResolvers:\n - 46.182.19.48\n - 80.241.218.68\n - tcp-tls:fdns1.dismail.de:853\n - https://dns.digitale-gesellschaft.ch/dns-query\n\n# optional: custom IP address for domain name (with all sub-domains)\n# example: query \"printer.lan\" or \"my.printer.lan\" will return 192.168.178.3\ncustomDNS:\n mapping:\n printer.lan: 192.168.178.3\n\n# optional: definition, which DNS resolver(s) should be used for queries to the domain (with all sub-domains). Multiple resolvers must be separated by comma\n# Example: Query client.fritz.box will ask DNS server 192.168.178.1. This is necessary for local network, to resolve clients by host name\nconditional:\n mapping:\n fritz.box: udp:192.168.178.1\n lan.net: udp:192.168.178.1,udp:192.168.178.2\n\n# optional: use black and white lists to block queries (for example ads, trackers, adult pages etc.)\nblocking:\n # definition of blacklist groups. Can be external link (http/https) or local file\n blackLists:\n ads:\n - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt\n - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts\n - https://mirror1.malwaredomains.com/files/justdomains\n - http://sysctl.org/cameleon/hosts\n - https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist\n - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt\n special:\n - https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts\n # definition of whitelist groups. Attention: if the same group has black and whitelists, whitelists will be used to disable particular blacklist entries. If a group has only whitelist entries -> this means only domains from this list are allowed, all other domains will be blocked\n whiteLists:\n ads:\n - whitelist.txt\n # definition: which groups should be applied for which client\n clientGroupsBlock:\n # default will be used, if no special definition for a client name exists\n default:\n - ads\n - special\n # use client name (with wildcard support: * - sequence of any characters, [0-9] - range)\n # or single ip address / client subnet as CIDR notation\n laptop*:\n - ads\n 192.168.178.1/24:\n - special\n # which response will be sent, if query is blocked:\n # zeroIp: 0.0.0.0 will be returned (default)\n # nxDomain: return NXDOMAIN as return code\n # comma separated list of destination IP adresses (for example: 192.100.100.15, 2001:0db8:85a3:08d3:1319:8a2e:0370:7344). Should contain ipv4 and ipv6 to cover all query types. Useful with running web server on this address to display the \"blocked\" page.\n blockType: zeroIp\n # optional: automatically list refresh period in minutes. Default: 4h.\n # Negative value -> deactivate automatically refresh.\n # 0 value -> use default\n refreshPeriod: 0\n\n# optional: configuration for caching of DNS responses\ncaching:\n # amount in minutes, how long a response must be cached (min value).\n # If <=0, use response's TTL, if >0 use this value, if TTL is smaller\n # Default: 0\n minTime: 5\n # amount in minutes, how long a response must be cached (max value).\n # If <0, do not cache responses\n # If 0, use TTL\n # If > 0, use this value, if TTL is greater\n # Default: 0\n maxTime: -1\n # if true, will preload DNS results for often used queries (names queried more than 5 times in a 2 hour time window)\n # this improves the response time for often used queries, but significantly increases external traffic\n # default: false\n prefetching: true\n\n# optional: configuration of client name resolution\nclientLookup:\n # optional: this DNS resolver will be used to perform reverse DNS lookup (typically local router)\n upstream: udp:192.168.178.1\n # optional: some routers return multiple names for client (host name and user defined name). Define which single name should be used.\n # Example: take second name if present, if not take first name\n singleNameOrder:\n - 2\n - 1\n # optional: custom mapping of client name to IP addresses. Useful if reverse DNS does not work properly or just to have custom client names.\n clients:\n laptop:\n - 192.168.178.29\n\n# optional: configuration for prometheus metrics endpoint\n# prometheus:\n# # enabled if true\n# enable: true\n# # url path, optional (default '/metrics')\n# path: /metrics\n\n# optional: write query information (question, answer, client, duration etc) to daily csv file\n# queryLog:\n# # directory (should be mounted as volume in docker)\n# dir: /logs\n# # if true, write one file per client. Writes all queries to single file otherwise\n# perClient: true\n# # if > 0, deletes log files which are older than ... days\n# logRetentionDays: 7\n\n# optional: DNS listener port and bind ip address, default 53 (UDP and TCP). Example: 53, :53, 127.0.0.1:53\nport: 53\n# optional: HTTP listener port, default 0 = no http listener. If > 0, will be used for prometheus metrics, pprof, REST API, DoH ...\nhttpPort: 4000\n# optional: HTTPS listener port, default 0 = no http listener. If > 0, will be used for prometheus metrics, pprof, REST API, DoH...\n#httpsPort: 443\n# mandatory, if https port > 0: path to cert and key file for SSL encryption\n#httpsCertFile: server.crt\n#httpsKeyFile: server.key\n# optional: use this DNS server to resolve blacklist urls and upstream DNS servers (DOH). Useful if no DNS resolver is configured and blocky needs to resolve a host name. Format net:IP:port, net must be udp or tcp\nbootstrapDns: tcp:1.1.1.1\n# optional: Log level (one from debug, info, warn, error). Default: info\nlogLevel: info\n# optional: Log format (text or json). Default: text\nlogFormat: text"` | | +| env | object | `{}` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"spx01/blocky"` | | -| image.tag | string | `"v0.12"` | | -| nameOverride | string | `""` | | -| nodeSelector | object | `{}` | | -| persistence.accessModes[0] | string | `"ReadWriteOnce"` | | -| persistence.enabled | bool | `false` | | -| persistence.finalizers[0] | string | `"kubernetes.io/pvc-protection"` | | -| persistence.size | string | `"10Gi"` | | -| podAnnotations."prometheus.io/port" | string | `"api"` | | -| podAnnotations."prometheus.io/scrape" | string | `"true"` | | -| probes.liveness.failureThreshold | int | `5` | | -| probes.liveness.periodSeconds | int | `10` | | -| probes.readiness.failureThreshold | int | `5` | | -| probes.readiness.periodSeconds | int | `10` | | -| probes.startup.failureThreshold | int | `30` | | -| probes.startup.initialDelaySeconds | int | `5` | | -| probes.startup.periodSeconds | int | `10` | | -| replicas | int | `1` | | -| resources | object | `{}` | | -| service.annotations | object | `{}` | | -| service.type | string | `"ClusterIP"` | | -| serviceMonitor.additionalLabels | object | `{}` | | -| serviceMonitor.enabled | bool | `false` | | -| serviceTCP.annotations | object | `{}` | | -| serviceTCP.enabled | bool | `false` | | -| serviceTCP.externalIPs | list | `[]` | | -| serviceTCP.externalTrafficPolicy | string | `"Local"` | | -| serviceTCP.loadBalancerIP | string | `""` | | -| serviceTCP.type | string | `"NodePort"` | | -| serviceUDP.annotations | object | `{}` | | -| serviceUDP.enabled | bool | `true` | | -| serviceUDP.externalIPs | list | `[]` | | -| serviceUDP.externalTrafficPolicy | string | `"Local"` | | -| serviceUDP.loadBalancerIP | string | `""` | | -| serviceUDP.type | string | `"NodePort"` | | -| timeZone | string | `"UTC"` | | -| tolerations | list | `[]` | | +| image.tag | string | `"v0.13"` | | +| persistence.logs.emptyDir | bool | `false` | | +| persistence.logs.enabled | bool | `false` | | +| persistence.logs.mountPath | string | `"/logs"` | | +| prometheus.serviceMonitor.additionalLabels | object | `{}` | | +| prometheus.serviceMonitor.enabled | bool | `false` | | +| prometheus.serviceMonitor.interval | string | `"30s"` | | +| replicas | int | `1` | (int) Number of pods to load balance between | +| service.port.port | int | `4000` | | +| strategy.type | string | `"Recreate"` | | ## Changelog @@ -121,7 +96,7 @@ All notable changes to this application Helm chart will be documented in this fi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -### [5.0.1] +### [6.0.0] #### Added @@ -129,14 +104,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Changed -- configuration inside `config` is no longer a yaml object, it is now a multiline string -- moved to helm-docs +- **BREAKING** Migrate Blocky to the common library, a lot of configuration has changed. #### Removed - N/A -[5.0.1]: #5.0.1 +[6.0.0]: #6.0.0 ## Support diff --git a/charts/stable/blocky/README_CHANGELOG.md.gotmpl b/charts/stable/blocky/README_CHANGELOG.md.gotmpl index ccf45c83..8773f83f 100644 --- a/charts/stable/blocky/README_CHANGELOG.md.gotmpl +++ b/charts/stable/blocky/README_CHANGELOG.md.gotmpl @@ -9,7 +9,7 @@ All notable changes to this application Helm chart will be documented in this fi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -### [5.0.1] +### [6.0.0] #### Added @@ -17,12 +17,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Changed -- configuration inside `config` is no longer a yaml object, it is now a multiline string -- moved to helm-docs +- **BREAKING** Migrate Blocky to the common library, a lot of configuration has changed. #### Removed - N/A -[5.0.1]: #5.0.1 +[6.0.0]: #6.0.0 {{- end -}} diff --git a/charts/stable/blocky/templates/NOTES.txt b/charts/stable/blocky/templates/NOTES.txt index 1a17a0cd..90f7b653 100644 --- a/charts/stable/blocky/templates/NOTES.txt +++ b/charts/stable/blocky/templates/NOTES.txt @@ -1,15 +1 @@ -1. Get the application URL by running these commands: -{{- if contains "NodePort" .Values.serviceUDP.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "blocky.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.serviceUDP.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 svc -w {{ include "blocky.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "blocky.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.serviceUDP.port }} -{{- else if contains "ClusterIP" .Values.serviceUDP.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "blocky.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 }} +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/stable/blocky/templates/_helpers.tpl b/charts/stable/blocky/templates/_helpers.tpl deleted file mode 100644 index 985ff9ea..00000000 --- a/charts/stable/blocky/templates/_helpers.tpl +++ /dev/null @@ -1,41 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "blocky.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 "blocky.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 a default fully qualified postgresql name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}} -{{- define "blocky.postgresql.fullname" -}} -{{- $name := default "postgresql" .Values.postgresql.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "blocky.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/charts/stable/blocky/templates/common.yaml b/charts/stable/blocky/templates/common.yaml new file mode 100644 index 00000000..fc0c9013 --- /dev/null +++ b/charts/stable/blocky/templates/common.yaml @@ -0,0 +1,31 @@ +{{/* Make sure all variables are set properly */}} +{{- include "common.values.setup" . }} + +{{/* Append the configMap to the additionalVolumes */}} +{{- define "blocky.configmap.volume" -}} +name: blocky-config +configMap: + name: {{ template "common.names.fullname" . }}-config +{{- end -}} + +{{- $volume := include "blocky.configmap.volume" . | fromYaml -}} +{{- if $volume -}} + {{- $additionalVolumes := append .Values.additionalVolumes $volume }} + {{- $_ := set .Values "additionalVolumes" (deepCopy $additionalVolumes) -}} +{{- end -}} + +{{/* Append the configMap volume to the additionalVolumeMounts */}} +{{- define "blocky.configmap.volumeMount" -}} +name: blocky-config +mountPath: /app/config.yml +subPath: config.yml +{{- end -}} + +{{- $volumeMount := include "blocky.configmap.volumeMount" . | fromYaml -}} +{{- if $volumeMount -}} + {{- $additionalVolumeMounts := append .Values.additionalVolumeMounts $volumeMount }} + {{- $_ := set .Values "additionalVolumeMounts" (deepCopy $additionalVolumeMounts) -}} +{{- end -}} + +{{/* Render the templates */}} +{{ include "common.all" . }} diff --git a/charts/stable/blocky/templates/configmap.yaml b/charts/stable/blocky/templates/configmap.yaml index c4df7086..42f31c82 100644 --- a/charts/stable/blocky/templates/configmap.yaml +++ b/charts/stable/blocky/templates/configmap.yaml @@ -1,13 +1,9 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "blocky.fullname" . }} - namespace: {{ .Release.Namespace }} + name: {{ template "common.names.fullname" . }}-config labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - helm.sh/chart: {{ include "blocky.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "common.labels" . | nindent 4 }} data: config.yml: | {{ .Values.config | indent 4 }} diff --git a/charts/stable/blocky/templates/deployment.yaml b/charts/stable/blocky/templates/deployment.yaml deleted file mode 100644 index a5789d48..00000000 --- a/charts/stable/blocky/templates/deployment.yaml +++ /dev/null @@ -1,120 +0,0 @@ -{{- $blockyConfig := .Values.config | fromYaml }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "blocky.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - helm.sh/chart: {{ include "blocky.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - replicas: {{ .Values.replicas }} - revisionHistoryLimit: 3 - selector: - matchLabels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - annotations: - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- with .Values.podAnnotations }} - {{ toYaml . | nindent 8 }} - {{- end }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - env: - {{- if .Values.timeZone }} - - name: TZ - value: {{ .Values.timeZone | quote }} - {{- end }} - volumeMounts: - - name: config - mountPath: /app/config.yml - subPath: config.yml - readOnly: true - {{- range $name, $value := .Values.extraLists }} - - name: config - mountPath: /app/{{ $name }} - subPath: {{ $name }} - readOnly: true - {{- end }} - {{- if hasKey $blockyConfig "queryLog" }} - - name: data - mountPath: {{ $blockyConfig.queryLog.dir }} - {{- if .Values.persistence.subPath }} - subPath: {{ .Values.persistence.subPath }} - {{- end }} - {{- end }} - ports: - - name: api - containerPort: 4000 - - name: dns - containerPort: 53 - protocol: TCP - - name: dns-udp - containerPort: 53 - protocol: UDP - livenessProbe: - httpGet: - path: / - port: api - failureThreshold: {{ .Values.probes.liveness.failureThreshold }} - periodSeconds: {{ .Values.probes.liveness.periodSeconds }} - readinessProbe: - httpGet: - path: / - port: api - failureThreshold: {{ .Values.probes.readiness.failureThreshold }} - periodSeconds: {{ .Values.probes.readiness.periodSeconds }} - startupProbe: - httpGet: - path: / - port: api - initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }} - failureThreshold: {{ .Values.probes.startup.failureThreshold }} - periodSeconds: {{ .Values.probes.startup.periodSeconds }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: config - projected: - defaultMode: 0444 - sources: - - configMap: - name: {{ template "blocky.fullname" . }} - items: - - key: config.yml - path: config.yml - {{- range $name, $value := .Values.extraLists }} - - key: {{ $name }} - path: {{ $name }} - {{- end }} - {{- if hasKey $blockyConfig "queryLog" }} - - name: data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "blocky.fullname" . }}{{- end }} - {{- else }} - emptyDir: {} - {{- end }} - {{- end }} - {{- 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/charts/stable/blocky/templates/persistentvolumeclaim.yaml b/charts/stable/blocky/templates/persistentvolumeclaim.yaml deleted file mode 100644 index b7dd55e7..00000000 --- a/charts/stable/blocky/templates/persistentvolumeclaim.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ include "blocky.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - helm.sh/chart: {{ include "blocky.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - {{- with .Values.persistence.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.persistence.finalizers }} - finalizers: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - accessModes: - {{- toYaml .Values.persistence.accessModes | nindent 4 }} - {{- if .Values.persistence.storageClassName }} - storageClassName: {{ .Values.persistence.storageClassName }} - {{- end }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} - {{- with .Values.persistence.selectorLabels }} - selector: - matchLabels: - {{- toYaml . | nindent 6 }} - {{- end }} -{{- end -}} diff --git a/charts/stable/blocky/templates/service-tcp.yaml b/charts/stable/blocky/templates/service-tcp.yaml deleted file mode 100644 index 84d64093..00000000 --- a/charts/stable/blocky/templates/service-tcp.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- if .Values.serviceTCP.enabled }} -apiVersion: v1 -kind: Service -metadata: - name: {{ include "blocky.fullname" . }}-tcp - labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - helm.sh/chart: {{ include "blocky.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.serviceTCP.annotations }} - annotations: -{{ toYaml .Values.serviceTCP.annotations | indent 4 }} -{{- end }} -spec: - type: {{ .Values.serviceTCP.type }} - {{- if .Values.serviceTCP.loadBalancerIP }} - loadBalancerIP: {{ .Values.serviceTCP.loadBalancerIP }} - {{- end }} -{{- if .Values.serviceTCP.externalIPs }} - externalIPs: -{{ toYaml .Values.serviceTCP.externalIPs | indent 4 }} -{{- end }} - externalTrafficPolicy: {{ .Values.serviceTCP.externalTrafficPolicy }} - ports: - - port: 53 - targetPort: dns - protocol: TCP - name: dns - selector: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - diff --git a/charts/stable/blocky/templates/service-udp.yaml b/charts/stable/blocky/templates/service-udp.yaml deleted file mode 100644 index bf5a0a61..00000000 --- a/charts/stable/blocky/templates/service-udp.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{- if .Values.serviceUDP.enabled }} -apiVersion: v1 -kind: Service -metadata: - name: {{ include "blocky.fullname" . }}-udp - labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - helm.sh/chart: {{ include "blocky.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.serviceUDP.annotations }} - annotations: -{{ toYaml .Values.serviceUDP.annotations | indent 4 }} -{{- end }} -spec: - type: {{ .Values.serviceUDP.type }} - {{- if .Values.serviceUDP.loadBalancerIP }} - loadBalancerIP: {{ .Values.serviceUDP.loadBalancerIP }} - {{- end }} -{{- if .Values.serviceUDP.externalIPs }} - externalIPs: -{{ toYaml .Values.serviceUDP.externalIPs | indent 4 }} -{{- end }} - externalTrafficPolicy: {{ .Values.serviceUDP.externalTrafficPolicy }} - ports: - - port: 53 - targetPort: dns-udp - protocol: UDP - name: dns-udp - selector: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} diff --git a/charts/stable/blocky/templates/service.yaml b/charts/stable/blocky/templates/service.yaml deleted file mode 100644 index a2abcbd3..00000000 --- a/charts/stable/blocky/templates/service.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "blocky.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - helm.sh/chart: {{ include "blocky.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.service.annotations }} - annotations: -{{ toYaml .Values.service.annotations | indent 4 }} -{{- end }} -spec: -{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }} - type: ClusterIP - {{- if .Values.service.clusterIP }} - clusterIP: {{ .Values.service.clusterIP }} - {{end}} -{{- else if eq .Values.service.type "LoadBalancer" }} - type: {{ .Values.service.type }} - {{- if .Values.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} - {{- end }} - {{- if .Values.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} - {{- end -}} -{{- else }} - type: {{ .Values.service.type }} -{{- end }} -{{- if .Values.service.externalIPs }} - externalIPs: -{{ toYaml .Values.service.externalIPs | indent 4 }} -{{- end }} - {{- if .Values.service.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} - {{- end }} - ports: - - name: api - port: 4000 - targetPort: api - selector: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/stable/blocky/templates/servicemonitor.yaml b/charts/stable/blocky/templates/servicemonitor.yaml index 82c553d2..5fdcf649 100644 --- a/charts/stable/blocky/templates/servicemonitor.yaml +++ b/charts/stable/blocky/templates/servicemonitor.yaml @@ -1,23 +1,21 @@ -{{- if .Values.serviceMonitor.enabled }} +{{- if .Values.prometheus.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ include "blocky.fullname" . }} + name: {{ template "common.names.fullname" . }} labels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "blocky.chart" . }} - {{- with .Values.serviceMonitor.additionalLabels }} + {{- include "common.labels" . | nindent 4 }} + {{- with .Values.prometheus.serviceMonitor.additionalLabels }} {{- toYaml . | nindent 4 }} - {{- end }} + {{- end }} spec: selector: matchLabels: - app.kubernetes.io/name: {{ include "blocky.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "common.labels.selectorLabels" . | nindent 6 }} endpoints: - - port: api - interval: 30s + - port: http + {{- with .Values.prometheus.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} path: /metrics {{- end }} diff --git a/charts/stable/blocky/values.yaml b/charts/stable/blocky/values.yaml index 67a32a36..b7cdf336 100644 --- a/charts/stable/blocky/values.yaml +++ b/charts/stable/blocky/values.yaml @@ -1,17 +1,77 @@ +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml +# + image: repository: spx01/blocky - tag: v0.12 + tag: v0.13 pullPolicy: IfNotPresent -nameOverride: "" -fullnameOverride: "" +strategy: + type: Recreate +env: {} + # TZ: + +# -- (int) Number of pods to load balance between replicas: 1 -timeZone: "UTC" +service: + port: + port: 4000 + # additionalServices: + # - enabled: true + # nameSuffix: dns-tcp + # type: NodePort + # port: + # port: 53 + # name: dns-tcp + # protocol: TCP + # targetPort: 53 + # externalTrafficPolicy: Local + # - enabled: true + # nameSuffix: dns-udp + # type: NodePort + # port: + # port: 53 + # name: dns-udp + # protocol: UDP + # targetPort: 53 + # externalTrafficPolicy: Local -# Blocky configuration, for a full list of options see -# https://github.com/0xERR0R/blocky/blob/master/docs/config.yml +persistence: + logs: + enabled: false + emptyDir: false + mountPath: /logs + ## Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + # storageClass: "-" + # accessMode: ReadWriteOnce + # size: 1Gi + ## Do not delete the pvc upon helm uninstall + # skipuninstall: false + # existingClaim: "" + +prometheus: + serviceMonitor: + enabled: false + interval: 30s + additionalLabels: {} + +# podAnnotations: +# prometheus.io/scrape: "true" +# prometheus.io/port: "api" + +# -- Full list of options https://github.com/0xERR0R/blocky/blob/master/docs/config.yml +# @default -- see URL to default config config: | upstream: # these external DNS resolvers will be used. Blocky picks 2 random resolvers from the list for each query @@ -136,94 +196,3 @@ config: | logLevel: info # optional: Log format (text or json). Default: text logFormat: text - -## Add persistence for query logs (if enabled) -persistence: - enabled: false - # storageClassName: default - accessModes: - - ReadWriteOnce - size: 10Gi - # annotations: {} - finalizers: - - kubernetes.io/pvc-protection - # selectorLabels: {} - # subPath: "" - # existingClaim: - -# Probes configuration -probes: - liveness: - failureThreshold: 5 - periodSeconds: 10 - readiness: - failureThreshold: 5 - periodSeconds: 10 - startup: - initialDelaySeconds: 5 - failureThreshold: 30 - periodSeconds: 10 - -service: - type: ClusterIP - # externalTrafficPolicy: Local - # loadBalancerIP: "" - # a fixed LoadBalancer IP - annotations: {} - # metallb.universe.tf/address-pool: network-services - # metallb.universe.tf/allow-shared-ip: blocky-svc - -serviceTCP: - enabled: false - externalIPs: [] - type: NodePort - externalTrafficPolicy: Local - loadBalancerIP: "" - # a fixed LoadBalancer IP - annotations: {} - # metallb.universe.tf/address-pool: network-services - # metallb.universe.tf/allow-shared-ip: blocky-svc - -serviceUDP: - enabled: true - externalIPs: [] - type: NodePort - externalTrafficPolicy: Local - loadBalancerIP: "" - # a fixed LoadBalancer IP - annotations: {} - # metallb.universe.tf/address-pool: network-services - # metallb.universe.tf/allow-shared-ip: blocky-svc - -serviceMonitor: - enabled: false - additionalLabels: {} - -## Pod Annotations -podAnnotations: - prometheus.io/scrape: "true" - prometheus.io/port: "api" - -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: - # memory: 500Mi - # requests: - # cpu: 50m - # memory: 275Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -## Add any extra files you want populated to /app here, e.g.: -# extraLists: -# whitelist.txt: | -# analytics.google.com -# googleadservices.com -extraLists: {}