fix: guard against missing healthcheck config

Also add support for liveness and readiness probes.
This commit is contained in:
Jose Diaz-Gonzalez
2024-01-24 02:39:39 -05:00
parent a64e9514ee
commit 1d99e0bc6e
3 changed files with 12 additions and 4 deletions

View File

@@ -115,7 +115,7 @@ type WaitForPodToExistInput struct {
LabelSelector string LabelSelector string
} }
func applyClusterIssuers(ctx context.Context, appName string) error { func applyClusterIssuers(ctx context.Context) error {
chartDir, err := os.MkdirTemp("", "cluster-issuer-chart-") chartDir, err := os.MkdirTemp("", "cluster-issuer-chart-")
if err != nil { if err != nil {
return fmt.Errorf("Error creating cluster-issuer chart directory: %w", err) return fmt.Errorf("Error creating cluster-issuer chart directory: %w", err)
@@ -126,7 +126,7 @@ func applyClusterIssuers(ctx context.Context, appName string) error {
chart := &Chart{ chart := &Chart{
ApiVersion: "v2", ApiVersion: "v2",
AppVersion: "1.0.0", AppVersion: "1.0.0",
Name: appName, Name: "cluster-issuers",
Version: "0.0.1", Version: "0.0.1",
} }

View File

@@ -82,10 +82,18 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if $config.healthchecks.startup }} {{- if and $config.healthchecks $config.healthchecks.startup }}
startupProbe: startupProbe:
{{ $config.healthchecks.startup | toJson | indent 10 }} {{ $config.healthchecks.startup | toJson | indent 10 }}
{{- end }} {{- end }}
{{- if and $config.healthchecks $config.healthchecks.liveness }}
livenessProbe:
{{ $config.healthchecks.liveness | toJson | indent 10 }}
{{- end }}
{{- if and $config.healthchecks $config.healthchecks.readiness }}
readinessProbe:
{{ $config.healthchecks.readiness | toJson | indent 10 }}
{{- end }}
{{- if $.Values.global.image.working_dir }} {{- if $.Values.global.image.working_dir }}
workingDir: {{ $.Values.global.image.working_dir }} workingDir: {{ $.Values.global.image.working_dir }}
{{- end }} {{- end }}

View File

@@ -222,7 +222,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
return fmt.Errorf("Error loading environment for deployment: %w", err) return fmt.Errorf("Error loading environment for deployment: %w", err)
} }
err = applyClusterIssuers(ctx, appName) err = applyClusterIssuers(ctx)
if err != nil { if err != nil {
return fmt.Errorf("Error applying cluster issuers: %w", err) return fmt.Errorf("Error applying cluster issuers: %w", err)
} }