Skip to content

Commit

Permalink
✨ Update init container checker (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Sep 26, 2024
1 parent 2537949 commit 9d4f430
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 43 deletions.
13 changes: 4 additions & 9 deletions deploy/sigma/templates/distribution/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,10 @@ spec:
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- |-
set -e;
echo "Waiting for sigma middlewares to be ready...";
sigma \
tools \
middleware-checker;
echo "sigma middlewares are all ready";
- sigma
args:
- tools
- middleware-checker
containers:
- name: {{ printf "%s-distribution" ( include "sigma.fullname" . ) | quote }}
securityContext:
Expand Down
25 changes: 24 additions & 1 deletion deploy/sigma/templates/post-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
spec:
backoffLimit: 1
backoffLimit: 6
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -24,6 +24,14 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: check-middlewares
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- sigma
args:
- tools
- middleware-checker
- name: check-distribution
image: {{ printf "%s:%s" .Values.image.osShell.repository .Values.image.osShell.tag | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand All @@ -39,6 +47,21 @@ spec:
--timeout=120 \
{{ .Values.service.distribution.port }};
echo "sigma distribution is available";
- name: check-server
image: {{ printf "%s:%s" .Values.image.osShell.repository .Values.image.osShell.tag | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- |-
set -e;
echo "Waiting for sigma server";
wait-for-port \
--host={{ include "sigma.server" . }} \
--state=inuse \
--timeout=120 \
{{ .Values.service.server.port }};
echo "sigma server is available";
containers:
- name: push-builder-images
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag | quote }}
Expand Down
13 changes: 4 additions & 9 deletions deploy/sigma/templates/server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ spec:
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- |-
set -e;
echo "Waiting for sigma middlewares to be ready...";
sigma \
tools \
middleware-checker;
echo "sigma middlewares are all ready";
- sigma
args:
- tools
- middleware-checker
containers:
- name: {{ printf "%s-server" .Chart.Name }}
securityContext:
Expand Down
13 changes: 4 additions & 9 deletions deploy/sigma/templates/worker/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ spec:
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- |-
set -e;
echo "Waiting for sigma middlewares to be ready...";
sigma \
tools \
middleware-checker;
echo "sigma middlewares are all ready";
- sigma
args:
- tools
- middleware-checker
containers:
- name: {{ include "sigma.worker" . | quote }}
securityContext:
Expand Down
15 changes: 0 additions & 15 deletions pkg/configs/checker.go

This file was deleted.

5 changes: 5 additions & 0 deletions pkg/configs/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/jackc/pgx/v4"
"github.com/redis/go-redis/v9"
"github.com/rs/zerolog/log"

"github.com/go-sigma/sigma/pkg/types/enums"

Expand Down Expand Up @@ -55,6 +56,7 @@ func checkRedis(config Configuration) error {
if err != nil {
return fmt.Errorf("redis.Close error: %v", err)
}
log.Info().Msg("redis check passed")
return nil
}

Expand Down Expand Up @@ -90,6 +92,7 @@ func checkMysql(config Configuration) error {
if err != nil {
return fmt.Errorf("db.Close error: %v", err)
}
log.Info().Msg("mysql check passed")
return nil
}

Expand All @@ -106,6 +109,7 @@ func checkPostgresql(config Configuration) error {
if err != nil {
return fmt.Errorf("conn.Close error: %v", err)
}
log.Info().Msg("postgresql check passed")
return nil
}

Expand Down Expand Up @@ -142,5 +146,6 @@ func checkStorageS3(cfg Configuration) error {
if err != nil {
return fmt.Errorf("s3.HeadBucket error: %v", err)
}
log.Info().Msg("s3 obs check passed")
return nil
}

0 comments on commit 9d4f430

Please sign in to comment.