Skip to content

Commit

Permalink
[nats helm] set probe scheme based on monitor tls (#806)
Browse files Browse the repository at this point in the history
Signed-off-by: Caleb Lloyd <[email protected]>
  • Loading branch information
caleblloyd authored Oct 2, 2023
1 parent df9671e commit 7fb4b2c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 12 additions & 1 deletion helm/charts/nats/files/stateful-set/nats-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ lifecycle:
- nats-server
- -sl=ldm=/var/run/nats/nats.pid

{{- if .Values.config.monitor.enabled }}
{{- with .Values.config.monitor }}
{{- if .enabled }}
startupProbe:
httpGet:
path: /healthz
port: monitor
{{- if .tls.enabled }}
scheme: HTTPS
{{- end}}
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 10
Expand All @@ -47,6 +51,9 @@ readinessProbe:
httpGet:
path: /healthz?js-server-only=true
port: monitor
{{- if .tls.enabled }}
scheme: HTTPS
{{- end}}
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 10
Expand All @@ -56,12 +63,16 @@ livenessProbe:
httpGet:
path: /healthz?js-enabled-only=true
port: monitor
{{- if .tls.enabled }}
scheme: HTTPS
{{- end}}
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 30
successThreshold: 1
failureThreshold: 3
{{- end }}
{{- end }}

volumeMounts:
# nats config
Expand Down
7 changes: 6 additions & 1 deletion helm/charts/nats/test/tls_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package test

import (
"testing"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"testing"
)

func TestConfigTls(t *testing.T) {
Expand Down Expand Up @@ -117,6 +118,10 @@ config:
})
}

expected.StatefulSet.Value.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS
expected.StatefulSet.Value.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS
expected.StatefulSet.Value.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS

expected.StatefulSet.Value.Spec.Template.Spec.Volumes = volumes
expected.StatefulSet.Value.Spec.Template.Spec.Containers[0].VolumeMounts = natsVm
expected.StatefulSet.Value.Spec.Template.Spec.Containers[1].VolumeMounts = reloaderVm
Expand Down

0 comments on commit 7fb4b2c

Please sign in to comment.