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
31 changes: 30 additions & 1 deletion charts/crowdsec/templates/agent-daemonSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,36 @@ spec:
- name: wait-for-lapi-and-register
image: "{{ .Values.image.repository | default "crowdsecurity/crowdsec" }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ['sh', '-c', 'until nc "$LAPI_HOST" "$LAPI_PORT" -z; do echo waiting for lapi to start; sleep 5; done; ln -s /staging/etc/crowdsec /etc/crowdsec && cscli lapi register --machine "$USERNAME" -u "$LAPI_URL" --token "$REGISTRATION_TOKEN" && cp /etc/crowdsec/local_api_credentials.yaml /tmp_config/local_api_credentials.yaml']
command:
- sh
- "-c"
- |
until nc "$LAPI_HOST" "$LAPI_PORT" -z; do
echo waiting for lapi to start
sleep 5
done

ln -s /staging/etc/crowdsec /etc/crowdsec

if test -f /tmp_config/local_api_credentials.yaml
then
cp /tmp_config/local_api_credentials.yaml /etc/crowdsec/local_api_credentials.yaml

cscli lapi status &>/dev/null
val=$?

if test $val -eq 0
then
echo "Credentials found and valid"
exit 0
else
echo "Credentials found but not valid, trying re-register"
fi
fi

set -e
cscli lapi register --machine "$USERNAME" -u "$LAPI_URL" --token "$REGISTRATION_TOKEN"
cp /etc/crowdsec/local_api_credentials.yaml /tmp_config/local_api_credentials.yaml
{{- else }}
- name: wait-for-lapi
image: "{{ .Values.agent.wait_for_lapi.image.repository }}:{{ .Values.agent.wait_for_lapi.image.tag }}"
Expand Down
31 changes: 30 additions & 1 deletion charts/crowdsec/templates/agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,36 @@ spec:
- name: wait-for-lapi-and-register
image: "{{ .Values.image.repository | default "crowdsecurity/crowdsec" }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ['sh', '-c', 'until nc "$LAPI_HOST" "$LAPI_PORT" -z; do echo waiting for lapi to start; sleep 5; done; ln -s /staging/etc/crowdsec /etc/crowdsec && cscli lapi register --machine "$USERNAME" -u "$LAPI_URL" --token "$REGISTRATION_TOKEN" && cp /etc/crowdsec/local_api_credentials.yaml /tmp_config/local_api_credentials.yaml']
command:
- sh
- "-c"
- |
until nc "$LAPI_HOST" "$LAPI_PORT" -z; do
echo waiting for lapi to start
sleep 5
done

ln -s /staging/etc/crowdsec /etc/crowdsec

if test -f /tmp_config/local_api_credentials.yaml
then
cp /tmp_config/local_api_credentials.yaml /etc/crowdsec/local_api_credentials.yaml

cscli lapi status &>/dev/null
val=$?

if test $val -eq 0
then
echo "Credentials found and valid"
exit 0
else
echo "Credentials found but not valid, trying re-register"
fi
fi

set -e
cscli lapi register --machine "$USERNAME" -u "$LAPI_URL" --token "$REGISTRATION_TOKEN"
cp /etc/crowdsec/local_api_credentials.yaml /tmp_config/local_api_credentials.yaml
{{- else }}
- name: wait-for-lapi
image: "{{ .Values.agent.wait_for_lapi.image.repository }}:{{ .Values.agent.wait_for_lapi.image.tag }}"
Expand Down
31 changes: 30 additions & 1 deletion charts/crowdsec/templates/appsec-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,36 @@ spec:
- name: wait-for-lapi-and-register
image: "{{ .Values.image.repository | default "crowdsecurity/crowdsec" }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ['sh', '-c', 'until nc "$LAPI_HOST" "$LAPI_PORT" -z; do echo waiting for lapi to start; sleep 5; done; ln -s /staging/etc/crowdsec /etc/crowdsec && cscli lapi register --machine "$USERNAME" -u "$LAPI_URL" --token "$REGISTRATION_TOKEN" && cp /etc/crowdsec/local_api_credentials.yaml /tmp_config/local_api_credentials.yaml']
command:
- sh
- "-c"
- |
until nc "$LAPI_HOST" "$LAPI_PORT" -z; do
echo waiting for lapi to start
sleep 5
done

ln -s /staging/etc/crowdsec /etc/crowdsec

if test -f /tmp_config/local_api_credentials.yaml
then
cp /tmp_config/local_api_credentials.yaml /etc/crowdsec/local_api_credentials.yaml

cscli lapi status &>/dev/null
val=$?

if test $val -eq 0
then
echo "Credentials found and valid"
exit 0
else
echo "Credentials found but not valid, trying re-register"
fi
fi

set -e
cscli lapi register --machine "$USERNAME" -u "$LAPI_URL" --token "$REGISTRATION_TOKEN"
cp /etc/crowdsec/local_api_credentials.yaml /tmp_config/local_api_credentials.yaml
{{- else }}
- name: wait-for-lapi
image: "{{ .Values.appsec.wait_for_lapi.image.repository }}:{{ .Values.appsec.wait_for_lapi.image.tag }}"
Expand Down