Skip to content

Commit

Permalink
rekor: wait for services to start to avoid crashloop (#27)
Browse files Browse the repository at this point in the history
* rekor: wait for services to start to avoid crashloop

Signed-off-by: Carlos Panato <ctadeu@gmail.com>

* updates based on feedback

Signed-off-by: Carlos Panato <ctadeu@gmail.com>
  • Loading branch information
cpanato authored Nov 14, 2021
1 parent 8d265cd commit bb82bc5
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 21 deletions.
4 changes: 3 additions & 1 deletion charts/rekor/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Part of the sigstore project, Rekor is a timestamping server and tr

type: application

version: 0.2.3
version: 0.2.4
appVersion: 0.3.0

keywords:
Expand All @@ -30,3 +30,5 @@ annotations:
image: gcr.io/trillian-opensource-ci/db_server@sha256:e21b597eedb84063c7d958b6548e62ff1531a2ce7c024f366ccb4fb43163218c
- name: redis
image: docker.io/redis@sha256:0a0d563fd6fe5361316dd53f7f0a244656675054302567230e85eb114f683db4
- name: appropriate/curl
image: docker.io/appropriate/curl@sha256:c8bf5bbec6397465a247c2bb3e589bb77e4f62ff88a027175ecb2d9e4f12c9d7
10 changes: 5 additions & 5 deletions charts/rekor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ Log Server Arguments
{{- define "rekor.trillianLogServer.args" -}}
- '--storage_system=mysql'
- '--mysql_uri=$(MYSQL_USER):$(MYSQL_PASSWORD)@tcp($(MYSQL_HOSTNAME):$(MYSQL_PORT))/$(MYSQL_DATABASE)'
- '--rpc_endpoint=0.0.0.0:8091'
- '--http_endpoint=0.0.0.0:8090'
- {{ printf "--rpc_endpoint=0.0.0.0:%d" (.Values.trillianLogServer.portRPC | int) | quote }}
- {{ printf "--http_endpoint=0.0.0.0:%d" (.Values.trillianLogServer.portHTTP | int) | quote }}
- '--alsologtostderr'
{{- if .Values.trillianLogServer.extraArgs -}}
{{ toYaml .Values.trillianLogServer.extraArgs }}
Expand All @@ -364,8 +364,8 @@ Log Signer Arguments
{{- define "rekor.trillianLogSigner.args" -}}
- '--storage_system=mysql'
- '--mysql_uri=$(MYSQL_USER):$(MYSQL_PASSWORD)@tcp($(MYSQL_HOSTNAME):$(MYSQL_PORT))/$(MYSQL_DATABASE)'
- '--rpc_endpoint=0.0.0.0:8091'
- '--http_endpoint=0.0.0.0:8090'
- {{ printf "--rpc_endpoint=0.0.0.0:%d" (.Values.trillianLogSigner.portRPC | int) | quote }}
- {{ printf "--http_endpoint=0.0.0.0:%d" (.Values.trillianLogSigner.portHTTP | int) | quote }}
- '--force_master'
- '--alsologtostderr'
{{- if .Values.trillianLogSigner.extraArgs -}}
Expand All @@ -380,7 +380,7 @@ Server Arguments
{{- define "rekor.server.args" -}}
- "serve"
- {{ printf "--trillian_log_server.address=%s" (include "rekor.trillianLogServer.fullname" .) | quote }}
- {{ printf "--trillian_log_server.port=%d" (.Values.trillianLogServer.port | int) | quote }}
- {{ printf "--trillian_log_server.port=%d" (.Values.trillianLogServer.portRPC | int) | quote }}
- {{ printf "--redis_server.address=%s" (include "redis.hostname" .) | quote }}
- {{ printf "--redis_server.port=%d" (.Values.redis.port | int) | quote }}
- "--rekor_server.address=0.0.0.0"
Expand Down
6 changes: 5 additions & 1 deletion charts/rekor/templates/server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ spec:
{{- end}}
spec:
serviceAccountName: {{ template "rekor.serviceAccountName.server" . }}
{{- if .Values.server.extraInitContainers }}
initContainers:
- name: "wait-for-trillian-log-server"
image: "{{ template "rekor.image" .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.initContainerImage.imagePullPolicy }}
command: ["sh", "-c", "until curl --max-time 10 http://{{ template "rekor.trillianLogServer.fullname" . }}:{{ .Values.trillianLogServer.portHTTP}}; do echo waiting for {{ template "rekor.trillianLogServer.fullname" . }}; sleep 5; done;"]
{{- if .Values.server.extraInitContainers }}
{{ toYaml .Values.server.extraInitContainers | indent 8 }}
{{- end }}
{{- if .Values.server.priorityClassName }}
Expand Down
6 changes: 5 additions & 1 deletion charts/rekor/templates/trillian-log-server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ spec:
{{- end}}
spec:
serviceAccountName: {{ template "rekor.serviceAccountName.trillianLogServer" . }}
{{- if .Values.trillianLogServer.extraInitContainers }}
initContainers:
- name: "wait-for-trillian-db"
image: "{{ template "rekor.image" .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.initContainerImage.imagePullPolicy }}
command: ["sh", "-c", "until curl --max-time 10 http://{{ template "mysql.hostname" . }}:{{ .Values.mysql.port }}; do echo waiting for {{ template "mysql.hostname" . }}; sleep 5; done;"]
{{- if .Values.trillianLogServer.extraInitContainers }}
{{ toYaml .Values.trillianLogServer.extraInitContainers | indent 8 }}
{{- end }}
{{- if .Values.trillianLogServer.priorityClassName }}
Expand Down
6 changes: 5 additions & 1 deletion charts/rekor/templates/trillian-log-signer/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ spec:
{{- end}}
spec:
serviceAccountName: {{ template "rekor.serviceAccountName.trillianLogSigner" . }}
{{- if .Values.trillianLogSigner.extraInitContainers }}
initContainers:
- name: "wait-for-trillian-db"
image: "{{ template "rekor.image" .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.initContainerImage.imagePullPolicy }}
command: ["sh", "-c", "until curl --max-time 10 http://{{ template "mysql.hostname" . }}:{{ .Values.mysql.port }}; do echo waiting for {{ template "mysql.hostname" . }}; sleep 5; done;"]
{{- if .Values.trillianLogSigner.extraInitContainers }}
{{ toYaml .Values.trillianLogSigner.extraInitContainers | indent 8 }}
{{- end }}
{{- if .Values.trillianLogSigner.priorityClassName }}
Expand Down
57 changes: 48 additions & 9 deletions charts/rekor/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@
"enabled": true,
"replicaCount": 1,
"name": "trillian-log-server",
"port": 8091,
"portRPC": 8091,
"portHTTP": 8090,
"image": {
"registry": "gcr.io",
"repository": "trillian-opensource-ci/log_server",
Expand Down Expand Up @@ -272,6 +273,8 @@
"enabled": true,
"replicaCount": 1,
"name": "trillian-log-signer",
"portRPC": 8091,
"portHTTP": 8090,
"image": {
"registry": "gcr.io",
"repository": "trillian-opensource-ci/log_signer",
Expand All @@ -282,8 +285,8 @@
"type": "ClusterIP",
"ports": [
{
"name": "8092-tcp",
"port": 8092,
"name": "8091-tcp",
"port": 8091,
"protocol": "TCP",
"targetPort": 8091
}
Expand Down Expand Up @@ -2854,7 +2857,8 @@
"enabled": true,
"replicaCount": 1,
"name": "trillian-log-server",
"port": 8091,
"portRPC": 8091,
"portHTTP": 8090,
"image": {
"registry": "gcr.io",
"repository": "trillian-opensource-ci/log_server",
Expand Down Expand Up @@ -2893,7 +2897,8 @@
"enabled",
"replicaCount",
"name",
"port",
"portRPC",
"portHTTP",
"image",
"service",
"livenessProbe",
Expand Down Expand Up @@ -2932,8 +2937,8 @@
"trillian-log-server"
]
},
"port": {
"$id": "#/properties/trillianLogServer/properties/port",
"portRPC": {
"$id": "#/properties/trillianLogServer/properties/portRPC",
"type": "integer",
"title": "The port schema",
"description": "An explanation about the purpose of this instance.",
Expand All @@ -2942,6 +2947,16 @@
8091
]
},
"portHTTP": {
"$id": "#/properties/trillianLogServer/properties/portHTTP",
"type": "integer",
"title": "The port schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
8090
]
},
"image": {
"$id": "#/properties/trillianLogServer/properties/image",
"type": "object",
Expand Down Expand Up @@ -3259,6 +3274,8 @@
"enabled": true,
"replicaCount": 1,
"name": "trillian-log-signer",
"portRPC": 8091,
"portHTTP": 8090,
"image": {
"registry": "gcr.io",
"repository": "trillian-opensource-ci/log_signer",
Expand All @@ -3269,8 +3286,8 @@
"type": "ClusterIP",
"ports": [
{
"name": "8092-tcp",
"port": 8092,
"name": "8091-tcp",
"port": 8091,
"protocol": "TCP",
"targetPort": 8091
}
Expand All @@ -3291,6 +3308,8 @@
"enabled",
"replicaCount",
"name",
"portRPC",
"portHTTP",
"image",
"service",
"livenessProbe",
Expand Down Expand Up @@ -3329,6 +3348,26 @@
"trillian-log-signer"
]
},
"portRPC": {
"$id": "#/properties/trillianLogSigner/properties/portRPC",
"type": "integer",
"title": "The port schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
8091
]
},
"portHTTP": {
"$id": "#/properties/trillianLogSigner/properties/portHTTP",
"type": "integer",
"title": "The port schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
8090
]
},
"image": {
"$id": "#/properties/trillianLogSigner/properties/image",
"type": "object",
Expand Down
16 changes: 13 additions & 3 deletions charts/rekor/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
imagePullSecrets:

initContainerImage:
registry: docker.io
repository: appropriate/curl
# latest from 2021-10-28
version: sha256:c8bf5bbec6397465a247c2bb3e589bb77e4f62ff88a027175ecb2d9e4f12c9d7
imagePullPolicy: IfNotPresent

redis:
enabled: true
replicaCount: 1
Expand Down Expand Up @@ -180,7 +187,8 @@ trillianLogServer:
enabled: true
replicaCount: 1
name: trillian-log-server
port: 8091
portRPC: 8091
portHTTP: 8090
image:
registry: gcr.io
repository: trillian-opensource-ci/log_server
Expand Down Expand Up @@ -210,6 +218,8 @@ trillianLogSigner:
enabled: true
replicaCount: 1
name: trillian-log-signer
portRPC: 8091
portHTTP: 8090
image:
registry: gcr.io
repository: trillian-opensource-ci/log_signer
Expand All @@ -219,8 +229,8 @@ trillianLogSigner:
service:
type: ClusterIP
ports:
- name: 8092-tcp
port: 8092
- name: 8091-tcp
port: 8091
protocol: TCP
targetPort: 8091
livenessProbe: {}
Expand Down

0 comments on commit bb82bc5

Please sign in to comment.