Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion cloudprober/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,28 @@ metadata:
name: {{ include "cloudprober.fullname" . }}
data:
{{ .Values.configFileName }}.{{- .Values.configFormat }}: |
{{- .Values.config | nindent 4}}
{{- .Values.config | nindent 4 }}
{{- if eq .Values.configFormat "cfg" }}
{{- if .Values.builtinServers.http.enabled }}

server {
type: HTTP
http_server {
port: {{ .Values.builtinServers.http.port }}
}
}
Comment on lines +10 to +17
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I this this is going to be trouble. I'd stick with just adding additional services based on values.

{{- end }}
{{- if .Values.builtinServers.udp.enabled }}

server {
type: UDP
udp_server {
port: {{ .Values.builtinServers.udp.port }}
type: {{ .Values.builtinServers.udp.mode }}
}
}
{{- end }}
{{- end }}
{{ range .Values.additionalConfigs }}
{{.name }}: |
{{- .value | nindent 4}}
Expand Down
10 changes: 10 additions & 0 deletions cloudprober/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ spec:
- name: http
containerPort: 9313
protocol: TCP
{{- if .Values.builtinServers.http.enabled }}
- name: builtin-http
containerPort: {{ .Values.builtinServers.http.port }}
protocol: TCP
{{- end }}
{{- if .Values.builtinServers.udp.enabled }}
- name: builtin-udp
containerPort: {{ .Values.builtinServers.udp.port }}
protocol: UDP
{{- end }}
livenessProbe:
httpGet:
path: /health
Expand Down
21 changes: 21 additions & 0 deletions cloudprober/templates/service-builtin-http.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.builtinServers.http.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "cloudprober.fullname" . }}-builtin-http
labels:
{{- include "cloudprober.labels" . | nindent 4 }}
{{- with .Values.builtinServers.http.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.builtinServers.http.service.type }}
ports:
- port: {{ .Values.builtinServers.http.service.port }}
targetPort: builtin-http
protocol: TCP
name: builtin-http
selector:
{{- include "cloudprober.selectorLabels" . | nindent 4 }}
{{- end }}
21 changes: 21 additions & 0 deletions cloudprober/templates/service-builtin-udp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.builtinServers.udp.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "cloudprober.fullname" . }}-builtin-udp
labels:
{{- include "cloudprober.labels" . | nindent 4 }}
{{- with .Values.builtinServers.udp.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.builtinServers.udp.service.type }}
ports:
- port: {{ .Values.builtinServers.udp.service.port }}
targetPort: builtin-udp
protocol: UDP
name: builtin-udp
selector:
{{- include "cloudprober.selectorLabels" . | nindent 4 }}
{{- end }}
4 changes: 4 additions & 0 deletions cloudprober/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ metadata:
name: {{ include "cloudprober.fullname" . }}
labels:
{{- include "cloudprober.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
29 changes: 29 additions & 0 deletions cloudprober/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,35 @@ shareProcessNamespace: true
service:
type: ClusterIP
port: 8080
annotations: {}

# Built-in cloudprober servers (https://cloudprober.org/docs/how-to/built-in-servers/).
# When enabled, the chart appends a corresponding `server { ... }` block to
# the rendered cloudprober config, opens the container port on the pod, and
# creates a dedicated Kubernetes Service that exposes it.
#
# Note: automatic config injection only works with the default `cfg`
# (protobuf text) configFormat. If you are using `yaml`/`json`, declare the
# server blocks manually in `config` and just use this section to expose
# the ports.
builtinServers:
http:
enabled: false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just stick to adding services and trust user to add corresponding server stanzas.

Just call it additionalServices and you can say in the comment that it will be useful to expose cloudprober's built-in servers if configured.

port: 3141
service:
type: ClusterIP
port: 3141
annotations: {}
udp:
enabled: false
port: 31415
# UDP server mode: ECHO bounces packets back to the sender, DISCARD drops
# them silently.
mode: ECHO
service:
type: ClusterIP
port: 31415
annotations: {}

serviceMonitor:
enabled: true
Expand Down
Loading